daemon: add l2cap_request_can_send_now_cmd and rfcomm_request_can_send_now_cmd

This commit is contained in:
Matthias Ringwald 2022-03-28 14:47:28 +02:00
parent f2098d2205
commit 6e7533547b
4 changed files with 41 additions and 11 deletions

View File

@ -1008,6 +1008,10 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
cid = little_endian_read_16(packet, 3);
l2cap_decline_connection(cid);
break;
case L2CAP_REQUEST_CAN_SEND_NOW:
cid = little_endian_read_16(packet, 3);
l2cap_request_can_send_now_event(cid);
break;
case RFCOMM_CREATE_CHANNEL:
reverse_bd_addr(&packet[3], addr);
rfcomm_channel = packet[9];
@ -1078,6 +1082,10 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
socket_connection_send_packet(connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
break;
}
case RFCOMM_REQUEST_CAN_SEND_NOW:
cid = little_endian_read_16(packet, 3);
rfcomm_request_can_send_now_event(cid);
break;
case SDP_REGISTER_SERVICE_RECORD:
log_info("SDP_REGISTER_SERVICE_RECORD size %u\n", size);
service_record_handle = daemon_sdp_create_and_register_service(&packet[3]);

View File

@ -152,6 +152,12 @@ const hci_cmd_t l2cap_decline_connection_cmd = {
DAEMON_OPCODE_L2CAP_DECLINE_CONNECTION, "21"
};
/**
* @param l2cap_cid
*/
const hci_cmd_t l2cap_request_can_send_now_cmd = {
DAEMON_OPCODE_L2CAP_REQUEST_CAN_SEND_NOW, "2"
};
/**
* @param service_record
@ -266,6 +272,13 @@ const hci_cmd_t rfcomm_persistent_channel_for_service_cmd = {
DAEMON_OPCODE_RFCOMM_PERSISTENT_CHANNEL_FOR_SERVICE, "N"
};
/**
* @param rfcomm_cid
*/
const hci_cmd_t rfcomm_request_can_send_now_cmd = {
DAEMON_OPCODE_RFCOMM_REQUEST_CAN_SEND_NOW, "2"
};
/**
* @param handle
*/

View File

