| 1009 | } |
| 1010 | |
| 1011 | static 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); |
| 1032 | bail: |
| 1033 | xsEndHost(gBLE->the); |
| 1034 | } |
| 1035 | |
| 1036 | static void gattcSearchResultEvent(void *the, void *refcon, uint8_t *message, uint16_t messageLength) |
| 1037 | { |
nothing calls this directly
no test coverage detected