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.cpp@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 | #include "BLE.h" |
marcusC | 0:2c8c5bd785f4 | 2 | #include "iBeaconScan.h" |
marcusC | 0:2c8c5bd785f4 | 3 | |
marcusC | 0:2c8c5bd785f4 | 4 | BLE bleIBeacon; |
marcusC | 0:2c8c5bd785f4 | 5 | extern void AdvertisementReportCallback(const Gap::AdvertisementCallbackParams_t *params); |
marcusC | 0:2c8c5bd785f4 | 6 | |
marcusC | 0:2c8c5bd785f4 | 7 | void iBeaconInit(void) |
marcusC | 0:2c8c5bd785f4 | 8 | { |
marcusC | 0:2c8c5bd785f4 | 9 | bleIBeacon.init(); |
marcusC | 0:2c8c5bd785f4 | 10 | } |
marcusC | 0:2c8c5bd785f4 | 11 | |
marcusC | 0:2c8c5bd785f4 | 12 | void iBeaconStartScan(void) |
marcusC | 0:2c8c5bd785f4 | 13 | { |
marcusC | 0:2c8c5bd785f4 | 14 | bleIBeacon.startScan(AdvertisementReportCallback); |
marcusC | 0:2c8c5bd785f4 | 15 | } |
marcusC | 0:2c8c5bd785f4 | 16 | |
marcusC | 0:2c8c5bd785f4 | 17 | void iBeaconStopScan(void) |
marcusC | 0:2c8c5bd785f4 | 18 | { |
marcusC | 0:2c8c5bd785f4 | 19 | bleIBeacon.stopScan(); |
marcusC | 0:2c8c5bd785f4 | 20 | } |