On the glasses
Device and media
Battery, clock, music controls, display power and audio levels.
These functions run locally on the glasses. They work without a phone connection and return right away.
Battery, clock and connection
device_status(out, capacity) fills a buffer of at least 10 bytes and returns 10, or -1 if the buffer is too small.
| Byte | Value |
|---|---|
0 | Battery percent, 0 to 100. Anything else means unknown. |
1 | Charging (1) or not (0) |
2 | Classic Bluetooth (audio) connected |
3 | Phone link connected |
4 | Clock is set |
5 to 9 | Hour (0 to 23), minute, month (1 to 12), day (1 to 31), weekday (Sunday is 0) |
now_ms() returns a millisecond clock you can use for timing and animation.
Media
Show what’s playing and control it, straight from the glasses.
media_state(out, capacity)writes an available byte, a playing byte, then the title and artist as null-terminated UTF-8 (up to 80 bytes each, so use a 164-byte buffer). Nothing playing reads as[0, 0]. It returns the byte count, or-1if the buffer is too small.media_command(command)takes0previous,1play or pause,2next,3volume up,4volume down. It returns1when the command was sent,0if sending failed and-1for an unknown command. Sent doesn’t guarantee the player acted on it.
Read media_state when your media screen opens and about every 250 ms while it’s visible. Shared/media.rs wraps both functions.
Display
| Function | Does |
|---|---|
display_brightness_get() | Returns the current brightness in percent. |
display_brightness_set(percent) | Sets brightness from 0 to 100 right away and returns the value applied. |
display_power_get() | Returns 1 while the display is awake and 0 while it’s asleep. |
display_power_set(on) | 1 wakes the display, or keeps it awake by resetting its idle timer. 0 puts it to sleep. |
Audio levels
audio_level(channel) returns a loudness from 0 to 255, averaged over about 50 ms. Channel 0 is the glasses microphone and channel 1 is MIRA’s spoken replies. Readings older than 400 ms, and invalid channels, return 0.
Use it for meters and visualizers, and do your own smoothing. To work with the audio itself, see Microphone audio.