# Wi‑Fi P2P only

## Purpose

Demonstrate **standalone** Glass discovery and Wi‑Fi Direct attach without running the combined wizard.

## Entry point

Example screen:

- `com.rokid.phone.ui.WifiP2PSettingActivity`

## Platform

- Phone

## Main files

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

## Flow

1. Register `IWifiP2PClientListener` during `onCreate`/init.  
2. Call `initialize()` to bring P2P infra online.  
3. Call `startDiscoverPeers()`.  
4. In `onPeersAvailable()`, keep devices whose names include `Glass3_`.  
5. After user intent, call `connectDevice()`.  
6. Persist the resulting `WifiP2pDevice` metadata for later reconnects.

## SDK surface exposed

- Wi‑Fi Direct init / teardown  
- Peer scan  
- Attach + status listeners  

## Notes for developers

### Compared with the unified pairing sheet

Ideal when you already have Bluetooth for control-plane work and merely need Direct for bulk transport or streams—easy to refactor out of production apps.

## Caveats

- Matching delegates to `DeviceLinkerManager.getDeviceName()`.  
- Scanning refuses to continue if WLAN stays disabled (toast only).  
- Always persist bonded peer metadata; auto reconnect depends on it.  
