map l2cap errors to general status code

This commit is contained in:
matthias.ringwald 2009-10-21 21:12:51 +00:00
parent 6f60b3f468
commit f32b992e39
3 changed files with 20 additions and 3 deletions

View File

@ -1,7 +1,6 @@
/* new todo file for BTstack */
NEXT:
- map l2cap errors to general status code starting from 0x80
- CocoaTouch User Interface Components
- move all inquiry related code from BTstackCocoaAppDelegate into BTInquiryViewController
- figure out why stack doesn't shut Bluetooth off when in sleep for a while/after wakeup

View File

@ -81,6 +81,23 @@
// data: event(8), len(8), handle(16)
#define L2CAP_EVENT_TIMEOUT_CHECK 0x72
// last HCI error is 0x3d
// l2cap errors - enumeration by the command that created them
#define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD 0x60
#define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED 0x61
#define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST 0x62
#define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL 0x63
#define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING 0x64
#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM 0x65
#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY 0x66
#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x65
#define L2CAP_CONFIG_RESPONSE_RESULT_SUCCESSFUL 0x66
#define L2CAP_CONFIG_RESPONSE_RESULT_UNACCEPTABLE_PARAMS 0x67
#define L2CAP_CONFIG_RESPONSE_RESULT_REJECTED 0x68
#define L2CAP_CONFIG_RESPONSE_RESULT_UNKNOWN_OPTIONS 0x69
/**
* Default INQ Mode
*/

View File

@ -186,8 +186,9 @@ void l2cap_signaling_handler(l2cap_channel_t *channel, uint8_t *packet, uint16_t
l2cap_send_signaling_packet(channel->handle, CONFIGURE_REQUEST, channel->sig_id, channel->dest_cid, 0, 4, &config_options);
channel->state = L2CAP_STATE_WAIT_CONFIG_REQ_RSP;
} else {
//@TODO use separate error codes
l2cap_emit_channel_opened(channel, READ_BT_16 (packet, L2CAP_SIGNALING_DATA_OFFSET+3)); // failure, forward error code
// map l2cap connection response result to BTstack status enumeration
l2cap_emit_channel_opened(channel, L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL
+ READ_BT_16 (packet, L2CAP_SIGNALING_DATA_OFFSET+3));
}
break;
//@TODO: implement other signaling packets