M2GlassesService

class M2GlassesService : M2Service

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

Properties

Link copied to clipboard

Milliseconds since epoch when the glasses last reached the Ready state, 0 before the first ready. Useful for measuring connect time and for ignoring stale pre-ready events.

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 four firmware version numbers reported by the glasses, in order: ver0, ver1, ver2, ver3 - the same four values com.everysight.mav2.sdk.viewmodels.M2GlassesViewModel exposes as fwVersion0 to fwVersion3. They are firmware-defined counters, not a semantic version, so do not read them as major/minor/patch.

Link copied to clipboard

Returns the persisted WebSocket simulator host, normalized the same way setConfiguredSimulator normalizes its argument.

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.

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 M2ConnectionStatus.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.