Lizzy project
Dependencies: aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT
aconno_ble/aconno_ble.h@29:b021b33cf666, 2019-01-31 (annotated)
- Committer:
- jurica238814
- Date:
- Thu Jan 31 15:50:52 2019 +0100
- Branch:
- master
- Revision:
- 29:b021b33cf666
- Parent:
- 26:6101bb09f70d
Scaling factor hardcoded for acnSENSA format
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jurica238814 | 0:fc77522f4d28 | 1 | /* |
jurica238814 | 0:fc77522f4d28 | 2 | * Made by Jurica Resetar @ aconno |
jurica238814 | 0:fc77522f4d28 | 3 | * More info @ aconno.de |
jurica238814 | 0:fc77522f4d28 | 4 | * jurica_resetar@yahoo.com |
jurica238814 | 0:fc77522f4d28 | 5 | */ |
jurica238814 | 0:fc77522f4d28 | 6 | |
jurica238814 | 0:fc77522f4d28 | 7 | #ifndef ACONNO_BLE_H |
jurica238814 | 0:fc77522f4d28 | 8 | #define ACONNO_BLE_H |
jurica238814 | 0:fc77522f4d28 | 9 | |
jurica238814 | 0:fc77522f4d28 | 10 | #include "mbed.h" |
jurica238814 | 0:fc77522f4d28 | 11 | #include "ble/BLE.h" |
jurica238814 | 0:fc77522f4d28 | 12 | #include "GapAdvertisingData.h" |
dbartolovic | 8:7ba4f82de9b6 | 13 | #include "lizzy_service.h" |
dbartolovic | 26:6101bb09f70d | 14 | #include "proj_config.h" |
jurica238814 | 0:fc77522f4d28 | 15 | |
dbartolovic | 26:6101bb09f70d | 16 | #if VODAFONE_COMPATIBILITY == 1 |
dbartolovic | 26:6101bb09f70d | 17 | const uint8_t UUID[16] = {0xE1, 0x61, 0x35, 0xBA, 0xC0, 0xEC, 0x47, 0x2A, 0x98, 0x00, 0xAF, 0x18, 0x43, 0xFF, 0x05, 0x00}; |
dbartolovic | 26:6101bb09f70d | 18 | #endif |
dbartolovic | 26:6101bb09f70d | 19 | |
dbartolovic | 1:198b9945994e | 20 | #define APPLICATION_ID (0xCF170059) //(0xCF170059) |
jurica238814 | 0:fc77522f4d28 | 21 | |
dbartolovic | 9:aef8bb3d13ed | 22 | #define LSB_VALUE (0xFFFF) // this is divided by 2^16 in app |
dbartolovic | 8:7ba4f82de9b6 | 23 | |
jurica238814 | 0:fc77522f4d28 | 24 | /* Global variables and constants */ |
jurica238814 | 0:fc77522f4d28 | 25 | |
jurica238814 | 0:fc77522f4d28 | 26 | struct __attribute__((packed, aligned(1))) advertising_packet{ |
jurica238814 | 0:fc77522f4d28 | 27 | uint32_t header; |
jurica238814 | 0:fc77522f4d28 | 28 | uint8_t type; |
jurica238814 | 0:fc77522f4d28 | 29 | union{ |
jurica238814 | 0:fc77522f4d28 | 30 | struct{ |
jurica238814 | 0:fc77522f4d28 | 31 | int16_t gyroscope[3]; |
jurica238814 | 0:fc77522f4d28 | 32 | int16_t accelerometer[3]; |
jurica238814 | 0:fc77522f4d28 | 33 | int16_t magnetometer[3]; |
dbartolovic | 5:9903738f2587 | 34 | uint16_t acc_lsb_value; |
jurica238814 | 0:fc77522f4d28 | 35 | }; |
jurica238814 | 0:fc77522f4d28 | 36 | struct{ |
jurica238814 | 0:fc77522f4d28 | 37 | float temperature; |
jurica238814 | 0:fc77522f4d28 | 38 | float humidity; |
jurica238814 | 0:fc77522f4d28 | 39 | float pressure; |
jurica238814 | 0:fc77522f4d28 | 40 | float light; |
jurica238814 | 0:fc77522f4d28 | 41 | uint8_t battery; |
jurica238814 | 0:fc77522f4d28 | 42 | }; |
jurica238814 | 0:fc77522f4d28 | 43 | }; |
jurica238814 | 0:fc77522f4d28 | 44 | }; |
jurica238814 | 0:fc77522f4d28 | 45 | |
dbartolovic | 8:7ba4f82de9b6 | 46 | extern LizzyService *lizzy_service; |
dbartolovic | 8:7ba4f82de9b6 | 47 | |
jurica238814 | 0:fc77522f4d28 | 48 | /* Function declarations */ |
dbartolovic | 15:c0c01188a29b | 49 | EventQueue *getBLEEventQueue(void); |
dbartolovic | 16:482d8f81d6f3 | 50 | bool bleIsClientConnected(void); |
jurica238814 | 0:fc77522f4d28 | 51 | void bleInitComplete(BLE::InitializationCompleteCallbackContext *params); |
jurica238814 | 0:fc77522f4d28 | 52 | void updatePayload(BLE *ble, advertising_packet *advertisementPacket); |
jurica238814 | 0:fc77522f4d28 | 53 | |
jurica238814 | 0:fc77522f4d28 | 54 | |
jurica238814 | 0:fc77522f4d28 | 55 | #endif //ACONNO_BLE_H |