Glassly Miniapp SDK betaThe SDK is in beta, so its APIs may change before general availability.Developing on Mentra Live? We recommend using the Glassly Bluetooth SDK.The developer tools are available in the Glassly App under Settings → Miniapp developer settings. To show that row, tap the version number at the bottom of Settings 10 times.Share feedback with an in-app bug report, on Discord, or by email at help@glassly.ai.
session.glasses reports on the glasses hardware: battery level plus charging state, connection state, Wi-Fi state, and whether the glasses are being worn. All are subscriptions, so you get a callback whenever the value changes.
src/background/index.ts
There’s no synchronous getter for the current value. You learn the state by subscribing and waiting for the first event.

Battery

onBattery fires when the glasses report a new battery reading.
Each BatteryData has:

Connection

onConnection fires when the glasses connect or disconnect.
Each ConnectionData has: modelName is optional, so guard for it before reading:

Wi-Fi

onWifi fires the current state on subscribe, then again on every change. connected is false on glasses without Wi-Fi.
Each WifiData has: requestWifiSetup(reason?) asks the host to open the glasses Wi-Fi setup flow on the phone. reason is a user-facing line shown in the setup prompt.

Wear

onWear tells you whether the glasses are on the wearer’s head. It fires the current state on subscribe once the glasses have reported it, then again on every change.
Each WearData has: Putting the glasses on is reported at once. Taking them off is reported after about 5 seconds, and not at all if the sensor reads “worn” again within that time, because the sensor dips briefly while the glasses stay on. Only Even G1 and Even G2 on Glassly custom firmware report wear state. On other glasses the handler never fires, so you can subscribe without checking first. session.capabilities.hasWearDetection is true while the connected glasses report it. It is set a moment after the glasses connect, so follow it with session.onCapabilitiesChange if your UI depends on it:
In the simulator, glassly sim wear off and glassly sim wear on take the glasses off and put them back, on the g1-cfw and g2-cfw devices.

Cleaning up

Every subscription method returns an unsubscribe function:
session.glasses covers the glasses hardware. The phone has its own battery and connection events on session.phone. For what the connected glasses can do (display, camera, sensors), read session.capabilities once the session is ready.