Last active
November 13, 2020 19:08
-
-
Save bobmcwhirter/501bc1fca11c421c57be7bd8f75e25b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let host: &mut BlueNrgHost<'_> = ctx.resources.ble_host; | |
| let params = LeSetAdvertisingParameters { | |
| min_interval: Milliseconds(500), | |
| max_interval: Milliseconds(500), | |
| advertising_type: AdvertisingType::ConnectableAndScannableUndirected, | |
| own_address_type: Default::default(), | |
| peer_address_type: Default::default(), | |
| peer_address: Address([0, 0, 0, 0, 0, 0]), | |
| channel_map: Default::default(), | |
| filter_policy: Default::default(), | |
| }; | |
| host.set_advertising_parameters(params).unwrap(); | |
| let mut advertising_data = Vec::new(); | |
| advertising_data.push( | |
| AdvertisingData::AdvertisingFlags( | |
| AdvertisingFlags { | |
| discoverability: Discoverability::General, | |
| capability: Capability::LeOnly, | |
| } | |
| ) | |
| ); | |
| advertising_data.push( | |
| AdvertisingData::ManufacturerSpecific( | |
| CompanyIdentifier(0x004c), Vec::from_slice( &[ 0x02, 0x15, | |
| 0xF0, 0x01, 0x8B, 0x9B, /**/ 0x75, 0x09, /**/ 0x4C, 0x31, /**/ 0xA9, 0x05, /**/ 0x1A, 0x27, 0xD3, 0x9C, 0x00, 0x3C, | |
| 0x00, 0x01, 0x00, 0x02, | |
| 0xc8 | |
| ] ).unwrap() | |
| ) | |
| ); | |
| host.set_advertising_data(advertising_data).unwrap(); | |
| host.set_advertising_enable(true).unwrap(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment