mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
appease harder (sorry)
This commit is contained in:
parent
f337d7934f
commit
25ef2e4e5d
@ -260,7 +260,7 @@ void BluetoothActivity::onConnected(bool isConnected) {
|
|||||||
intoState(isConnected ? STATE_CONNECTED : STATE_WAITING);
|
intoState(isConnected ? STATE_CONNECTED : STATE_WAITING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothActivity::onRequest(lfbt_message* msg, size_t msg_len) {
|
void BluetoothActivity::onRequest(const lfbt_message* msg, size_t msg_len) {
|
||||||
if (state == STATE_ERROR) {
|
if (state == STATE_ERROR) {
|
||||||
// ignore further messages in error state
|
// ignore further messages in error state
|
||||||
return;
|
return;
|
||||||
@ -312,7 +312,7 @@ void BluetoothActivity::onRequest(lfbt_message* msg, size_t msg_len) {
|
|||||||
.txnId = txnId,
|
.txnId = txnId,
|
||||||
.body = {.serverResponse = {.status = 0}}
|
.body = {.serverResponse = {.status = 0}}
|
||||||
};
|
};
|
||||||
pResponseChar->setValue((uint8_t*)&response, 8 + sizeof(lfbt_msg_server_response));
|
pResponseChar->setValue(reinterpret_cast<uint8_t*>(&response), 8 + sizeof(lfbt_msg_server_response));
|
||||||
pResponseChar->indicate();
|
pResponseChar->indicate();
|
||||||
|
|
||||||
updateRequired = true;
|
updateRequired = true;
|
||||||
@ -329,7 +329,10 @@ void BluetoothActivity::onRequest(lfbt_message* msg, size_t msg_len) {
|
|||||||
PROTOCOL_ASSERT(state == STATE_OFFERED || state == STATE_RECEIVING, "Invalid state for client_chunk: %d", state);
|
PROTOCOL_ASSERT(state == STATE_OFFERED || state == STATE_RECEIVING, "Invalid state for client_chunk: %d", state);
|
||||||
PROTOCOL_ASSERT(msg->body.clientChunk.offset == receivedBytes, "Expected chunk %zu, got %u", receivedBytes, msg->body.clientChunk.offset);
|
PROTOCOL_ASSERT(msg->body.clientChunk.offset == receivedBytes, "Expected chunk %zu, got %u", receivedBytes, msg->body.clientChunk.offset);
|
||||||
|
|
||||||
size_t written = file.write((uint8_t*)msg->body.clientChunk.body, msg_len - 8 - sizeof(lfbt_msg_client_chunk));
|
size_t written = file.write(
|
||||||
|
reinterpret_cast<const uint8_t*>(msg->body.clientChunk.body),
|
||||||
|
msg_len - 8 - sizeof(lfbt_msg_client_chunk)
|
||||||
|
);
|
||||||
PROTOCOL_ASSERT(written > 0, "Couldn't write to file");
|
PROTOCOL_ASSERT(written > 0, "Couldn't write to file");
|
||||||
receivedBytes += msg_len - 8 - sizeof(lfbt_msg_client_chunk);
|
receivedBytes += msg_len - 8 - sizeof(lfbt_msg_client_chunk);
|
||||||
if (receivedBytes >= totalBytes) {
|
if (receivedBytes >= totalBytes) {
|
||||||
@ -346,7 +349,7 @@ void BluetoothActivity::onRequest(lfbt_message* msg, size_t msg_len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothActivity::RequestCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) {
|
void BluetoothActivity::RequestCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) {
|
||||||
lfbt_message *msg = (lfbt_message*) pCharacteristic->getValue().data();
|
const lfbt_message *msg = reinterpret_cast<const lfbt_message*>(pCharacteristic->getValue().data());
|
||||||
Serial.printf("[%lu] [BT] Received BLE message of type %u, txnId %x, length %d\n",
|
Serial.printf("[%lu] [BT] Received BLE message of type %u, txnId %x, length %d\n",
|
||||||
millis(),
|
millis(),
|
||||||
msg->type,
|
msg->type,
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class BluetoothActivity final : public Activity {
|
|||||||
void report();
|
void report();
|
||||||
|
|
||||||
void onConnected(bool isConnected);
|
void onConnected(bool isConnected);
|
||||||
void onRequest(lfbt_message *msg, size_t msg_len);
|
void onRequest(const lfbt_message *msg, size_t msg_len);
|
||||||
|
|
||||||
class ServerCallbacks : public NimBLEServerCallbacks {
|
class ServerCallbacks : public NimBLEServerCallbacks {
|
||||||
friend class BluetoothActivity;
|
friend class BluetoothActivity;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user