@ -70,6 +70,7 @@ typedef enum {
DAEMON_OPCODE_L2CAP_UNREGISTER_SERVICE = DAEMON_OPCODE(L2CAP_UNREGISTER_SERVICE),
DAEMON_OPCODE_L2CAP_ACCEPT_CONNECTION = DAEMON_OPCODE(L2CAP_ACCEPT_CONNECTION),
DAEMON_OPCODE_L2CAP_DECLINE_CONNECTION = DAEMON_OPCODE(L2CAP_DECLINE_CONNECTION),
DAEMON_OPCODE_L2CAP_REQUEST_CAN_SEND_NOW = DAEMON_OPCODE(L2CAP_REQUEST_CAN_SEND_NOW),
DAEMON_OPCODE_SDP_REGISTER_SERVICE_RECORD = DAEMON_OPCODE(SDP_REGISTER_SERVICE_RECORD),
DAEMON_OPCODE_SDP_UNREGISTER_SERVICE_RECORD = DAEMON_OPCODE(SDP_UNREGISTER_SERVICE_RECORD),
DAEMON_OPCODE_SDP_CLIENT_QUERY_RFCOMM_SERVICES = DAEMON_OPCODE(SDP_CLIENT_QUERY_RFCOMM_SERVICES),
@ -84,6 +85,7 @@ typedef enum {
DAEMON_OPCODE_RFCOMM_ACCEPT_CONNECTION = DAEMON_OPCODE(RFCOMM_ACCEPT_CONNECTION),
DAEMON_OPCODE_RFCOMM_DECLINE_CONNECTION = DAEMON_OPCODE(RFCOMM_DECLINE_CONNECTION),
DAEMON_OPCODE_RFCOMM_PERSISTENT_CHANNEL_FOR_SERVICE = DAEMON_OPCODE(RFCOMM_PERSISTENT_CHANNEL),
DAEMON_OPCODE_RFCOMM_REQUEST_CAN_SEND_NOW = DAEMON_OPCODE(RFCOMM_REQUEST_CAN_SEND_NOW),
DAEMON_OPCODE_GAP_DISCONNECT = DAEMON_OPCODE(GAP_DISCONNECT),
DAEMON_OPCODE_GAP_INQUIRY_START = DAEMON_OPCODE(GAP_INQUIRY_START),
DAEMON_OPCODE_GAP_INQUIRY_STOP = DAEMON_OPCODE(GAP_INQUIRY_STOP),
@ -140,6 +142,7 @@ extern const hci_cmd_t l2cap_decline_connection_cmd;
extern const hci_cmd_t l2cap_disconnect_cmd;
extern const hci_cmd_t l2cap_register_service_cmd;
extern const hci_cmd_t l2cap_unregister_service_cmd;
extern const hci_cmd_t l2cap_request_can_send_now_cmd;
extern const hci_cmd_t sdp_register_service_record_cmd;
extern const hci_cmd_t sdp_unregister_service_record_cmd;
@ -165,6 +168,7 @@ extern const hci_cmd_t rfcomm_unregister_service_cmd;
// request persisten rfcomm channel for service name: serive name (char*)
extern const hci_cmd_t rfcomm_persistent_channel_for_service_cmd;
extern const hci_cmd_t rfcomm_grants_credits_cmd;
extern const hci_cmd_t rfcomm_request_can_send_now_cmd;
extern const hci_cmd_t gap_delete_all_link_keys_cmd;
extern const hci_cmd_t gap_disconnect_cmd;

View File

@ -183,6 +183,9 @@ typedef uint8_t sm_key_t[16];
// create l2cap channel: param bd_addr(48), psm (16), mtu (16)
#define L2CAP_CREATE_CHANNEL_MTU 0x26u
// request can send now event: l2cap_cid
#define L2CAP_REQUEST_CAN_SEND_NOW 0x27u
// register SDP Service Record: service record (size)
#define SDP_REGISTER_SERVICE_RECORD 0x30u
@ -196,17 +199,19 @@ typedef uint8_t sm_key_t[16];
#define SDP_CLIENT_QUERY_SERVICES 0x33u
// RFCOMM "HCI" Commands
#define RFCOMM_CREATE_CHANNEL 0x40u
#define RFCOMM_DISCONNECT 0x41u
#define RFCOMM_REGISTER_SERVICE 0x42u
#define RFCOMM_UNREGISTER_SERVICE 0x43u
#define RFCOMM_ACCEPT_CONNECTION 0x44u
#define RFCOMM_DECLINE_CONNECTION 0x45u
#define RFCOMM_PERSISTENT_CHANNEL 0x46u
#define RFCOMM_CREATE_CHANNEL_WITH_CREDITS 0x47u
#define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48u
#define RFCOMM_GRANT_CREDITS 0x49u
#define RFCOMM_CREATE_CHANNEL 0x40u
#define RFCOMM_DISCONNECT 0x41u
#define RFCOMM_REGISTER_SERVICE 0x42u
#define RFCOMM_UNREGISTER_SERVICE 0x43u
#define RFCOMM_ACCEPT_CONNECTION 0x44u
#define RFCOMM_DECLINE_CONNECTION 0x45u
#define RFCOMM_CREATE_CHANNEL_WITH_CREDITS 0x47u
#define RFCOMM_PERSISTENT_CHANNEL 0x46u
#define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48u
#define RFCOMM_GRANT_CREDITS 0x49u
// request can send now event: rfcomm_cid
#define RFCOMM_REQUEST_CAN_SEND_NOW 0x4Au
// GAP Classic 0x50u
#define GAP_DISCONNECT 0x50u
#define GAP_INQUIRY_START 0x51u