mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-01 04:20:33 +00:00
added cmds and events for incoming connections
This commit is contained in:
parent
9d9bbc01f5
commit
116ee617d2
12
src/hci.h
12
src/hci.h
@ -86,6 +86,18 @@
|
||||
// disconnect l2cap disconnect, @param channel(16), reason(8)
|
||||
#define L2CAP_DISCONNECT 0x21
|
||||
|
||||
// register l2cap service: @param psm(16), mtu (16)
|
||||
#define L2CAP_REGISTER_SERVICE 0x22
|
||||
|
||||
// unregister l2cap disconnect, @param psm(16)
|
||||
#define L2CAP_UNREGISTER_SERVICE 0x23
|
||||
|
||||
// accept connection @param bd_addr(48), dest cid (16)
|
||||
#define L2CAP_ACCEPT_CONNECTION 0x24
|
||||
|
||||
// decline l2cap disconnect,@param bd_addr(48), dest cid (16), reason(8)
|
||||
#define L2CAP_DECLINE_CONNECTION 0x25
|
||||
|
||||
//
|
||||
#define IS_COMMAND(packet, command) (READ_BT_16(packet,0) == command.opcode)
|
||||
|
||||
|
@ -311,5 +311,21 @@ hci_cmd_t l2cap_disconnect = {
|
||||
OPCODE(OGF_BTSTACK, L2CAP_DISCONNECT), "21"
|
||||
// @param channel(16), reason(8)
|
||||
};
|
||||
hci_cmd_t l2cap_register_service = {
|
||||
OPCODE(OGF_BTSTACK, L2CAP_REGISTER_SERVICE), "22"
|
||||
// @param psm (16), mtu (16)
|
||||
};
|
||||
hci_cmd_t l2cap_unregister_service = {
|
||||
OPCODE(OGF_BTSTACK, L2CAP_UNREGISTER_SERVICE), "2"
|
||||
// @param psm (16)
|
||||
};
|
||||
hci_cmd_t l2cap_accept_connection = {
|
||||
OPCODE(OGF_BTSTACK, L2CAP_ACCEPT_CONNECTION), "B2"
|
||||
// @param bd_addr(48), dest cid (16)
|
||||
};
|
||||
hci_cmd_t l2cap_decline_connection = {
|
||||
OPCODE(OGF_BTSTACK, L2CAP_DECLINE_CONNECTION), "B2"
|
||||
// @param bd_addr(48), dest cid (16)
|
||||
};
|
||||
|
||||
|
||||
|
@ -392,7 +392,7 @@ l2cap_service_t * l2cap_get_service(uint16_t psm){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void l2cap_register_service(connection_t *connection, uint16_t psm, uint16_t mtu){
|
||||
void l2cap_register_service_internal(connection_t *connection, uint16_t psm, uint16_t mtu){
|
||||
// check for alread registered psm // TODO: emit error event
|
||||
l2cap_service_t *service = l2cap_get_service(psm);
|
||||
if (service) return;
|
||||
@ -410,7 +410,7 @@ void l2cap_register_service(connection_t *connection, uint16_t psm, uint16_t mtu
|
||||
linked_list_add(&l2cap_services, (linked_item_t *) service);
|
||||
}
|
||||
|
||||
void l2cap_unregister_service(connection_t *connection, uint16_t psm){
|
||||
void l2cap_unregister_service_internal(connection_t *connection, uint16_t psm){
|
||||
l2cap_service_t *service = l2cap_get_service(psm);
|
||||
if (service) return;
|
||||
linked_list_remove(&l2cap_services, (linked_item_t *) service);
|
||||
|
@ -104,8 +104,8 @@ void l2cap_finialize_channel_close(l2cap_channel_t *channel);
|
||||
void l2cap_close_connection(connection_t *connection);
|
||||
|
||||
l2cap_service_t * l2cap_get_service(uint16_t psm);
|
||||
void l2cap_register_service(connection_t *connection, uint16_t psm, uint16_t);
|
||||
void l2cap_unregister_service(connection_t *connection, uint16_t psm);
|
||||
void l2cap_register_service_internal(connection_t *connection, uint16_t psm, uint16_t);
|
||||
void l2cap_unregister_service_internal(connection_t *connection, uint16_t psm);
|
||||
|
||||
void l2cap_accept_connection(bd_addr_t address, uint16_t dest_cid);
|
||||
void l2cap_decline_connection(bd_addr_t address, uint16_t dest_cid, uint8_t reason);
|
||||
|
Loading…
x
Reference in New Issue
Block a user