Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers aconno_ble.h Source File

aconno_ble.h

00001 /*
00002 *  Made by Jurica Resetar @ aconno
00003 *  More info @ aconno.de
00004 *  jurica_resetar@yahoo.com
00005 */
00006 
00007 #ifndef ACONNO_BLE_H
00008 #define ACONNO_BLE_H
00009 
00010 #include "mbed.h"
00011 #include "ble/BLE.h"
00012 #include "GapAdvertisingData.h"
00013 #include "lizzy_service.h"
00014 #include "proj_config.h"
00015 
00016 #if VODAFONE_COMPATIBILITY == 1
00017 const uint8_t UUID[16] = {0xE1, 0x61, 0x35, 0xBA, 0xC0, 0xEC, 0x47, 0x2A, 0x98, 0x00, 0xAF, 0x18, 0x43, 0xFF, 0x05, 0x00};
00018 #endif
00019 
00020 #define APPLICATION_ID      (0xCF170059) //(0xCF170059)
00021 
00022 #define LSB_VALUE           (0xFFFF)    // this is divided by 2^16 in app
00023 
00024 /* Global variables and constants */
00025 
00026 struct __attribute__((packed, aligned(1))) advertising_packet{
00027     uint32_t header;
00028     uint8_t  type;
00029     union{
00030         struct{
00031             int16_t gyroscope[3];
00032             int16_t accelerometer[3];
00033             int16_t magnetometer[3];
00034             uint16_t acc_lsb_value;
00035         };
00036         struct{
00037             float temperature;
00038             float humidity;
00039             float pressure;
00040             float light;
00041             uint8_t battery;
00042         };
00043     };
00044 };
00045 
00046 extern LizzyService *lizzy_service;
00047 
00048 /* Function declarations */
00049 EventQueue *getBLEEventQueue(void);
00050 bool bleIsClientConnected(void);
00051 void bleInitComplete(BLE::InitializationCompleteCallbackContext *params);
00052 void updatePayload(BLE *ble, advertising_packet *advertisementPacket);
00053 
00054 
00055 #endif      //ACONNO_BLE_H