]> git.karo-electronics.de Git - oswald.git/blobdiff - metawatch/bt_l2cap.c
Maybe a little sniff mode, add ambient light adc (not working),
[oswald.git] / metawatch / bt_l2cap.c
index 68015efdae1374ecc4be6971148f9317ce69dbf8..1a7c686a2592a852672d13d1431ec7d172f6da2d 100644 (file)
@@ -224,7 +224,8 @@ void bt_l2cap_handle_connection_request(const uint16_t handle, const uint8_t ide
 {
        bt_l2cap_conn_resp_t resp;
 
-       if (_l2cap_con.cstate == BT_L2CAP_CON_IDLE) {
+       // for now we only support one connection, only on PSM 0x1001
+       if (_l2cap_con.cstate == BT_L2CAP_CON_IDLE && PSM == 0x1001) {
                bt_l2cap_conf_req_t req;
 
                _l2cap_con.cstate = BT_L2CAP_CON_CONNECTED;
@@ -258,6 +259,12 @@ void bt_l2cap_handle_connection_request(const uint16_t handle, const uint8_t ide
                req.odat = _l2cap_con.locMTU;
 
                bt_acl_send(handle, PB_FIRST_FLUSHABLE, BC_NO_BROADCAST, L2CAP_CID_SIGNALING, sizeof(bt_l2cap_conf_req_t), &req);
+
+               // max_interval Mandatory Range: 0x0006 to 0x0540
+               // min_interval Mandatory Range: 0x0006 to 0x0540
+               // sniff_attempt Mandatory Range for Controller: 1 to Tsniff/2
+               // sniff_timeout Mandatory Range for Controller: 0 to 0x0028
+               bt_hci_set_sniff_mode(handle, 0x10, 0x06, 0x20, 0x10);
        } else {
                resp.resp = CONNECTION_RESPONSE;
                resp.ident = ident;