conform to API changes (#19654)

This commit is contained in:
Christian Baars 2023-10-03 16:20:48 +02:00 committed by GitHub
parent ee7e3cab15
commit 58d43333f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,16 +166,16 @@ class MI32AdvCallbacks: public NimBLEScanCallbacks {
static std::queue<BLEqueueBuffer_t> BLEmessageQueue; static std::queue<BLEqueueBuffer_t> BLEmessageQueue;
class MI32ServerCallbacks: public NimBLEServerCallbacks { class MI32ServerCallbacks: public NimBLEServerCallbacks {
void onConnect(NimBLEServer* pServer, ble_gap_conn_desc* desc) { void onConnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo) {
BLEqueueBuffer_t q; BLEqueueBuffer_t q;
q.length = 6; q.length = 6;
q.type = BLE_OP_ON_CONNECT; q.type = BLE_OP_ON_CONNECT;
q.buffer = new uint8_t[q.length]; q.buffer = new uint8_t[q.length];
memcpy(q.buffer,desc->peer_ota_addr.val,6); memcpy(q.buffer,connInfo.getAddress().getNative(),6); // return MAC address in the queue buffer
BLEmessageQueue.push(q); BLEmessageQueue.push(q);
MI32.infoMsg = MI32_SERV_CLIENT_CONNECTED; MI32.infoMsg = MI32_SERV_CLIENT_CONNECTED;
}; };
void onDisconnect(NimBLEServer* pServer) { void onDisconnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo, int reason) {
BLEqueueBuffer_t q; BLEqueueBuffer_t q;
q.length = 0; q.length = 0;
q.type = BLE_OP_ON_DISCONNECT; q.type = BLE_OP_ON_DISCONNECT;
@ -187,7 +187,7 @@ class MI32ServerCallbacks: public NimBLEServerCallbacks {
}; };
class MI32CharacteristicCallbacks: public NimBLECharacteristicCallbacks { class MI32CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
void onRead(NimBLECharacteristic* pCharacteristic){ void onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo){
BLEqueueBuffer_t q; BLEqueueBuffer_t q;
q.length = 0; q.length = 0;
q.type = BLE_OP_ON_READ; q.type = BLE_OP_ON_READ;
@ -196,7 +196,7 @@ class MI32CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
BLEmessageQueue.push(q); BLEmessageQueue.push(q);
}; };
void onWrite(NimBLECharacteristic* pCharacteristic) { void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) {
BLEqueueBuffer_t q; BLEqueueBuffer_t q;
q.type = BLE_OP_ON_WRITE; q.type = BLE_OP_ON_WRITE;
q.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; q.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value;
@ -220,7 +220,7 @@ class MI32CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
BLEmessageQueue.push(q); BLEmessageQueue.push(q);
}; };
void onSubscribe(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc, uint16_t subValue) { void onSubscribe(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo, uint16_t subValue) {
BLEqueueBuffer_t q; BLEqueueBuffer_t q;
q.length = 0; q.length = 0;
q.type = BLE_OP_ON_UNSUBSCRIBE + subValue; q.type = BLE_OP_ON_UNSUBSCRIBE + subValue;