mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-30 15:32:41 +00:00
added RFCOMM_CHANNEL_SEND_SABM_W4_UA
This commit is contained in:
parent
edaa805914
commit
8158c42197
@ -260,11 +260,11 @@ int l2cap_send_internal(uint16_t local_cid, uint8_t *data, uint16_t len){
|
|||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: L2CAP_RUN
|
||||||
// process outstanding signaling tasks
|
// process outstanding signaling tasks
|
||||||
void l2cap_run(void){
|
void l2cap_run(void){
|
||||||
|
|
||||||
|
|
||||||
// check pending signaling responses
|
// check pending signaling responses
|
||||||
while (signaling_responses_pending){
|
while (signaling_responses_pending){
|
||||||
|
|
||||||
|
34
src/rfcomm.c
34
src/rfcomm.c
@ -102,6 +102,7 @@ typedef enum {
|
|||||||
RFCOMM_CHANNEL_W4_PN_AFTER_OPEN,
|
RFCOMM_CHANNEL_W4_PN_AFTER_OPEN,
|
||||||
RFCOMM_CHANNEL_W4_PN_RSP,
|
RFCOMM_CHANNEL_W4_PN_RSP,
|
||||||
RFCOMM_CHANNEL_W4_SABM_OR_PN_CMD,
|
RFCOMM_CHANNEL_W4_SABM_OR_PN_CMD,
|
||||||
|
RFCOMM_CHANNEL_SEND_SABM_W4_UA,
|
||||||
RFCOMM_CHANNEL_W4_UA,
|
RFCOMM_CHANNEL_W4_UA,
|
||||||
RFCOMM_CHANNEL_W4_MSC_CMD_OR_MSC_RSP, // outgoing, sent MSC_CMD
|
RFCOMM_CHANNEL_W4_MSC_CMD_OR_MSC_RSP, // outgoing, sent MSC_CMD
|
||||||
RFCOMM_CHANNEL_W4_MSC_CMD,
|
RFCOMM_CHANNEL_W4_MSC_CMD,
|
||||||
@ -1119,9 +1120,7 @@ void rfcomm_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
|||||||
log_dbg("UIH Parameter Negotiation Response max frame %u, credits %u\n",
|
log_dbg("UIH Parameter Negotiation Response max frame %u, credits %u\n",
|
||||||
max_frame_size, rfChannel->credits_outgoing);
|
max_frame_size, rfChannel->credits_outgoing);
|
||||||
|
|
||||||
log_dbg("Sending SABM #%u\n", message_dlci);
|
rfChannel->state = RFCOMM_CHANNEL_SEND_SABM_W4_UA;
|
||||||
rfcomm_send_sabm(multiplexer, message_dlci);
|
|
||||||
rfChannel->state = RFCOMM_CHANNEL_W4_UA;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1288,15 +1287,28 @@ void rfcomm_run(void){
|
|||||||
rfcomm_channel_t * channel = ((rfcomm_channel_t *) it);
|
rfcomm_channel_t * channel = ((rfcomm_channel_t *) it);
|
||||||
|
|
||||||
if (!l2cap_can_send_packet_now(channel->multiplexer->l2cap_cid)) continue;
|
if (!l2cap_can_send_packet_now(channel->multiplexer->l2cap_cid)) continue;
|
||||||
|
|
||||||
// sends UIH PN CMD to first channel with RFCOMM_CHANNEL_W4_MULTIPLEXER
|
switch (channel->state){
|
||||||
// this can then called after connection open/fail to handle all outgoing requests
|
|
||||||
|
case RFCOMM_CHANNEL_W4_MULTIPLEXER:
|
||||||
|
// sends UIH PN CMD to first channel with RFCOMM_CHANNEL_W4_MULTIPLEXER
|
||||||
|
// this can then called after connection open/fail to handle all outgoing requests
|
||||||
|
if (channel->outgoing && channel->multiplexer->state == RFCOMM_MULTIPLEXER_OPEN) {
|
||||||
|
log_dbg("Sending UIH Parameter Negotiation Command for #%u\n", channel->dlci );
|
||||||
|
rfcomm_send_uih_pn_command(channel->multiplexer, channel->dlci, channel->max_frame_size);
|
||||||
|
channel->state = RFCOMM_CHANNEL_W4_PN_RSP;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if (channel->outgoing && channel->state == RFCOMM_CHANNEL_W4_MULTIPLEXER && channel->multiplexer->state == RFCOMM_MULTIPLEXER_OPEN) {
|
case RFCOMM_CHANNEL_SEND_SABM_W4_UA:
|
||||||
int err = rfcomm_send_uih_pn_command(channel->multiplexer, channel->dlci, channel->max_frame_size);
|
log_dbg("Sending SABM #%u\n", channel->dlci);
|
||||||
if (err) return;
|
rfcomm_send_sabm(channel->multiplexer, channel->dlci);
|
||||||
log_dbg("-> Sending UIH Parameter Negotiation Command for #%u\n", channel->dlci );
|
channel->state = RFCOMM_CHANNEL_W4_UA;
|
||||||
channel->state = RFCOMM_CHANNEL_W4_PN_RSP;
|
continue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user