arduino-blume/teng/services.hpp

27 lines
1.2 KiB
C++
Raw Normal View History

2023-06-14 19:22:11 +02:00
#pragma once
#include <ArduinoBLE.h>
const char* BASE_UUID = "00000000-9a74-4b30-9361-4a16ec09930f";
// Service 1: TENG
const char* TENG_SUUID = "00010000-9a74-4b30-9361-4a16ec09930f"; // Service UUID
const char* TENG_STATUS_CUUID = "00010001-9a74-4b30-9361-4a16ec09930f"; // Characteristic UUID
const char* TENG_COMMAND_CUUID = "00010002-9a74-4b30-9361-4a16ec09930f"; // Characteristic UUID
const char* TENG_READING_CUUID = "00010003-9a74-4b30-9361-4a16ec09930f"; // Characteristic UUID
2023-06-16 17:54:06 +02:00
const char* TENG_BASELINE_CUUID = "00010004-9a74-4b30-9361-4a16ec09930f"; // Characteristic UUID
2023-06-14 19:22:11 +02:00
BLEService tengService(TENG_SUUID);
BLEByteCharacteristic tengStatus(TENG_STATUS_CUUID, BLERead | BLENotify);
BLEByteCharacteristic tengCommand(TENG_COMMAND_CUUID, BLEWrite);
2023-06-16 17:54:06 +02:00
BLEUnsignedShortCharacteristic tengReading(TENG_READING_CUUID, BLERead | BLENotify);
BLEUnsignedShortCharacteristic tengBaseline(TENG_BASELINE_CUUID, BLERead);
2023-06-14 19:22:11 +02:00
2023-06-16 17:54:06 +02:00
enum Command : byte { NOOP = 0, MEASURE_BASELINE };
void initServices() {
tengService.addCharacteristic(tengStatus);
tengService.addCharacteristic(tengCommand);
tengService.addCharacteristic(tengReading);
tengService.addCharacteristic(tengBaseline);
}