Bluetooth Low Energy template with prewritten functions and callbacks for BLE events.

Committer:
jurica238814
Date:
Fri Jun 22 15:05:42 2018 +0200
Revision:
0:dbe0ce913311
init commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jurica238814 0:dbe0ce913311 1 /*
jurica238814 0:dbe0ce913311 2 * Made by Jurica @ aconno
jurica238814 0:dbe0ce913311 3 * All rights reserved
jurica238814 0:dbe0ce913311 4 *
jurica238814 0:dbe0ce913311 5 */
jurica238814 0:dbe0ce913311 6
jurica238814 0:dbe0ce913311 7 #ifndef BLE_DATA_H
jurica238814 0:dbe0ce913311 8 #define BLE_DATA_H
jurica238814 0:dbe0ce913311 9
jurica238814 0:dbe0ce913311 10 typedef struct __attribute__((packed, aligned(1))) _timestamp
jurica238814 0:dbe0ce913311 11 {
jurica238814 0:dbe0ce913311 12 uint64_t time : 48;
jurica238814 0:dbe0ce913311 13 } timestampFormat;
jurica238814 0:dbe0ce913311 14
jurica238814 0:dbe0ce913311 15 typedef struct __attribute__((packed, aligned(1))) _headerFormat
jurica238814 0:dbe0ce913311 16 {
jurica238814 0:dbe0ce913311 17 uint16_t ID;
jurica238814 0:dbe0ce913311 18 } headerFormat;
jurica238814 0:dbe0ce913311 19
jurica238814 0:dbe0ce913311 20 typedef struct __attribute__((packed, aligned(1))) _diagnoseFlagsFormat
jurica238814 0:dbe0ce913311 21 {
jurica238814 0:dbe0ce913311 22 uint8_t powerSupplyConnected : 1;
jurica238814 0:dbe0ce913311 23 uint8_t valveSwitchedOn : 1;
jurica238814 0:dbe0ce913311 24 uint8_t valveSwitchedOff : 1;
jurica238814 0:dbe0ce913311 25 uint8_t shortCircuitDetected : 1;
jurica238814 0:dbe0ce913311 26 uint8_t warningLife : 1;
jurica238814 0:dbe0ce913311 27 uint8_t failureLife : 1;
jurica238814 0:dbe0ce913311 28 uint8_t internSupplyVoltageLow : 1;
jurica238814 0:dbe0ce913311 29 } diagnoseFlagsFormat;
jurica238814 0:dbe0ce913311 30
jurica238814 0:dbe0ce913311 31 typedef struct __attribute__((packed, aligned(1))) _systemState
jurica238814 0:dbe0ce913311 32 {
jurica238814 0:dbe0ce913311 33 unsigned int switchCounter;
jurica238814 0:dbe0ce913311 34 uint8_t operatingHours[3];
jurica238814 0:dbe0ce913311 35 int8_t electronicsTemp;
jurica238814 0:dbe0ce913311 36 int16_t coilTemp;
jurica238814 0:dbe0ce913311 37 __attribute__((packed)) int8_t powerSuppyVoltage;
jurica238814 0:dbe0ce913311 38 __attribute__((packed)) int8_t internPowerSupplyVoltage;
jurica238814 0:dbe0ce913311 39 __attribute__((packed)) int16_t lifeTime;
jurica238814 0:dbe0ce913311 40 __attribute__((packed)) uint16_t coilResistance;
jurica238814 0:dbe0ce913311 41 __attribute__((packed)) uint8_t magnetoCurrent;
jurica238814 0:dbe0ce913311 42 } systemStateFormat;
jurica238814 0:dbe0ce913311 43
jurica238814 0:dbe0ce913311 44 typedef struct __attribute__((packed, aligned(1))) _advertisingFormat{
jurica238814 0:dbe0ce913311 45 __attribute__((packed, aligned(1))) headerFormat header;
jurica238814 0:dbe0ce913311 46 __attribute__((packed, aligned(1))) diagnoseFlagsFormat diagnoseFlags;
jurica238814 0:dbe0ce913311 47 __attribute__((packed, aligned(1))) timestampFormat timestamp;
jurica238814 0:dbe0ce913311 48 __attribute__((packed, aligned(1))) systemStateFormat systemState;
jurica238814 0:dbe0ce913311 49 } advertisingFormat;
jurica238814 0:dbe0ce913311 50
jurica238814 0:dbe0ce913311 51 #endif // BLE_DATA_H