EEP fORK
Dependencies: BLE_API mbed nRF51822
Fork of MCS_LRF by
bleHelper.h@7:8a23a257b66a, 2015-12-09 (annotated)
- Committer:
- Farshad
- Date:
- Wed Dec 09 03:28:42 2015 +0000
- Revision:
- 7:8a23a257b66a
- Child:
- 9:afd6bd6e88bd
First cut. Testing works with single measurement averaging 10 readings.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Farshad | 7:8a23a257b66a | 1 | |
Farshad | 7:8a23a257b66a | 2 | #ifndef __BLE_HELPER_H__ |
Farshad | 7:8a23a257b66a | 3 | #define __BLE_HELPER_H__ |
Farshad | 7:8a23a257b66a | 4 | |
Farshad | 7:8a23a257b66a | 5 | #include "mbed.h" |
Farshad | 7:8a23a257b66a | 6 | #include "Serial.h" |
Farshad | 7:8a23a257b66a | 7 | #include "BLE.h" |
Farshad | 7:8a23a257b66a | 8 | #include "DeviceInformationService.h" |
Farshad | 7:8a23a257b66a | 9 | #include "UARTService.h" |
Farshad | 7:8a23a257b66a | 10 | |
Farshad | 7:8a23a257b66a | 11 | |
Farshad | 7:8a23a257b66a | 12 | |
Farshad | 7:8a23a257b66a | 13 | class BLEHelper |
Farshad | 7:8a23a257b66a | 14 | { |
Farshad | 7:8a23a257b66a | 15 | public: |
Farshad | 7:8a23a257b66a | 16 | // constructor |
Farshad | 7:8a23a257b66a | 17 | BLEHelper(BLEDevice* ble, UARTService* UuartServicePtr); |
Farshad | 7:8a23a257b66a | 18 | |
Farshad | 7:8a23a257b66a | 19 | void sendPacketOverBLE(uint16_t cmd, uint8_t data[], uint16_t len); |
Farshad | 7:8a23a257b66a | 20 | |
Farshad | 7:8a23a257b66a | 21 | |
Farshad | 7:8a23a257b66a | 22 | private: |
Farshad | 7:8a23a257b66a | 23 | typedef enum { |
Farshad | 7:8a23a257b66a | 24 | PS_FIRST_AND_ONLY = 0b0000000000000000, |
Farshad | 7:8a23a257b66a | 25 | PS_FIRST_AND_NOT_LAST = 0b0010000000000000, |
Farshad | 7:8a23a257b66a | 26 | PS_LAST = 0b0100000000000000, |
Farshad | 7:8a23a257b66a | 27 | PS_MIDDLE = 0b0110000000000000 |
Farshad | 7:8a23a257b66a | 28 | } PacketStatus_e; |
Farshad | 7:8a23a257b66a | 29 | |
Farshad | 7:8a23a257b66a | 30 | BLEDevice* blePtr; |
Farshad | 7:8a23a257b66a | 31 | UARTService* uartServicePtr; |
Farshad | 7:8a23a257b66a | 32 | PacketStatus_e packetStatus; |
Farshad | 7:8a23a257b66a | 33 | |
Farshad | 7:8a23a257b66a | 34 | void sendOverBLE(uint16_t cmd, uint8_t data[], uint16_t len, PacketStatus_e status); |
Farshad | 7:8a23a257b66a | 35 | }; |
Farshad | 7:8a23a257b66a | 36 | |
Farshad | 7:8a23a257b66a | 37 | |
Farshad | 7:8a23a257b66a | 38 | |
Farshad | 7:8a23a257b66a | 39 | #endif // __BLE_HELPER_H__ |