Provide BLE API to parse the iBeacon packet and print the message. Leverage the BLE scan_start, scan_stop API to get iBeacon.
Dependents: BLE_iBeaconScan BLE_iBeaconScan
Use the following API to complete the iBeacon parser:
iBeaconInit() - Use BLE API to initialize the BLE stack
iBeaconStartScan() - Use BLE API to start BLE scan
iBeaconStopScan() - Use BLE API to stop BLE scan
AdvertisementReportCallback - Parse the iBeacon to uuid, major number, minor number, tx power field
iBeaconScan.h@0:2c8c5bd785f4, 2015-11-26 (annotated)
- Committer:
- marcusC
- Date:
- Thu Nov 26 05:55:06 2015 +0000
- Revision:
- 0:2c8c5bd785f4
First Commit, provide the start_scan, stop_scan, parse iBeacon packet API
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marcusC | 0:2c8c5bd785f4 | 1 | struct iBeaconPayload { |
marcusC | 0:2c8c5bd785f4 | 2 | uint8_t prefix[9]; |
marcusC | 0:2c8c5bd785f4 | 3 | uint8_t uuid[16]; |
marcusC | 0:2c8c5bd785f4 | 4 | uint8_t majorNumber[2]; |
marcusC | 0:2c8c5bd785f4 | 5 | uint8_t minorNumber[2]; |
marcusC | 0:2c8c5bd785f4 | 6 | uint8_t txPower; |
marcusC | 0:2c8c5bd785f4 | 7 | }; |
marcusC | 0:2c8c5bd785f4 | 8 | |
marcusC | 0:2c8c5bd785f4 | 9 | union unionType { |
marcusC | 0:2c8c5bd785f4 | 10 | struct iBeaconPayload iBeaconPayload_m; |
marcusC | 0:2c8c5bd785f4 | 11 | uint8_t rawData[30]; |
marcusC | 0:2c8c5bd785f4 | 12 | }; |
marcusC | 0:2c8c5bd785f4 | 13 | |
marcusC | 0:2c8c5bd785f4 | 14 | const uint8_t iBeaconPrefix[] = {0x02,0x01,0x06,0x1a,0xff,0x4c,0x00,0x02,0x15}; |
marcusC | 0:2c8c5bd785f4 | 15 | |
marcusC | 0:2c8c5bd785f4 | 16 | void iBeaconInit(void); |
marcusC | 0:2c8c5bd785f4 | 17 | void iBeaconStartScan(void); |
marcusC | 0:2c8c5bd785f4 | 18 | void iBeaconStopScan(void); |