MGOS_BT_GATTC_EV_DISCONNECT is called twice if connecting to offline MAC
Opened this issue · 1 comments
zdila commented
Log EH:DISCONNECT
is from MGOS_BT_GATTC_EV_DISCONNECT
handler (disconnect_ev_handler
):
[Feb 27 11:01:48.452] esp32_bt_gatts.c:860 DISCONNECT cid 0 addr 80:7d:3a:80:0c:12
[Feb 27 11:01:48.458] esp32_bt_gattc.c:153 OPEN if 3 cid 0 addr 80:7d:3a:80:0c:12 st 0x85 mtu 0
[Feb 27 11:01:48.465] master.c:57 EH:DISCONNECT
[Feb 27 11:01:48.468] master.c:57 EH:DISCONNECT
Code for connecting:
mgos_event_add_handler(MGOS_BT_GATTC_EV_CONNECT, connect_ev_handler, NULL);
mgos_event_add_handler(MGOS_BT_GATTC_EV_DISCONNECT, disconnect_ev_handler, NULL);
struct mgos_bt_addr addr = {
.addr = { 0x80, 0x7d, 0x3a, 0x80, 0x0c, 0x12 },
.type = MGOS_BT_ADDR_TYPE_PUBLIC,
};
if (!mgos_bt_gattc_connect(&addr)) {
LOG(LL_ERROR, ("Error connectiong to device."));
}
rojer commented
how about a PR? :)