# Glass settings sync

## Purpose

Demonstrate how the phone sends configuration, system-info requests, brightness, volume, and custom wake settings to the glasses through `DeviceLinkerManager`.

## Entry points

Core helpers:

- `DeviceLinkerManager.sendConfig(...)`
- `DeviceLinkerManager.getGlassSystemInfoMsg()`
- `DeviceLinkerManager.setBrightness(...)`
- `DeviceLinkerManager.setVolume(...)`
- `DeviceLinkerManager.setCustomWake(...)`

## Platforms

- Phone  
- Glass (applies mirrored payloads)

## Main files

- [DeviceLinkerManager.kt](https://gitee.com/as_pixar/glass3sdkdemo/blob/main/glass3sdkphonedemo/app/src/main/java/com/rokid/phone/DeviceLinkerManager.kt)
- [Config.kt](https://gitee.com/as_pixar/glass3sdkdemo/blob/main/glass3sdkphonedemo/app/src/main/java/com/rokid/phone/data/Config.kt)
- [MainPhoneActivity.kt](https://gitee.com/as_pixar/glass3sdkdemo/blob/main/glass3sdkphonedemo/app/src/main/java/com/rokid/phone/ui/MainPhoneActivity.kt)

## Synced configuration fields

The current `Config` model contains:

- `configVersion`: configuration version.
- `envType`: environment type.
- `showToHide`: apps shown by default but hidden by this configuration.
- `hideToShow`: apps hidden by default but shown by this configuration.
- `voiceAction`: offline voice commands.

Brightness, volume, and custom wake settings are not fields inside `Config`; they are sent through dedicated `DeviceLinkerManager` methods.

## Flow

1. The phone prepares a `Config` object.
2. After Bluetooth is connected, call `DeviceLinkerManager.sendConfig(config)`.
3. To query system information, call `DeviceLinkerManager.getGlassSystemInfoMsg()`.
4. To update brightness, volume, or custom wake settings, call the corresponding `DeviceLinkerManager` method.
5. The glasses apply the message according to the business protocol.

## Implementation notes

`DeviceLinkerManager.sendConfig(config)` converts `Config` into a custom message and sends it over the classic Bluetooth message channel.

```kotlin
DeviceLinkerManager.sendConfig(MyApplication.config)
```

Brightness, volume, and custom wake are sent as immediate commands:

```kotlin
DeviceLinkerManager.setBrightness(progress)
DeviceLinkerManager.setVolume(progress)
DeviceLinkerManager.setCustomWake(true)
```

## Caveats

- `Config` fields are part of the business protocol between the phone and glasses.
- If you add new configuration fields, update the sender, receiver, and glasses-side handling together.
