btstack/doc/manual/docs/appendix/events_errors.md

120 lines
4.9 KiB
Markdown
Raw Normal View History

2015-05-05 00:21:33 +02:00
2015-06-18 16:33:34 +02:00
## L2CAP Events {#sec:eventsAndErrorsAppendix}
2015-05-05 00:21:33 +02:00
L2CAP events and data packets are delivered to the packet handler
specified by *l2cap_register_service* resp.
*l2cap_create_channel*. Data packets have the
2015-05-05 00:21:33 +02:00
L2CAP_DATA_PACKET packet type. L2CAP provides the following events:
- L2CAP_EVENT_CHANNEL_OPENED - sent if channel establishment is
done. Status not equal zero indicates an error. Possible errors: out
of memory; connection terminated by local host, when the connection
to remote device fails.
- L2CAP_EVENT_CHANNEL_CLOSED - emitted when channel is closed. No
status information is provided.
- L2CAP_EVENT_INCOMING_CONNECTION - received when the connection is
requested by remote. Connection accept and decline are performed
with *l2cap_accept_connection* and *l2cap_decline_connecti-on* respectively.
2015-05-05 00:21:33 +02:00
- L2CAP_EVENT_CAN_SEND_NOW - Indicates that an L2CAP data packet could
be sent on the reported l2cap_cid. It is emitted after a call to
*l2cap_request_can_send_now*. See [Sending L2CAP Data](protocols/#sec:l2capSendProtocols)
Please note that the guarantee that a packet can be sent is only valid when the event is received.
After returning from the packet handler, BTstack might need to send itself.
2015-05-05 00:21:33 +02:00
2015-06-19 15:41:29 +02:00
Event | Event Code
2015-05-05 00:21:33 +02:00
-----------|----------------------------------------
2015-06-19 15:41:29 +02:00
L2CAP_EVENT_CHANNEL_OPENED | 0x70
L2CAP_EVENT_CHANNEL_CLOSED | 0x71
L2CAP_EVENT_INCOMING_CONNECTION | 0x72
L2CAP_EVENT_CAN_SEND_NOW | 0x78
2015-05-05 00:21:33 +02:00
2015-06-19 15:41:29 +02:00
Table: L2CAP Events. {#tbl:l2capEvents}
L2CAP event paramaters, with size in bits:
- L2CAP_EVENT_CHANNEL_OPENED:
- *event(8), len(8), status(8), address(48), handle(16), psm(16), local_cid(16), remote_cid(16), local_mtu(16), remote_mtu(16)*
- L2CAP_EVENT_CHANNEL_CLOSED:
- *event (8), len(8), channel(16)*
- L2CAP_EVENT_INCOMING_CONNECTION:
- *event(8), len(8), address(48), handle(16), psm (16), local_cid(16), remote_cid (16)*
- L2CAP_EVENT_CAN_SEND_NOW:
- *event(8), len(8), local_cid(16)
2015-06-19 15:41:29 +02:00
2015-05-05 00:21:33 +02:00
## RFCOMM Events
All RFCOMM events and data packets are currently delivered to the packet
handler specified by *rfcomm_register_packet_handler*. Data packets
have the _DATA_PACKET packet type. Here is the list of events provided
by RFCOMM:
- RFCOMM_EVENT_INCOMING_CONNECTION - received when the connection
is requested by remote. Connection accept and decline are performed
2016-01-21 12:09:19 +01:00
with *rfcomm_accept_connection* and
*rfcomm_decline_connection* respectively.
2015-05-05 00:21:33 +02:00
- RFCOMM_EVENT_CHANNEL_CLOSED - emitted when channel is closed. No
status information is provided.
- RFCOMM_EVENT_CHANNEL_OPENED - sent if channel
2015-05-05 00:21:33 +02:00
establishment is done. Status not equal zero indicates an error.
Possible errors: an L2CAP error, out of memory.
- RFCOMM_EVENT_CAN_SEND_NOW - Indicates that an RFCOMM data packet could
be sent on the reported rfcomm_cid. It is emitted after a call to
*rfcomm_request_can_send_now*. See [Sending RFCOMM Data](protocols/#sec:rfcommSendProtocols)
Please note that the guarantee that a packet can be sent is only valid when the event is received.
After returning from the packet handler, BTstack might need to send itself.
2015-05-05 00:21:33 +02:00
2015-06-19 15:41:29 +02:00
Event | Event Code
-----------|-----------------------------
RFCOMM_EVENT_CHANNEL_OPENED | 0x80
2015-06-19 15:41:29 +02:00
RFCOMM_EVENT_CHANNEL_CLOSED | 0x81
RFCOMM_EVENT_INCOMING_CONNECTION | 0x82
RFCOMM_EVENT_CAN_SEND_NOW | 0x89
2015-05-05 00:21:33 +02:00
2015-06-19 15:41:29 +02:00
Table: RFCOMM Events. {#tbl:rfcommEvents}
RFCOMM event paramaters, with size in bits:
- RFCOMM_EVENT_CHANNEL_OPENED:
2015-06-19 15:41:29 +02:00
- *event(8), len(8), status(8), address(48), handle(16), server_channel(8), rfcomm_cid(16), max_frame_size(16)*
- RFCOMM_EVENT_CHANNEL_CLOSED:
- *event(8), len(8), rfcomm_cid(16)*
- RFCOMM_EVENT_INCOMING_CONNECTION:
- *event(8), len(8), address(48), channel (8), rfcomm_cid(16)*
- RFCOMM_EVENT_CAN_SEND_NOW:
- *event(8), len(8), rfcomm_cid(16)
2015-05-05 00:21:33 +02:00
## Errors {#sec:errorsAppendix}
2015-05-05 00:21:33 +02:00
2015-06-19 15:41:29 +02:00
2015-05-05 00:21:33 +02:00
Error | Error Code
------------------------------------------------------------------------|-------------------
BTSTACK_MEMORY_ALLOC_FAILED | 0x56
BTSTACK_ACL_BUFFERS_FULL | 0x57
L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD | 0x60
L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED | 0x61
L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST | 0x62
L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL | 0x63
L2CAP_CONNECTION_RESPONSE_RESULT_PENDING | 0x64
L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM | 0x65
L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY | 0x66
L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES | 0x65
L2CAP_CONFIG_RESPONSE_RESULT_SUCCESSFUL | 0x66
L2CAP_CONFIG_RESPONSE_RESULT_UNACCEPTABLE_PARAMS | 0x67
L2CAP_CONFIG_RESPONSE_RESULT_REJECTED | 0x68
L2CAP_CONFIG_RESPONSE_RESULT_UNKNOWN_OPTIONS | 0x69
L2CAP_SERVICE_ALREADY_REGISTERED | 0x6a
RFCOMM_MULTIPLEXER_STOPPED | 0x70
RFCOMM_NO_OUTGOING_CREDITS | 0x72
SDP_HANDLE_ALREADY_REGISTERED | 0x80
2015-06-19 15:41:29 +02:00
Table: Errors. {#tbl:errors}
2015-05-05 00:21:33 +02:00