MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / disconnectEvent

Function disconnectEvent

modules/network/ble/qca4020/modBLEClient.c:864–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

862}
863
864static void disconnectEvent(void *the, void *refcon, uint8_t *message, uint16_t messageLength)
865{
866 qapi_BLE_GATT_Device_Disconnection_Data_t *result = (qapi_BLE_GATT_Device_Disconnection_Data_t*)message;
867 xsBeginHost(gBLE->the);
868 modBLEConnection connection = modBLEConnectionFindByConnectionID(result->ConnectionID);
869
870 // ignore multiple disconnects on same connection
871 if (!connection) goto bail;
872
873 xsmcVars(2);
874 xsmcSetInteger(xsVar(0), connection->id);
875 xsmcSetArrayBuffer(xsVar(1), &result->RemoteDevice, 6);
876 xsmcSet(xsVar(0), xsID_address, xsVar(1));
877 xsmcSetInteger(xsVar(1), connection->addressType);
878 xsmcSet(xsVar(0), xsID_addressType, xsVar(1));
879 xsCall2(connection->objConnection, xsID_callback, xsString("onDisconnected"), xsVar(0));
880 xsForget(connection->objConnection);
881 modBLEConnectionRemove(connection);
882bail:
883 xsEndHost(gBLE->the);
884}
885
886static void deviceDiscoveryEvent(void *the, void *refcon, uint8_t *message, uint16_t messageLength)
887{

Callers

nothing calls this directly

Calls 2

modBLEConnectionRemoveFunction · 0.85

Tested by

no test coverage detected