| 862 | } |
| 863 | |
| 864 | static 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); |
| 882 | bail: |
| 883 | xsEndHost(gBLE->the); |
| 884 | } |
| 885 | |
| 886 | static void deviceDiscoveryEvent(void *the, void *refcon, uint8_t *message, uint16_t messageLength) |
| 887 | { |
nothing calls this directly
no test coverage detected