1 /* 2 * Copyright (C) 2016 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the copyright holders nor the names of 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 4. Any redistribution, use, or modification is done solely for 17 * personal benefit and not for any commercial purpose or for 18 * monetary gain. 19 * 20 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 24 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38 #define BTSTACK_FILE__ "avdtp_initiator.c" 39 40 #include <stdint.h> 41 #include <string.h> 42 43 #include "bluetooth_psm.h" 44 #include "bluetooth_sdp.h" 45 #include "btstack_debug.h" 46 #include "btstack_event.h" 47 #include "l2cap.h" 48 #include "classic/avdtp.h" 49 #include "classic/avdtp_util.h" 50 #include "classic/avdtp_initiator.h" 51 52 static int avdtp_initiator_send_signaling_cmd(uint16_t cid, avdtp_signal_identifier_t identifier, uint8_t transaction_label){ 53 uint8_t command[2]; 54 command[0] = avdtp_header(transaction_label, AVDTP_SINGLE_PACKET, AVDTP_CMD_MSG); 55 command[1] = (uint8_t)identifier; 56 return l2cap_send(cid, command, sizeof(command)); 57 } 58 59 static int avdtp_initiator_send_signaling_cmd_with_seid(uint16_t cid, avdtp_signal_identifier_t identifier, uint8_t transaction_label, uint8_t sep_id){ 60 uint8_t command[3]; 61 command[0] = avdtp_header(transaction_label, AVDTP_SINGLE_PACKET, AVDTP_CMD_MSG); 62 command[1] = (uint8_t)identifier; 63 command[2] = sep_id << 2; 64 return l2cap_send(cid, command, sizeof(command)); 65 } 66 67 static int avdtp_initiator_send_signaling_cmd_delay_report(uint16_t cid, uint8_t transaction_label, uint8_t sep_id, uint16_t delay_ms){ 68 uint8_t command[5]; 69 command[0] = avdtp_header(transaction_label, AVDTP_SINGLE_PACKET, AVDTP_CMD_MSG); 70 command[1] = AVDTP_SI_DELAYREPORT; 71 command[2] = sep_id << 2; 72 big_endian_store_16(command, 3, delay_ms); 73 return l2cap_send(cid, command, sizeof(command)); 74 } 75 76 void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_t *packet, uint16_t size, int offset, avdtp_context_t * context){ 77 // int status = 0; 78 avdtp_stream_endpoint_t * stream_endpoint = NULL; 79 80 avdtp_sep_t sep; 81 if (connection->initiator_connection_state == AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_ANSWER) { 82 connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE; 83 } else { 84 stream_endpoint = avdtp_stream_endpoint_associated_with_acp_seid(connection->remote_seid, context); 85 if (!stream_endpoint){ 86 stream_endpoint = avdtp_stream_endpoint_with_seid(connection->local_seid, context); 87 } 88 if (!stream_endpoint) return; 89 sep.seid = connection->remote_seid; 90 91 if (stream_endpoint->initiator_config_state != AVDTP_INITIATOR_W4_ANSWER) return; 92 stream_endpoint->initiator_config_state = AVDTP_INITIATOR_STREAM_CONFIG_IDLE; 93 } 94 95 switch (connection->signaling_packet.message_type){ 96 case AVDTP_RESPONSE_ACCEPT_MSG: 97 switch (connection->signaling_packet.signal_identifier){ 98 case AVDTP_SI_DISCOVER:{ 99 if (connection->signaling_packet.transaction_label != connection->initiator_transaction_label){ 100 log_info(" unexpected transaction label, got %d, expected %d", connection->signaling_packet.transaction_label, connection->initiator_transaction_label); 101 // status = BAD_HEADER_FORMAT; 102 break; 103 } 104 105 if (size == 3){ 106 log_info(" ERROR code %02x", packet[offset]); 107 break; 108 } 109 110 int i; 111 for (i = offset; i < size; i += 2){ 112 sep.seid = packet[i] >> 2; 113 offset++; 114 if (sep.seid < 0x01 || sep.seid > 0x3E){ 115 log_info(" invalid sep id"); 116 // status = BAD_ACP_SEID; 117 break; 118 } 119 sep.in_use = (packet[i] >> 1) & 0x01; 120 sep.media_type = (avdtp_media_type_t)(packet[i+1] >> 4); 121 sep.type = (avdtp_sep_type_t)((packet[i+1] >> 3) & 0x01); 122 avdtp_signaling_emit_sep(context->avdtp_callback, connection->avdtp_cid, sep); 123 } 124 avdtp_signaling_emit_sep_done(context->avdtp_callback, connection->avdtp_cid); 125 break; 126 } 127 128 case AVDTP_SI_GET_CAPABILITIES: 129 case AVDTP_SI_GET_ALL_CAPABILITIES: 130 sep.registered_service_categories = avdtp_unpack_service_capabilities(connection, &sep.capabilities, packet+offset, size-offset); 131 avdtp_emit_capabilities(context->avdtp_callback, connection->avdtp_cid, connection->local_seid, connection->remote_seid, &sep.capabilities, sep.registered_service_categories); 132 break; 133 case AVDTP_SI_DELAYREPORT: 134 avdtp_signaling_emit_delay(context->avdtp_callback, connection->avdtp_cid, connection->local_seid, little_endian_read_16(packet, offset)); 135 break; 136 case AVDTP_SI_GET_CONFIGURATION: 137 // sep.configured_service_categories = avdtp_unpack_service_capabilities(connection, &sep.configuration, packet+offset, size-offset); 138 // if (get_bit16(sep.configured_service_categories, AVDTP_MEDIA_CODEC)){ 139 // switch (sep.configuration.media_codec.media_codec_type){ 140 // case AVDTP_CODEC_SBC: 141 // avdtp_signaling_emit_media_codec_sbc_configuration(context->avdtp_callback, connection->avdtp_cid, connection->local_seid, connection->remote_seid, 142 // sep.configuration.media_codec.media_type, sep.configuration.media_codec.media_codec_information); 143 // break; 144 // default: 145 // avdtp_signaling_emit_media_codec_other_configuration(context->avdtp_callback, connection->avdtp_cid, connection->local_seid, connection->remote_seid, sep.configuration.media_codec); 146 // break; 147 // } 148 // } 149 break; 150 151 case AVDTP_SI_RECONFIGURE: 152 if (!stream_endpoint){ 153 log_error("AVDTP_SI_RECONFIGURE: stream endpoint is null"); 154 break; 155 } 156 // copy sbc media codec info 157 stream_endpoint->remote_sep.configured_service_categories |= stream_endpoint->remote_configuration_bitmap; 158 stream_endpoint->remote_sep.configuration = stream_endpoint->remote_configuration; 159 memcpy(stream_endpoint->media_codec_sbc_info, stream_endpoint->remote_configuration.media_codec.media_codec_information, 4); 160 stream_endpoint->remote_sep.configuration.media_codec.media_codec_information = stream_endpoint->media_codec_sbc_info; 161 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_OPENED; 162 break; 163 164 case AVDTP_SI_SET_CONFIGURATION:{ 165 avdtp_configuration_timer_stop(connection); 166 if (!stream_endpoint){ 167 log_error("AVDTP_SI_SET_CONFIGURATION: stream endpoint is null"); 168 break; 169 } 170 sep.configured_service_categories = stream_endpoint->remote_configuration_bitmap; 171 sep.configuration = stream_endpoint->remote_configuration; 172 sep.in_use = 1; 173 174 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_CONFIGURED; 175 stream_endpoint->remote_sep = sep; 176 stream_endpoint->connection = connection; 177 178 log_info("INT: configured remote seid %d, to %p", stream_endpoint->remote_sep.seid, stream_endpoint); 179 180 switch (stream_endpoint->media_codec_type){ 181 case AVDTP_CODEC_SBC: 182 avdtp_signaling_emit_media_codec_sbc_configuration(context->avdtp_callback, connection->avdtp_cid, connection->local_seid, connection->remote_seid, 183 stream_endpoint->media_type, stream_endpoint->media_codec_sbc_info); 184 break; 185 default: 186 // TODO: we don\t have codec info to emit config 187 avdtp_signaling_emit_media_codec_other_configuration(context->avdtp_callback, connection->avdtp_cid, connection->local_seid, connection->remote_seid, sep.configuration.media_codec); 188 break; 189 } 190 break; 191 } 192 193 case AVDTP_SI_OPEN: 194 if (!stream_endpoint){ 195 log_error("AVDTP_SI_OPEN: stream endpoint is null"); 196 break; 197 } 198 if (stream_endpoint->state != AVDTP_STREAM_ENDPOINT_W2_REQUEST_OPEN_STREAM) { 199 log_error("AVDTP_SI_OPEN in wrong stream endpoint state"); 200 return; 201 } 202 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_W4_L2CAP_FOR_MEDIA_CONNECTED; 203 connection->local_seid = stream_endpoint->sep.seid; 204 l2cap_create_channel(context->packet_handler, connection->remote_addr, BLUETOOTH_PSM_AVDTP, 0xffff, NULL); 205 return; 206 case AVDTP_SI_START: 207 if (!stream_endpoint){ 208 log_error("AVDTP_SI_START: stream endpoint is null"); 209 break; 210 } 211 if (stream_endpoint->state != AVDTP_STREAM_ENDPOINT_OPENED) { 212 log_error("AVDTP_SI_START in wrong stream endpoint state"); 213 return; 214 } 215 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_STREAMING; 216 break; 217 case AVDTP_SI_SUSPEND: 218 if (!stream_endpoint){ 219 log_error("AVDTP_SI_SUSPEND: stream endpoint is null"); 220 break; 221 } 222 if (stream_endpoint->state != AVDTP_STREAM_ENDPOINT_STREAMING) { 223 log_error("AVDTP_SI_SUSPEND in wrong stream endpoint state"); 224 return; 225 } 226 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_OPENED; 227 break; 228 case AVDTP_SI_CLOSE: 229 if (!stream_endpoint){ 230 log_error("AVDTP_SI_CLOSE: stream endpoint is null"); 231 break; 232 } 233 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_CLOSING; 234 break; 235 case AVDTP_SI_ABORT: 236 if (!stream_endpoint){ 237 log_error("AVDTP_SI_ABORT: stream endpoint is null"); 238 break; 239 } 240 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_ABORTING; 241 break; 242 default: 243 log_info(" AVDTP_RESPONSE_ACCEPT_MSG, signal %d not implemented", connection->signaling_packet.signal_identifier); 244 break; 245 } 246 avdtp_signaling_emit_accept(context->avdtp_callback, connection->avdtp_cid, 0, connection->signaling_packet.signal_identifier); 247 connection->initiator_transaction_label++; 248 break; 249 case AVDTP_RESPONSE_REJECT_MSG: 250 switch (connection->signaling_packet.signal_identifier){ 251 case AVDTP_SI_SET_CONFIGURATION: 252 connection->is_initiator = 0; 253 log_info("Received reject for set configuration, role changed from initiator to acceptor. Start timer."); 254 avdtp_configuration_timer_start(connection); 255 break; 256 default: 257 break; 258 } 259 log_info(" AVDTP_RESPONSE_REJECT_MSG signal %d", connection->signaling_packet.signal_identifier); 260 avdtp_signaling_emit_reject(context->avdtp_callback, connection->avdtp_cid, connection->local_seid, connection->signaling_packet.signal_identifier); 261 return; 262 case AVDTP_GENERAL_REJECT_MSG: 263 log_info(" AVDTP_GENERAL_REJECT_MSG signal %d", connection->signaling_packet.signal_identifier); 264 avdtp_signaling_emit_general_reject(context->avdtp_callback, connection->avdtp_cid, connection->local_seid, connection->signaling_packet.signal_identifier); 265 return; 266 default: 267 break; 268 } 269 } 270 271 void avdtp_initiator_stream_config_subsm_run(avdtp_connection_t * connection, avdtp_context_t * context){ 272 int sent = 1; 273 switch (connection->initiator_connection_state){ 274 case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_DISCOVER_SEPS: 275 log_info("INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_DISCOVER_SEPS"); 276 connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_ANSWER; 277 avdtp_initiator_send_signaling_cmd(connection->l2cap_signaling_cid, AVDTP_SI_DISCOVER, connection->initiator_transaction_label); 278 break; 279 case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CAPABILITIES: 280 log_info("INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CAPABILITIES"); 281 connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_ANSWER; 282 avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_GET_CAPABILITIES, connection->initiator_transaction_label, connection->remote_seid); 283 break; 284 case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_ALL_CAPABILITIES: 285 log_info("INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_ALL_CAPABILITIES"); 286 connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_ANSWER; 287 avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_GET_ALL_CAPABILITIES, connection->initiator_transaction_label, connection->remote_seid); 288 break; 289 case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CONFIGURATION: 290 log_info("INT: AVDTP_INITIATOR_W4_GET_CONFIGURATION"); 291 connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_ANSWER; 292 avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_GET_CONFIGURATION, connection->initiator_transaction_label, connection->remote_seid); 293 break; 294 case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SEND_DELAY_REPORT: 295 log_info("INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_DELAY_REPORT"); 296 connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_ANSWER; 297 avdtp_initiator_send_signaling_cmd_delay_report(connection->l2cap_signaling_cid, connection->initiator_transaction_label, 298 connection->remote_seid, connection->delay_ms); 299 break; 300 default: 301 sent = 0; 302 break; 303 } 304 305 if (sent) return; 306 sent = 1; 307 308 avdtp_stream_endpoint_t * stream_endpoint = NULL; 309 310 stream_endpoint = avdtp_stream_endpoint_associated_with_acp_seid(connection->remote_seid, context); 311 if (!stream_endpoint){ 312 stream_endpoint = avdtp_stream_endpoint_with_seid(connection->local_seid, context); 313 } 314 if (!stream_endpoint) return; 315 316 avdtp_initiator_stream_endpoint_state_t stream_endpoint_state = stream_endpoint->initiator_config_state; 317 stream_endpoint->initiator_config_state = AVDTP_INITIATOR_W4_ANSWER; 318 319 if (stream_endpoint->start_stream){ 320 stream_endpoint->start_stream = 0; 321 if (stream_endpoint->state == AVDTP_STREAM_ENDPOINT_OPENED){ 322 connection->local_seid = stream_endpoint->sep.seid; 323 connection->remote_seid = stream_endpoint->remote_sep.seid; 324 avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_START, connection->initiator_transaction_label++, connection->remote_seid); 325 return; 326 } 327 return; 328 } 329 330 if (stream_endpoint->stop_stream){ 331 stream_endpoint->stop_stream = 0; 332 if (stream_endpoint->state >= AVDTP_STREAM_ENDPOINT_OPENED){ 333 connection->local_seid = stream_endpoint->sep.seid; 334 connection->remote_seid = stream_endpoint->remote_sep.seid; 335 avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_CLOSE, connection->initiator_transaction_label++, connection->remote_seid); 336 return; 337 } 338 } 339 340 if (stream_endpoint->abort_stream){ 341 stream_endpoint->abort_stream = 0; 342 switch (stream_endpoint->state){ 343 case AVDTP_STREAM_ENDPOINT_CONFIGURED: 344 case AVDTP_STREAM_ENDPOINT_CLOSING: 345 case AVDTP_STREAM_ENDPOINT_OPENED: 346 case AVDTP_STREAM_ENDPOINT_STREAMING: 347 connection->local_seid = stream_endpoint->sep.seid; 348 connection->remote_seid = stream_endpoint->remote_sep.seid; 349 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_ABORTING; 350 avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_ABORT, connection->initiator_transaction_label++, connection->remote_seid); 351 return; 352 default: 353 break; 354 } 355 } 356 357 if (stream_endpoint->suspend_stream){ 358 stream_endpoint->suspend_stream = 0; 359 if (stream_endpoint->state == AVDTP_STREAM_ENDPOINT_STREAMING){ 360 connection->local_seid = stream_endpoint->sep.seid; 361 connection->remote_seid = stream_endpoint->remote_sep.seid; 362 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_STREAMING; 363 avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_SUSPEND, connection->initiator_transaction_label, connection->remote_seid); 364 return; 365 } 366 } 367 368 if (stream_endpoint->send_stream){ 369 stream_endpoint->send_stream = 0; 370 if (stream_endpoint->state == AVDTP_STREAM_ENDPOINT_STREAMING){ 371 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_STREAMING; 372 avdtp_streaming_emit_can_send_media_packet_now(context->avdtp_callback, stream_endpoint->l2cap_media_cid, stream_endpoint->sep.seid, stream_endpoint->sequence_number); 373 return; 374 } 375 } 376 377 switch (stream_endpoint_state){ 378 case AVDTP_INITIATOR_W2_SET_CONFIGURATION: 379 case AVDTP_INITIATOR_W2_RECONFIGURE_STREAM_WITH_SEID:{ 380 if (stream_endpoint_state == AVDTP_INITIATOR_W2_SET_CONFIGURATION && !connection->is_initiator){ 381 log_info("initiator SM stop sending SET_CONFIGURATION cmd: current role is acceptor"); 382 connection->is_configuration_initiated_locally = 0; 383 break; 384 } 385 log_info("initiator SM prepare SET_CONFIGURATION cmd"); 386 connection->is_configuration_initiated_locally = 1; 387 log_info("INT: AVDTP_INITIATOR_W2_(RE)CONFIGURATION bitmap, int seid %d, acp seid %d", connection->local_seid, connection->remote_seid); 388 // log_info_hexdump( connection->remote_capabilities.media_codec.media_codec_information, connection->remote_capabilities.media_codec.media_codec_information_len); 389 connection->signaling_packet.acp_seid = connection->remote_seid; 390 connection->signaling_packet.int_seid = connection->local_seid; 391 392 connection->signaling_packet.signal_identifier = AVDTP_SI_SET_CONFIGURATION; 393 stream_endpoint->state = AVDTP_STREAM_ENDPOINT_CONFIGURATION_SUBSTATEMACHINE; 394 if (stream_endpoint_state == AVDTP_INITIATOR_W2_RECONFIGURE_STREAM_WITH_SEID){ 395 connection->signaling_packet.signal_identifier = AVDTP_SI_RECONFIGURE; 396 } 397 398 avdtp_prepare_capabilities(&connection->signaling_packet, connection->initiator_transaction_label, stream_endpoint->remote_configuration_bitmap, stream_endpoint->remote_configuration, connection->signaling_packet.signal_identifier); 399 l2cap_reserve_packet_buffer(); 400 uint8_t * out_buffer = l2cap_get_outgoing_buffer(); 401 uint16_t pos = avdtp_signaling_create_fragment(connection->l2cap_signaling_cid, &connection->signaling_packet, out_buffer); 402 if (connection->signaling_packet.packet_type != AVDTP_SINGLE_PACKET && connection->signaling_packet.packet_type != AVDTP_END_PACKET){ 403 stream_endpoint->initiator_config_state = AVDTP_INITIATOR_FRAGMENTATED_COMMAND; 404 log_info("INT: fragmented"); 405 } 406 l2cap_send_prepared(connection->l2cap_signaling_cid, pos); 407 break; 408 } 409 case AVDTP_INITIATOR_FRAGMENTATED_COMMAND:{ 410 l2cap_reserve_packet_buffer(); 411 uint8_t * out_buffer = l2cap_get_outgoing_buffer(); 412 uint16_t pos = avdtp_signaling_create_fragment(connection->l2cap_signaling_cid, &connection->signaling_packet, out_buffer); 413 if (connection->signaling_packet.packet_type != AVDTP_SINGLE_PACKET && connection->signaling_packet.packet_type != AVDTP_END_PACKET){ 414 stream_endpoint->initiator_config_state = AVDTP_INITIATOR_FRAGMENTATED_COMMAND; 415 log_info("INT: fragmented"); 416 } 417 l2cap_send_prepared(connection->l2cap_signaling_cid, pos); 418 break; 419 } 420 case AVDTP_INITIATOR_W2_OPEN_STREAM: 421 switch (stream_endpoint->state){ 422 case AVDTP_STREAM_ENDPOINT_W2_REQUEST_OPEN_STREAM: 423 log_info("INT: AVDTP_STREAM_ENDPOINT_W2_REQUEST_OPEN_STREAM"); 424 avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_OPEN, connection->initiator_transaction_label, connection->remote_seid); 425 break; 426 default: 427 sent = 0; 428 break; 429 } 430 break; 431 default: 432 sent = 0; 433 break; 434 } 435 436 // check fragmentation 437 if (connection->signaling_packet.packet_type != AVDTP_SINGLE_PACKET && connection->signaling_packet.packet_type != AVDTP_END_PACKET){ 438 avdtp_request_can_send_now_initiator(connection, connection->l2cap_signaling_cid); 439 } 440 } 441