So, the question I’m struggling with is how I shall design my BLE characteristics in the ESP32? Right now, I have made one characteristic for every int var. Like this:
Code: Select all
#define SERVICE_UUID_STATUS "961ba01f-f367-4546-a9fb-8a623dd30c9f"
#define CHARACTERISTIC_UUID_SOCBATT1 "961ba02f-f367-4546-a9fb-8a623dd30c9f"
#define CHARACTERISTIC_UUID_SOCBATT2 "961ba03f-f367-4546-a9fb-8a623dd30c9f"
#define CHARACTERISTIC_UUID_IBAT1 "961ba04f-f367-4546-a9fb-8a623dd30c9f"
#define CHARACTERISTIC_UUID_IBAT2 "961ba05f-f367-4546-a9fb-8a623dd30c9f"
#define CHARACTERISTIC_UUID_IGEN "961ba06f-f367-4546-a9fb-8a623dd30c9f"
#define CHARACTERISTIC_UUID_ISUN "961ba07f-f367-4546-a9fb-8a623dd30c9f"
Etc etc…
Code: Select all
outMsg.buf[0] = SOCBATT1;
outMsg.buf[1] = SOCBATT2;
outMsg.buf[2] = IBAT1;
BLECharacteristic *BATTCharacteristic = STATUSService->createCharacteristic(CHARACTERISTIC_UUID_BATTERY, BLECharacteristic::PROPERTY_READ);
BATTCharacteristic->setValue((uint8_t*)& outMsg.buf, 4);
Thanks in advance.
/Tobias