avrcp_controller.c (2f511ffbef90286a7903c7bd3123f85c291bae56) avrcp_controller.c (c0a054f62cfe78c7a035c56db57c84fb42d7f3e3)
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

--- 1134 unchanged lines hidden (view full) ---

1143
1144uint8_t avrcp_controller_disconnect(uint16_t avrcp_cid){
1145 avrcp_connection_t * connection = get_avrcp_connection_for_avrcp_cid(avrcp_cid, &avrcp_controller_context);
1146 if (!connection){
1147 log_error("avrcp_get_capabilities: could not find a connection.");
1148 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
1149 }
1150 if (connection->state != AVCTP_CONNECTION_OPENED) return ERROR_CODE_COMMAND_DISALLOWED;
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

--- 1134 unchanged lines hidden (view full) ---

1143
1144uint8_t avrcp_controller_disconnect(uint16_t avrcp_cid){
1145 avrcp_connection_t * connection = get_avrcp_connection_for_avrcp_cid(avrcp_cid, &avrcp_controller_context);
1146 if (!connection){
1147 log_error("avrcp_get_capabilities: could not find a connection.");
1148 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
1149 }
1150 if (connection->state != AVCTP_CONNECTION_OPENED) return ERROR_CODE_COMMAND_DISALLOWED;
1151 if (connection->browsing_connection){
1152 if (connection->browsing_connection->state != AVCTP_CONNECTION_OPENED) return ERROR_CODE_COMMAND_DISALLOWED;
1153 l2cap_disconnect(connection->browsing_connection->l2cap_browsing_cid, 0);
1154 }
1151 l2cap_disconnect(connection->l2cap_signaling_cid, 0);
1152 return ERROR_CODE_SUCCESS;
1153}
1155 l2cap_disconnect(connection->l2cap_signaling_cid, 0);
1156 return ERROR_CODE_SUCCESS;
1157}