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

Function gattcCloseEvent

modules/network/ble/esp32/modBLEClient.c:1011–1034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1009}
1010
1011static void gattcCloseEvent(void *the, void *refcon, uint8_t *message, uint16_t messageLength)
1012{
1013 struct gattc_close_evt_param *close = (struct gattc_close_evt_param *)message;
1014 uint8_t buffer[6];
1015 xsBeginHost(gBLE->the);
1016 modBLEConnection connection = modBLEConnectionFindByConnectionID(close->conn_id);
1017
1018 // ignore multiple disconnects on same connection
1019 if (!connection) goto bail;
1020
1021 esp_ble_gattc_app_unregister(GATTC_IF(connection));
1022 xsmcVars(2);
1023 xsmcSetInteger(xsVar(0), close->conn_id);
1024 addressToBuffer(&connection->address, buffer);
1025 xsmcSetArrayBuffer(xsVar(1), buffer, 6);
1026 xsmcSet(xsVar(0), xsID_address, xsVar(1));
1027 xsmcSetInteger(xsVar(1), connection->addressType);
1028 xsmcSet(xsVar(0), xsID_addressType, xsVar(1));
1029 xsCall2(connection->objConnection, xsID_callback, xsStringX("onDisconnected"), xsVar(0));
1030 xsForget(connection->objConnection);
1031 modBLEConnectionRemove(connection);
1032bail:
1033 xsEndHost(gBLE->the);
1034}
1035
1036static void gattcSearchResultEvent(void *the, void *refcon, uint8_t *message, uint16_t messageLength)
1037{

Callers

nothing calls this directly

Calls 3

modBLEConnectionRemoveFunction · 0.85
addressToBufferFunction · 0.70

Tested by

no test coverage detected