Bernard Mentink / Mbed 2 deprecated MCS_LRF_EEP

Dependencies:   BLE_API mbed nRF51822

Fork of MCS_LRF by Farshad N

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers bleHelper.h Source File

bleHelper.h

00001 
00002 #ifndef __BLE_HELPER_H__
00003 #define __BLE_HELPER_H__
00004 
00005 #include "mbed.h"
00006 #include "Serial.h"
00007 #include "BLE.h"
00008 #include "DeviceInformationService.h"
00009 #include "UARTService.h"
00010 
00011 
00012 /* helper class to break larger than 20 byte limit of a BLE payload to smaller multiple
00013    packets and send over the BLE connection */
00014 class BLEHelper
00015 {
00016 public:
00017     // constructor
00018     BLEHelper(BLEDevice* ble, UARTService* UuartServicePtr);
00019     void sendPacketOverBLE(uint16_t cmd, uint8_t data[], uint16_t len);
00020 
00021 private:
00022     typedef enum {
00023         PS_FIRST_AND_ONLY =     0b0000000000000000,
00024         PS_FIRST_AND_NOT_LAST = 0b0010000000000000,
00025         PS_LAST =               0b0100000000000000,
00026         PS_MIDDLE =             0b0110000000000000
00027     } PacketStatus_e;
00028     
00029     BLEDevice* blePtr;
00030     UARTService* uartServicePtr;
00031     PacketStatus_e packetStatus;
00032 
00033     void sendOverBLE(uint16_t cmd, uint8_t data[], uint16_t len, PacketStatus_e status);
00034 };
00035 
00036 
00037 
00038 #endif // __BLE_HELPER_H__