set command type to notify

This commit is contained in:
2025-11-29 23:02:47 +00:00
parent 316fbd7c60
commit 7f8c320b5a

View File

@@ -7,7 +7,7 @@
BLEOTAClass::BLEOTAClass() BLEOTAClass::BLEOTAClass()
: pVersionNumber_(new BLECharacteristic(VERSION_NUMBER_UUID, BLECharacteristic::PROPERTY_READ)), : pVersionNumber_(new BLECharacteristic(VERSION_NUMBER_UUID, BLECharacteristic::PROPERTY_READ)),
pVersionNumberDescriptor_(new BLEDescriptor(VERSION_NUMBER_DESCRIPTOR_UUID)), pVersionNumberDescriptor_(new BLEDescriptor(VERSION_NUMBER_DESCRIPTOR_UUID)),
pOTACommand_(new BLECharacteristic(OTA_COMMAND_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE)), pOTACommand_(new BLECharacteristic(OTA_COMMAND_UUID, BLECharacteristic::PROPERTY_NOTIFY | BLECharacteristic::PROPERTY_WRITE)),
pOTACommandDescriptor_(new BLEDescriptor(OTA_COMMAND_DESCRIPTOR_UUID)), pOTACommandDescriptor_(new BLEDescriptor(OTA_COMMAND_DESCRIPTOR_UUID)),
pOTAFile_(new BLECharacteristic(OTA_FILE_UUID, BLECharacteristic::PROPERTY_WRITE)), pOTAFile_(new BLECharacteristic(OTA_FILE_UUID, BLECharacteristic::PROPERTY_WRITE)),
pOTAFileDescriptor_(new BLEDescriptor(OTA_FILE_DESCRIPTOR_UUID)) { pOTAFileDescriptor_(new BLEDescriptor(OTA_FILE_DESCRIPTOR_UUID)) {
@@ -45,6 +45,7 @@ void BLEOTAClass::setOTAcommand(otaCommand cmd) {
uint8_t commandBuffer[1] = {}; uint8_t commandBuffer[1] = {};
commandBuffer[0] = cmd; commandBuffer[0] = cmd;
pOTACommand_->setValue(commandBuffer, 1); pOTACommand_->setValue(commandBuffer, 1);
pOTACommand_->notify();
currentCommand_ = cmd; currentCommand_ = cmd;
} }