From 23edb87eff72c914cc81b08412a5150d905b35b9 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Mon, 20 Jul 2020 12:41:02 +0200 Subject: [PATCH] avdtp: use Bluetooth error codes --- src/bluetooth.h | 7 ---- src/classic/a2dp_sink.c | 2 +- src/classic/a2dp_source.c | 2 +- src/classic/avdtp.c | 74 +++++++++++++++++++------------------- src/classic/avdtp_sink.c | 8 ++--- src/classic/avdtp_source.h | 24 ++++++------- src/classic/avdtp_util.c | 4 +-- 7 files changed, 57 insertions(+), 64 deletions(-) diff --git a/src/bluetooth.h b/src/bluetooth.h index eaeb939a6..02b7d09ec 100644 --- a/src/bluetooth.h +++ b/src/bluetooth.h @@ -267,13 +267,6 @@ typedef enum { #define OBEX_NOT_FOUND 0xB3 #define OBEX_NOT_ACCEPTABLE 0xB4 -#define AVDTP_SEID_DOES_NOT_EXIST 0xC0 -#define AVDTP_CONNECTION_DOES_NOT_EXIST 0xC1 -#define AVDTP_CONNECTION_IN_WRONG_STATE 0xC2 -#define AVDTP_STREAM_ENDPOINT_IN_WRONG_STATE 0xC3 -#define AVDTP_STREAM_ENDPOINT_DOES_NOT_EXIST 0xC4 -#define AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST 0xC5 - #define MESH_ERROR_APPKEY_INDEX_INVALID 0xD0 /* ENUM_END */ diff --git a/src/classic/a2dp_sink.c b/src/classic/a2dp_sink.c index 0abc56c95..5d61e5b6c 100644 --- a/src/classic/a2dp_sink.c +++ b/src/classic/a2dp_sink.c @@ -183,7 +183,7 @@ uint8_t a2dp_sink_establish_stream(bd_addr_t bd_addr, uint8_t local_seid, uint16 sc.local_stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid); if (!sc.local_stream_endpoint){ log_info("No local_stream_endpoint for seid %d", local_seid); - return AVDTP_SEID_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } // remember to tell client send_stream_established_for_outgoing_connection = 1; diff --git a/src/classic/a2dp_source.c b/src/classic/a2dp_source.c index f3aa4fd40..2ca6dbc69 100644 --- a/src/classic/a2dp_source.c +++ b/src/classic/a2dp_source.c @@ -548,7 +548,7 @@ uint8_t a2dp_source_establish_stream(bd_addr_t remote_addr, uint8_t loc_seid, ui sc.local_stream_endpoint = avdtp_get_stream_endpoint_for_seid(loc_seid); if (!sc.local_stream_endpoint){ log_error(" no local_stream_endpoint for seid %d", loc_seid); - return AVDTP_SEID_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } (void)memcpy(sc.remote_addr, remote_addr, 6); app_state = A2DP_W4_CONNECTED; diff --git a/src/classic/avdtp.c b/src/classic/avdtp.c index b514edcb8..693fee16e 100644 --- a/src/classic/avdtp.c +++ b/src/classic/avdtp.c @@ -1015,7 +1015,7 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet break; default: log_info("AVDTP_STREAM_ENDPOINT_OPENED failed - stream endpoint in wrong state %d, avdtp cid 0x%02x, l2cap_media_cid 0x%02x, local seid %d, remote seid %d", stream_endpoint->state, connection->avdtp_cid, stream_endpoint->l2cap_media_cid, avdtp_local_seid(stream_endpoint), avdtp_remote_seid(stream_endpoint)); - avdtp_streaming_emit_connection_established(stream_endpoint, AVDTP_STREAM_ENDPOINT_IN_WRONG_STATE); + avdtp_streaming_emit_connection_established(stream_endpoint, ERROR_CODE_COMMAND_DISALLOWED); break; } break; @@ -1099,7 +1099,7 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet uint8_t avdtp_disconnect(uint16_t avdtp_cid){ avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); - if (!connection) return AVDTP_CONNECTION_DOES_NOT_EXIST; + if (!connection) return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; if (connection->state == AVDTP_SIGNALING_CONNECTION_W4_L2CAP_DISCONNECTED) return ERROR_CODE_SUCCESS; @@ -1130,26 +1130,26 @@ uint8_t avdtp_open_stream(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("avdtp_media_connect: no connection for signaling cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) { log_error("avdtp_media_connect: wrong connection state %d", connection->state); - return AVDTP_CONNECTION_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid); if (!stream_endpoint) { log_error("avdtp_media_connect: no stream_endpoint with seid %d found", local_seid); - return AVDTP_SEID_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (stream_endpoint->remote_sep.seid != remote_seid){ log_error("avdtp_media_connect: no remote sep with seid %d registered with the stream endpoint", remote_seid); - return AVDTP_SEID_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } - if (stream_endpoint->state < AVDTP_STREAM_ENDPOINT_CONFIGURED) return AVDTP_STREAM_ENDPOINT_IN_WRONG_STATE; + if (stream_endpoint->state < AVDTP_STREAM_ENDPOINT_CONFIGURED) return ERROR_CODE_COMMAND_DISALLOWED; connection->initiator_transaction_label++; connection->initiator_remote_seid = remote_seid; @@ -1164,23 +1164,23 @@ uint8_t avdtp_start_stream(uint16_t avdtp_cid, uint8_t local_seid){ avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("avdtp_start_stream: no connection for signaling cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid); if (!stream_endpoint) { log_error("avdtp_start_stream: no stream_endpoint with seid %d found", local_seid); - return AVDTP_SEID_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (stream_endpoint->l2cap_media_cid == 0){ log_error("avdtp_start_stream: no media connection for stream_endpoint with seid %d found", local_seid); - return AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (!is_avdtp_remote_seid_registered(stream_endpoint)){ log_error("avdtp_media_connect: no remote sep registered with the stream endpoint"); - return AVDTP_SEID_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->start_stream == 1){ @@ -1198,18 +1198,18 @@ uint8_t avdtp_stop_stream(uint16_t avdtp_cid, uint8_t local_seid){ avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("avdtp_stop_stream: no connection for signaling cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid); if (!stream_endpoint) { log_error("avdtp_stop_stream: no stream_endpoint with seid %d found", local_seid); - return AVDTP_SEID_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (stream_endpoint->l2cap_media_cid == 0){ log_error("avdtp_stop_stream: no media connection for stream_endpoint with seid %d found", local_seid); - return AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->stop_stream){ @@ -1227,18 +1227,18 @@ uint8_t avdtp_abort_stream(uint16_t avdtp_cid, uint8_t local_seid){ avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("avdtp_abort_stream: no connection for signaling cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid); if (!stream_endpoint) { log_error("avdtp_abort_stream: no stream_endpoint with seid %d found", local_seid); - return AVDTP_SEID_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (stream_endpoint->l2cap_media_cid == 0){ log_error("avdtp_abort_stream: no media connection for stream_endpoint with seid %d found", local_seid); - return AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->abort_stream){ @@ -1256,17 +1256,17 @@ uint8_t avdtp_suspend_stream(uint16_t avdtp_cid, uint8_t local_seid){ avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("avdtp_suspend_stream: no connection for signaling cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid); if (!stream_endpoint) { log_error("avdtp_suspend_stream: no stream_endpoint with seid %d found", local_seid); - return AVDTP_SEID_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (stream_endpoint->l2cap_media_cid == 0){ log_error("avdtp_suspend_stream: no media connection for stream_endpoint with seid %d found", local_seid); - return AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (!is_avdtp_remote_seid_registered(stream_endpoint) || stream_endpoint->suspend_stream){ @@ -1284,11 +1284,11 @@ uint8_t avdtp_discover_stream_endpoints(uint16_t avdtp_cid){ avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("avdtp_discover_stream_endpoints: no connection for signaling cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if ((connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) || (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE)) { - return AVDTP_CONNECTION_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } connection->initiator_transaction_label++; @@ -1301,11 +1301,11 @@ uint8_t avdtp_get_capabilities(uint16_t avdtp_cid, uint8_t remote_seid){ avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("No connection for AVDTP cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if ((connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) || (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE)) { - return AVDTP_CONNECTION_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } connection->initiator_transaction_label++; @@ -1319,11 +1319,11 @@ uint8_t avdtp_get_all_capabilities(uint16_t avdtp_cid, uint8_t remote_seid){ avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("No connection for AVDTP cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if ((connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) || (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE)) { - return AVDTP_CONNECTION_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } connection->initiator_transaction_label++; @@ -1336,11 +1336,11 @@ uint8_t avdtp_get_configuration(uint16_t avdtp_cid, uint8_t remote_seid){ avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("No connection for AVDTP cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if ((connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) || (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE)) { - return AVDTP_CONNECTION_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } connection->initiator_transaction_label++; @@ -1353,26 +1353,26 @@ uint8_t avdtp_set_configuration(uint16_t avdtp_cid, uint8_t local_seid, uint8_t avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("No connection for AVDTP cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if ((connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) || (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE)) { log_error("connection in wrong state, %d, initiator state %d", connection->state, connection->initiator_connection_state); - return AVDTP_CONNECTION_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } if (connection->configuration_state != AVDTP_CONFIGURATION_STATE_IDLE){ log_info("configuration already started, config state %u", connection->configuration_state); - return AVDTP_CONNECTION_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid); if (!stream_endpoint) { log_error("No initiator stream endpoint for seid %d", local_seid); - return AVDTP_STREAM_ENDPOINT_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (stream_endpoint->state >= AVDTP_STREAM_ENDPOINT_CONFIGURED){ log_error("Stream endpoint seid %d in wrong state %d", local_seid, stream_endpoint->state); - return AVDTP_STREAM_ENDPOINT_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } connection->active_stream_endpoint = (void*) stream_endpoint; @@ -1399,23 +1399,23 @@ uint8_t avdtp_reconfigure(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("No connection for AVDTP cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } //TODO: if opened only app capabilities, enable reconfigure for not opened if ((connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) || (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE)) { - return AVDTP_CONNECTION_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid); if (!stream_endpoint) { log_error("avdtp_reconfigure: no initiator stream endpoint for seid %d", local_seid); - return AVDTP_STREAM_ENDPOINT_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (!is_avdtp_remote_seid_registered(stream_endpoint)){ log_error("avdtp_reconfigure: no associated remote sep"); - return AVDTP_STREAM_ENDPOINT_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } connection->initiator_transaction_label++; diff --git a/src/classic/avdtp_sink.c b/src/classic/avdtp_sink.c index fa54c1300..e7a8ae9a8 100644 --- a/src/classic/avdtp_sink.c +++ b/src/classic/avdtp_sink.c @@ -167,24 +167,24 @@ uint8_t avdtp_sink_delay_report(uint16_t avdtp_cid, uint8_t local_seid, uint16_t avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid); if (!connection){ log_error("delay_report: no connection for signaling cid 0x%02x found", avdtp_cid); - return AVDTP_CONNECTION_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if ((connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) || (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE)) { log_error("delay_report: connection in wrong state, state %d, initiator state %d", connection->state, connection->initiator_connection_state); - return AVDTP_CONNECTION_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid); if (!stream_endpoint) { log_error("delay_report: no stream_endpoint with seid %d found", local_seid); - return AVDTP_SEID_DOES_NOT_EXIST; + return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; } if (stream_endpoint->state < AVDTP_STREAM_ENDPOINT_CONFIGURED){ log_error("Stream endpoint seid %d in wrong state %d", local_seid, stream_endpoint->state); - return AVDTP_STREAM_ENDPOINT_IN_WRONG_STATE; + return ERROR_CODE_COMMAND_DISALLOWED; } connection->initiator_transaction_label++; diff --git a/src/classic/avdtp_source.h b/src/classic/avdtp_source.h index ff77773bb..2cdf5c968 100644 --- a/src/classic/avdtp_source.h +++ b/src/classic/avdtp_source.h @@ -139,35 +139,35 @@ uint8_t avdtp_source_connect(bd_addr_t bd_addr, uint16_t * avdtp_cid); /** * @brief Disconnect from device with connection handle. * @param avdtp_cid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER */ uint8_t avdtp_source_disconnect(uint16_t avdtp_cid); /** * @brief Discover stream endpoints * @param avdtp_cid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_CONNECTION_IN_WRONG_STATE + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_discover_stream_endpoints(uint16_t avdtp_cid); /** * @brief Get capabilities * @param avdtp_cid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_CONNECTION_IN_WRONG_STATE + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_get_capabilities(uint16_t avdtp_cid, uint8_t acp_seid); /** * @brief Get all capabilities * @param avdtp_cid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_CONNECTION_IN_WRONG_STATE + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_get_all_capabilities(uint16_t avdtp_cid, uint8_t acp_seid); /** * @brief Set configuration * @param avdtp_cid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_CONNECTION_IN_WRONG_STATE, AVDTP_STREAM_ENDPOINT_DOES_NOT_EXIST, AVDTP_STREAM_ENDPOINT_IN_WRONG_STATE + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_set_configuration(uint16_t avdtp_cid, uint8_t int_seid, uint8_t acp_seid, uint16_t configured_services_bitmap, avdtp_capabilities_t configuration); @@ -175,14 +175,14 @@ uint8_t avdtp_source_set_configuration(uint16_t avdtp_cid, uint8_t int_seid, uin * @brief Reconfigure stream * @param avdtp_cid * @param seid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_CONNECTION_IN_WRONG_STATE, AVDTP_STREAM_ENDPOINT_DOES_NOT_EXIST, AVDTP_STREAM_ENDPOINT_IN_WRONG_STATE + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_reconfigure(uint16_t avdtp_cid, uint8_t int_seid, uint8_t acp_seid, uint16_t configured_services_bitmap, avdtp_capabilities_t configuration); /** * @brief Get configuration * @param avdtp_cid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_CONNECTION_IN_WRONG_STATE + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_get_configuration(uint16_t avdtp_cid, uint8_t acp_seid); @@ -191,35 +191,35 @@ uint8_t avdtp_source_get_configuration(uint16_t avdtp_cid, uint8_t acp_seid); * @brief Open stream * @param avdtp_cid * @param seid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_CONNECTION_IN_WRONG_STATE, AVDTP_SEID_DOES_NOT_EXIST, AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_open_stream(uint16_t avdtp_cid, uint8_t int_seid, uint8_t acp_seid); /** * @brief Start stream * @param local_seid -* @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_SEID_DOES_NOT_EXIST, AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST +* @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_start_stream(uint16_t avdtp_cid, uint8_t local_seid); /** * @brief Abort stream * @param local_seid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_SEID_DOES_NOT_EXIST, AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_abort_stream(uint16_t avdtp_cid, uint8_t local_seid); /** * @brief Start stream * @param local_seid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_SEID_DOES_NOT_EXIST, AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST, + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_stop_stream(uint16_t avdtp_cid, uint8_t local_seid); /** * @brief Suspend stream * @param local_seid - * @return status ERROR_CODE_SUCCESS if succesful, otherwise AVDTP_CONNECTION_DOES_NOT_EXIST, AVDTP_SEID_DOES_NOT_EXIST, AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST + * @return status ERROR_CODE_SUCCESS if succesful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, ERROR_CODE_COMMAND_DISALLOWED */ uint8_t avdtp_source_suspend(uint16_t avdtp_cid, uint8_t local_seid); diff --git a/src/classic/avdtp_util.c b/src/classic/avdtp_util.c index a1eb638e3..835211f52 100644 --- a/src/classic/avdtp_util.c +++ b/src/classic/avdtp_util.c @@ -778,14 +778,14 @@ void avdtp_emit_capabilities(uint16_t avdtp_cid, uint8_t local_seid, uint8_t rem } uint8_t avdtp_request_can_send_now_acceptor(avdtp_connection_t * connection, uint16_t l2cap_cid){ - if (!connection) return AVDTP_CONNECTION_DOES_NOT_EXIST; + if (!connection) return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; connection->wait_to_send_acceptor = 1; l2cap_request_can_send_now_event(l2cap_cid); return ERROR_CODE_SUCCESS; } uint8_t avdtp_request_can_send_now_initiator(avdtp_connection_t * connection, uint16_t l2cap_cid){ - if (!connection) return AVDTP_CONNECTION_DOES_NOT_EXIST; + if (!connection) return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; connection->wait_to_send_initiator = 1; l2cap_request_can_send_now_event(l2cap_cid); return ERROR_CODE_SUCCESS;