Respond to key transmission

This commit is contained in:
Christoph Hagen 2022-01-29 18:26:24 +01:00
parent db597e2231
commit e534958300

View File

@ -208,6 +208,7 @@ SesameEvent handleReceivedRequest(const uint8_t* payload, size_t length) {
if (length != KEY_BYTE_COUNT + 2) { if (length != KEY_BYTE_COUNT + 2) {
return SesameEvent::InvalidPayloadSize; return SesameEvent::InvalidPayloadSize;
} }
Serial.println("Key received");
uint16_t keyIndex = ((uint16_t) payload[0] << 8) + payload[1]; uint16_t keyIndex = ((uint16_t) payload[0] << 8) + payload[1];
if (keyIndex >= KEY_COUNT) { if (keyIndex >= KEY_COUNT) {
return SesameEvent::InvalidKeyIndex; return SesameEvent::InvalidKeyIndex;
@ -268,7 +269,7 @@ void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
sendResponse(SesameEvent::TextReceived); sendResponse(SesameEvent::TextReceived);
break; break;
case WStype_BIN: case WStype_BIN:
handleReceivedRequest(payload, length); processReceivedBytes(payload, length);
break; break;
case WStype_ERROR: case WStype_ERROR:
case WStype_FRAGMENT_TEXT_START: case WStype_FRAGMENT_TEXT_START: