M2GlassesService

class M2GlassesService : M2Service

Service for managing the physical connection to the Maverick2 glasses and monitoring their hardware state.

Functions

Link copied to clipboard

Checks whether the glasses are currently detected on the user's face.

Link copied to clipboard
fun battery(): Int

Returns the current battery level as a percentage.

Link copied to clipboard
fun batteryMW(): Int

Returns the current system power consumption reading.

Link copied to clipboard
fun connect()

Initiates a connection to the glasses using the currently configured transport (BLE or WebSocket simulator).

Link copied to clipboard

Returns a parsed human-readable description of the glasses serial number.

Link copied to clipboard

Disconnects the active transport session (BLE or WebSocket).

Link copied to clipboard
fun enableDevice(device: M2DeviceType, enable: Boolean)

Enables or disables a hardware device component on the glasses.

Link copied to clipboard

Returns the major firmware version number as a string.

Link copied to clipboard

Returns the firmware version as a four-element array: [major, minor, patch, build].

Link copied to clipboard

Returns the current high-level connection status.

Link copied to clipboard

Returns the currently configured target BLE device address.

Link copied to clipboard

Returns the currently configured target device name.

Converts a raw core device-type byte to a human-readable device name.

Link copied to clipboard

Returns true when a target device is configured for connection.

Link copied to clipboard

Checks whether an external power source is physically connected.

Link copied to clipboard

Checks whether the battery is actively charging.

Link copied to clipboard

Checks whether the transport layer is currently connected.

Link copied to clipboard

Queries whether a specific hardware device component is currently enabled on the glasses.

Link copied to clipboard

Checks whether the proximity sensor is currently enabled.

Link copied to clipboard

Checks whether the glasses have reached the ConnectionStatus.Ready state, meaning all SDK services are fully operational.

Link copied to clipboard

Checks whether the WebSocket simulator transport has been configured.

Link copied to clipboard

Checks whether the touchpad is currently enabled.

Link copied to clipboard

Registers a listener for battery and charging state events.

Link copied to clipboard

Registers a listener for connection lifecycle events.

Link copied to clipboard

Registers a listener for system, touch, and power-button events.

Link copied to clipboard
fun serial(): String

Returns the raw serial number string reported by the glasses firmware.

Link copied to clipboard
fun setConfiguredDevice(address: String?, name: String? = null, autoConnect: Boolean = true)

Configure connection to a BLE device (glasses).

Link copied to clipboard
fun setConfiguredSimulator(simulatorIpOrHost: String, autoConnect: Boolean = true)

Configure connection to the WebSocket simulator transport.

Link copied to clipboard

Unregisters a previously registered battery event listener.

Link copied to clipboard

Unregisters a previously registered connection lifecycle listener.

Link copied to clipboard

Unregisters a previously registered system event listener.