Test of new pairing proceedure
This commit is contained in:
@ -14,9 +14,14 @@ const BLE_MAX_INTERVAL: u16 = 48; // x 1.25ms
|
||||
const BLE_LATENCY: u16 = 0; // Number of packets that can be missed, extending interval
|
||||
const BLE_TIMEOUT: u16 = 500; // x10ms
|
||||
|
||||
const SVC_DATA_PAIRING: [u8; 1] = [1]; // TODO: bitflag these
|
||||
const SVC_DATA_NO_PAIRING: [u8; 1] = [0];
|
||||
|
||||
|
||||
const DEVICE_NAME: &str = "Gem Remotes";
|
||||
|
||||
const UUID_SERVICE_PAIR: BleUuid = uuid128!("9966ad5a-f13c-4b61-ba66-0861e08d09b4");
|
||||
// The [u8] version is, for whatever reason, little-endian. This should equate to the UUID "9966ad5a-f13c-4b61-ba66-0861e08d09b4".
|
||||
const UUID_SERVICE_PAIR: BleUuid = BleUuid::from_uuid128([0xB4, 0x09, 0x8D, 0xE0, 0x61, 0x08, 0x66, 0xBA, 0x61, 0x4B, 0x3C, 0xF1, 0x5A, 0xAD, 0x66, 0x99]);
|
||||
const UUID_SERVICE_LIFT: BleUuid = uuid128!("c1400000-8dda-45a3-959b-d23a0f8f53d7");
|
||||
|
||||
const UUID_BUTTON_UP: BleUuid = uuid128!("c1401121-8dda-45a3-959b-d23a0f8f53d7");
|
||||
@ -59,7 +64,6 @@ impl BleServer {
|
||||
set_device_security(ble_device);
|
||||
let server = ble_device.get_server();
|
||||
set_server_callbacks(server, self.send_q.clone());
|
||||
let _pairing_service = server.create_service(UUID_SERVICE_PAIR);
|
||||
let lift_service = server.create_service(UUID_SERVICE_LIFT);
|
||||
|
||||
trace!("Setting up GATT");
|
||||
@ -197,14 +201,14 @@ fn set_server_callbacks(server: &mut BLEServer, sender: SendQ) {
|
||||
|
||||
fn advertise(advertiser: &Mutex<BLEAdvertising>) -> Result<()> {
|
||||
trace!("Setting up advertiser");
|
||||
let mut beacon_data = BLEAdvertisementData::new();
|
||||
beacon_data.name(DEVICE_NAME);
|
||||
//.add_service_uuid(UUID_SERVICE_PAIR);
|
||||
beacon_data.service_data(UUID_SERVICE_PAIR, &SVC_DATA_PAIRING);
|
||||
advertiser
|
||||
.lock()
|
||||
.advertisement_type(ConnMode::Und)
|
||||
.set_data(
|
||||
BLEAdvertisementData::new()
|
||||
.name(DEVICE_NAME)
|
||||
.add_service_uuid(UUID_SERVICE_PAIR)
|
||||
)?;
|
||||
.set_data(&mut beacon_data)?;
|
||||
info!("Staring Bluetooth Server");
|
||||
advertiser.lock().start()?;
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user