mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 04:20:20 +00:00
bluetooth_psm: replace prefix PSM_ with BLUEOOTH_PSM_
This commit is contained in:
parent
6b04f67595
commit
84e3541e4b
@ -48,6 +48,7 @@
|
||||
|
||||
#include "ad_parser.h"
|
||||
#include "bluetooth.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_company_id.h"
|
||||
#include "bluetooth_data_types.h"
|
||||
#include "bluetooth_gatt.h"
|
||||
|
@ -38,14 +38,16 @@
|
||||
#define BTSTACK_FILE__ "a2dp_sink.c"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/avdtp_sink.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "classic/a2dp_sink.h"
|
||||
#include "classic/avdtp_sink.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/sdp_util.h"
|
||||
|
||||
static const char * default_a2dp_sink_service_name = "BTstack A2DP Sink Service";
|
||||
static const char * default_a2dp_sink_service_provider_name = "BTstack A2DP Sink Service Provider";
|
||||
@ -82,7 +84,7 @@ void a2dp_sink_create_sdp_record(uint8_t * service, uint32_t service_record_han
|
||||
uint8_t* l2cpProtocol = de_push_sequence(attribute);
|
||||
{
|
||||
de_add_number(l2cpProtocol, DE_UUID, DE_SIZE_16, BLUETOOTH_PROTOCOL_L2CAP);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PROTOCOL_AVDTP);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PSM_AVDTP);
|
||||
}
|
||||
de_pop_sequence(attribute, l2cpProtocol);
|
||||
|
||||
|
@ -39,14 +39,17 @@
|
||||
#define BTSTACK_FILE__ "a2dp_source.c"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#include "classic/avdtp.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/avdtp_source.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "classic/a2dp_source.h"
|
||||
#include "classic/avdtp_source.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "l2cap.h"
|
||||
|
||||
#define AVDTP_MAX_SEP_NUM 10
|
||||
#define AVDTP_MEDIA_PAYLOAD_HEADER_SIZE 12
|
||||
@ -85,7 +88,7 @@ void a2dp_source_create_sdp_record(uint8_t * service, uint32_t service_record_ha
|
||||
uint8_t* l2cpProtocol = de_push_sequence(attribute);
|
||||
{
|
||||
de_add_number(l2cpProtocol, DE_UUID, DE_SIZE_16, BLUETOOTH_PROTOCOL_L2CAP);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PROTOCOL_AVDTP);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PSM_AVDTP);
|
||||
}
|
||||
de_pop_sequence(attribute, l2cpProtocol);
|
||||
|
||||
|
@ -39,15 +39,19 @@
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "classic/avdtp.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/avdtp_acceptor.h"
|
||||
#include "classic/avdtp_initiator.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/sdp_client.h"
|
||||
#include "classic/sdp_util.h"
|
||||
|
||||
#define CONFIGURATION_TIMEOUT_MS 300
|
||||
|
||||
@ -636,7 +640,7 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
|
||||
|
||||
case L2CAP_EVENT_CHANNEL_OPENED:
|
||||
psm = l2cap_event_channel_opened_get_psm(packet);
|
||||
if (psm != BLUETOOTH_PROTOCOL_AVDTP){
|
||||
if (psm != BLUETOOTH_PSM_AVDTP){
|
||||
log_info("Unexpected PSM - Not implemented yet, avdtp sink: L2CAP_EVENT_CHANNEL_OPENED ");
|
||||
return;
|
||||
}
|
||||
|
@ -38,11 +38,13 @@
|
||||
#define BTSTACK_FILE__ "avdtp_initiator.c"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "l2cap.h"
|
||||
#include "classic/avdtp.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/avdtp_initiator.h"
|
||||
@ -199,7 +201,7 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
|
||||
}
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_W4_L2CAP_FOR_MEDIA_CONNECTED;
|
||||
connection->local_seid = stream_endpoint->sep.seid;
|
||||
l2cap_create_channel(context->packet_handler, connection->remote_addr, BLUETOOTH_PROTOCOL_AVDTP, 0xffff, NULL);
|
||||
l2cap_create_channel(context->packet_handler, connection->remote_addr, BLUETOOTH_PSM_AVDTP, 0xffff, NULL);
|
||||
return;
|
||||
case AVDTP_SI_START:
|
||||
if (!stream_endpoint){
|
||||
|
@ -38,16 +38,19 @@
|
||||
#define BTSTACK_FILE__ "avdtp_sink.c"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "l2cap.h"
|
||||
|
||||
#include "classic/avdtp.h"
|
||||
#include "classic/avdtp_acceptor.h"
|
||||
#include "classic/avdtp_initiator.h"
|
||||
#include "classic/avdtp_sink.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/avdtp_initiator.h"
|
||||
#include "classic/avdtp_acceptor.h"
|
||||
|
||||
static avdtp_context_t * avdtp_sink_context;
|
||||
|
||||
@ -117,7 +120,7 @@ void avdtp_sink_init(avdtp_context_t * avdtp_context){
|
||||
avdtp_sink_context->stream_endpoints_id_counter = 0;
|
||||
avdtp_sink_context->packet_handler = packet_handler;
|
||||
|
||||
l2cap_register_service(&packet_handler, BLUETOOTH_PROTOCOL_AVDTP, 0xffff, LEVEL_2);
|
||||
l2cap_register_service(&packet_handler, BLUETOOTH_PSM_AVDTP, 0xffff, LEVEL_2);
|
||||
}
|
||||
|
||||
avdtp_stream_endpoint_t * avdtp_sink_create_stream_endpoint(avdtp_sep_type_t sep_type, avdtp_media_type_t media_type){
|
||||
|
@ -40,11 +40,14 @@
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "l2cap.h"
|
||||
|
||||
#include "classic/avdtp.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/avdtp_source.h"
|
||||
@ -172,6 +175,6 @@ void avdtp_source_init(avdtp_context_t * avdtp_context){
|
||||
avdtp_source_context->stream_endpoints_id_counter = 0;
|
||||
avdtp_source_context->packet_handler = packet_handler;
|
||||
|
||||
l2cap_register_service(&packet_handler, BLUETOOTH_PROTOCOL_AVDTP, 0xffff, LEVEL_2);
|
||||
l2cap_register_service(&packet_handler, BLUETOOTH_PSM_AVDTP, 0xffff, LEVEL_2);
|
||||
}
|
||||
|
||||
|
@ -38,17 +38,18 @@
|
||||
#define BTSTACK_FILE__ "avrcp.c"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "classic/sdp_client.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "classic/avrcp.h"
|
||||
#include "classic/avrcp_controller.h"
|
||||
|
||||
#define PSM_AVCTP BLUETOOTH_PROTOCOL_AVCTP
|
||||
#define PSM_AVCTP_BROWSING 0x001b
|
||||
|
||||
static void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
||||
|
||||
static const char * default_avrcp_controller_service_name = "BTstack AVRCP Controller Service";
|
||||
@ -203,7 +204,7 @@ void avrcp_create_sdp_record(uint8_t controller, uint8_t * service, uint32_t ser
|
||||
uint8_t* l2cpProtocol = de_push_sequence(attribute);
|
||||
{
|
||||
de_add_number(l2cpProtocol, DE_UUID, DE_SIZE_16, BLUETOOTH_PROTOCOL_L2CAP);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PROTOCOL_AVCTP);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PSM_AVCTP);
|
||||
}
|
||||
de_pop_sequence(attribute, l2cpProtocol);
|
||||
|
||||
@ -247,7 +248,7 @@ void avrcp_create_sdp_record(uint8_t controller, uint8_t * service, uint32_t ser
|
||||
uint8_t* browsing_l2cpProtocol = de_push_sequence(des);
|
||||
{
|
||||
de_add_number(browsing_l2cpProtocol, DE_UUID, DE_SIZE_16, BLUETOOTH_PROTOCOL_L2CAP);
|
||||
de_add_number(browsing_l2cpProtocol, DE_UINT, DE_SIZE_16, PSM_AVCTP_BROWSING);
|
||||
de_add_number(browsing_l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PSM_AVCTP_BROWSING);
|
||||
}
|
||||
de_pop_sequence(des, browsing_l2cpProtocol);
|
||||
|
||||
@ -797,7 +798,7 @@ void avrcp_init(void){
|
||||
connections = NULL;
|
||||
if (l2cap_service_registered) return;
|
||||
|
||||
int status = l2cap_register_service(&avrcp_packet_handler, BLUETOOTH_PROTOCOL_AVCTP, 0xffff, LEVEL_2);
|
||||
int status = l2cap_register_service(&avrcp_packet_handler, BLUETOOTH_PSM_AVCTP, 0xffff, LEVEL_2);
|
||||
if (status != ERROR_CODE_SUCCESS) return;
|
||||
l2cap_service_registered = 1;
|
||||
}
|
||||
|
@ -43,13 +43,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h> // memcpy
|
||||
#include <stdint.h>
|
||||
#include <string.h> // memcpy
|
||||
|
||||
#include "bnep.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "bnep.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
@ -1219,7 +1218,7 @@ static int bnep_hci_event_handler(uint8_t *packet, uint16_t size)
|
||||
|
||||
switch (hci_event_packet_get_type(packet)) {
|
||||
|
||||
/* Accept an incoming L2CAP connection on BLUETOOTH_PROTOCOL_BNEP */
|
||||
/* Accept an incoming L2CAP connection on BLUETOOTH_PSM_BNEP */
|
||||
case L2CAP_EVENT_INCOMING_CONNECTION:
|
||||
/* L2CAP event data: event(8), len(8), address(48), handle (16), psm (16), source cid(16) dest cid(16) */
|
||||
reverse_bd_addr(&packet[2], event_addr);
|
||||
@ -1227,12 +1226,12 @@ static int bnep_hci_event_handler(uint8_t *packet, uint16_t size)
|
||||
psm = little_endian_read_16(packet, 10);
|
||||
l2cap_cid = little_endian_read_16(packet, 12);
|
||||
|
||||
if (psm != BLUETOOTH_PROTOCOL_BNEP) break;
|
||||
if (psm != BLUETOOTH_PSM_BNEP) break;
|
||||
|
||||
channel = bnep_channel_for_addr(event_addr);
|
||||
|
||||
if (channel) {
|
||||
log_error("INCOMING_CONNECTION (l2cap_cid 0x%02x) for BLUETOOTH_PROTOCOL_BNEP => decline - channel already exists", l2cap_cid);
|
||||
log_error("INCOMING_CONNECTION (l2cap_cid 0x%02x) for BLUETOOTH_PSM_BNEP => decline - channel already exists", l2cap_cid);
|
||||
l2cap_decline_connection(l2cap_cid);
|
||||
return 1;
|
||||
}
|
||||
@ -1241,7 +1240,7 @@ static int bnep_hci_event_handler(uint8_t *packet, uint16_t size)
|
||||
channel = bnep_channel_create_for_addr(event_addr);
|
||||
|
||||
if (!channel) {
|
||||
log_error("INCOMING_CONNECTION (l2cap_cid 0x%02x) for BLUETOOTH_PROTOCOL_BNEP => decline - no memory left", l2cap_cid);
|
||||
log_error("INCOMING_CONNECTION (l2cap_cid 0x%02x) for BLUETOOTH_PSM_BNEP => decline - no memory left", l2cap_cid);
|
||||
l2cap_decline_connection(l2cap_cid);
|
||||
return 1;
|
||||
}
|
||||
@ -1256,19 +1255,14 @@ static int bnep_hci_event_handler(uint8_t *packet, uint16_t size)
|
||||
/* Start connection timeout timer */
|
||||
bnep_channel_start_timer(channel, BNEP_CONNECTION_TIMEOUT_MS);
|
||||
|
||||
log_info("L2CAP_EVENT_INCOMING_CONNECTION (l2cap_cid 0x%02x) for BLUETOOTH_PROTOCOL_BNEP => accept", l2cap_cid);
|
||||
log_info("L2CAP_EVENT_INCOMING_CONNECTION (l2cap_cid 0x%02x) for BLUETOOTH_PSM_BNEP => accept", l2cap_cid);
|
||||
l2cap_accept_connection(l2cap_cid);
|
||||
return 1;
|
||||
|
||||
/* Outgoing L2CAP connection has been opened -> store l2cap_cid, remote_addr */
|
||||
case L2CAP_EVENT_CHANNEL_OPENED:
|
||||
/* Check if the l2cap channel has been opened for BLUETOOTH_PROTOCOL_BNEP */
|
||||
if (little_endian_read_16(packet, 11) != BLUETOOTH_PROTOCOL_BNEP) {
|
||||
break;
|
||||
}
|
||||
|
||||
status = packet[2];
|
||||
log_info("L2CAP_EVENT_CHANNEL_OPENED for BLUETOOTH_PROTOCOL_BNEP, status %u", status);
|
||||
log_info("L2CAP_EVENT_CHANNEL_OPENED for BLUETOOTH_PSM_BNEP, status %u", status);
|
||||
|
||||
/* Get the bnep channel fpr remote address */
|
||||
con_handle = little_endian_read_16(packet, 9);
|
||||
@ -1638,7 +1632,7 @@ uint8_t bnep_register_service(btstack_packet_handler_t packet_handler, uint16_t
|
||||
}
|
||||
|
||||
/* register with l2cap if not registered before, max MTU */
|
||||
l2cap_register_service(bnep_packet_handler, BLUETOOTH_PROTOCOL_BNEP, 0xffff, bnep_security_level);
|
||||
l2cap_register_service(bnep_packet_handler, BLUETOOTH_PSM_BNEP, 0xffff, bnep_security_level);
|
||||
|
||||
/* Setup the service struct */
|
||||
service->max_frame_size = max_frame_size;
|
||||
@ -1665,6 +1659,6 @@ void bnep_unregister_service(uint16_t service_uuid)
|
||||
btstack_memory_bnep_service_free(service);
|
||||
service = NULL;
|
||||
|
||||
l2cap_unregister_service(BLUETOOTH_PROTOCOL_BNEP);
|
||||
l2cap_unregister_service(BLUETOOTH_PSM_BNEP);
|
||||
}
|
||||
|
||||
|
@ -46,12 +46,13 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bluetooth_gatt.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_config.h"
|
||||
#include "l2cap.h"
|
||||
#include "classic/core.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "bluetooth_gatt.h"
|
||||
#include "l2cap.h"
|
||||
|
||||
void gatt_create_sdp_record(uint8_t *service, uint32_t service_record_handle, uint16_t gatt_start_handle, uint16_t gatt_end_handle){
|
||||
|
||||
@ -77,7 +78,7 @@ void gatt_create_sdp_record(uint8_t *service, uint32_t service_record_handle, ui
|
||||
uint8_t* l2cap_protocol = de_push_sequence(attribute);
|
||||
{
|
||||
de_add_number(l2cap_protocol, DE_UUID, DE_SIZE_16, BLUETOOTH_PROTOCOL_L2CAP);
|
||||
de_add_number(l2cap_protocol, DE_UINT, DE_SIZE_16, PSM_ATT);
|
||||
de_add_number(l2cap_protocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PSM_ATT);
|
||||
}
|
||||
de_pop_sequence(attribute, l2cap_protocol);
|
||||
|
||||
|
@ -39,14 +39,15 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "bluetooth.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_hid_parser.h"
|
||||
#include "classic/hid_device.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "bluetooth.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "l2cap.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_hid_parser.h"
|
||||
|
||||
typedef enum {
|
||||
HID_DEVICE_IDLE,
|
||||
@ -184,7 +185,7 @@ void hid_create_sdp_record(
|
||||
uint8_t * l2cpProtocol = de_push_sequence(attribute);
|
||||
{
|
||||
de_add_number(l2cpProtocol, DE_UUID, DE_SIZE_16, BLUETOOTH_PROTOCOL_L2CAP);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, PSM_HID_CONTROL);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PSM_HID_CONTROL);
|
||||
}
|
||||
de_pop_sequence(attribute, l2cpProtocol);
|
||||
|
||||
@ -214,7 +215,7 @@ void hid_create_sdp_record(
|
||||
uint8_t * l2cpProtocol = de_push_sequence(additionalDescriptorAttribute);
|
||||
{
|
||||
de_add_number(l2cpProtocol, DE_UUID, DE_SIZE_16, BLUETOOTH_PROTOCOL_L2CAP);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, PSM_HID_INTERRUPT);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PSM_HID_INTERRUPT);
|
||||
}
|
||||
de_pop_sequence(additionalDescriptorAttribute, l2cpProtocol);
|
||||
|
||||
|
@ -48,11 +48,12 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_config.h"
|
||||
#include "l2cap.h"
|
||||
#include "classic/core.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "l2cap.h"
|
||||
|
||||
static const char default_panu_service_name[] = "Personal Ad-hoc User Service";
|
||||
static const char default_panu_service_desc[] = "Personal Ad-hoc User Service";
|
||||
@ -91,7 +92,7 @@ static void pan_create_service(uint8_t *service, uint32_t service_record_handle,
|
||||
uint8_t* l2cpProtocol = de_push_sequence(attribute);
|
||||
{
|
||||
de_add_number(l2cpProtocol, DE_UUID, DE_SIZE_16, BLUETOOTH_PROTOCOL_L2CAP);
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, PSM_BNEP); // l2cap psm
|
||||
de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PSM_BNEP); // l2cap psm
|
||||
}
|
||||
de_pop_sequence(attribute, l2cpProtocol);
|
||||
|
||||
|
@ -40,9 +40,10 @@
|
||||
/*
|
||||
* sdp_client.c
|
||||
*/
|
||||
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_config.h"
|
||||
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "classic/core.h"
|
||||
@ -693,7 +694,7 @@ uint8_t sdp_client_query(btstack_packet_handler_t callback, bd_addr_t remote, co
|
||||
PDU_ID = SDP_ServiceSearchAttributeResponse;
|
||||
|
||||
sdp_client_state = W4_CONNECT;
|
||||
return l2cap_create_channel(sdp_client_packet_handler, remote, BLUETOOTH_PROTOCOL_SDP, l2cap_max_mtu(), NULL);
|
||||
return l2cap_create_channel(sdp_client_packet_handler, remote, BLUETOOTH_PSM_SDP, l2cap_max_mtu(), NULL);
|
||||
}
|
||||
|
||||
uint8_t sdp_client_query_uuid16(btstack_packet_handler_t callback, bd_addr_t remote, uint16_t uuid){
|
||||
@ -717,7 +718,7 @@ uint8_t sdp_client_service_attribute_search(btstack_packet_handler_t callback, b
|
||||
PDU_ID = SDP_ServiceAttributeResponse;
|
||||
|
||||
sdp_client_state = W4_CONNECT;
|
||||
l2cap_create_channel(sdp_client_packet_handler, remote, BLUETOOTH_PROTOCOL_SDP, l2cap_max_mtu(), NULL);
|
||||
l2cap_create_channel(sdp_client_packet_handler, remote, BLUETOOTH_PSM_SDP, l2cap_max_mtu(), NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -731,7 +732,7 @@ uint8_t sdp_client_service_search(btstack_packet_handler_t callback, bd_addr_t r
|
||||
PDU_ID = SDP_ServiceSearchResponse;
|
||||
|
||||
sdp_client_state = W4_CONNECT;
|
||||
l2cap_create_channel(sdp_client_packet_handler, remote, BLUETOOTH_PROTOCOL_SDP, l2cap_max_mtu(), NULL);
|
||||
l2cap_create_channel(sdp_client_packet_handler, remote, BLUETOOTH_PSM_SDP, l2cap_max_mtu(), NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "bluetooth.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
@ -52,8 +53,8 @@
|
||||
#include "classic/core.h"
|
||||
#include "classic/sdp_server.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "hci_dump.h"
|
||||
#include "hci.h"
|
||||
#include "hci_dump.h"
|
||||
#include "l2cap.h"
|
||||
|
||||
// max number of incoming l2cap connections that can be queued instead of getting rejected
|
||||
@ -86,7 +87,7 @@ static int l2cap_waiting_list_count;
|
||||
|
||||
void sdp_init(void){
|
||||
// register with l2cap psm sevices - max MTU
|
||||
l2cap_register_service(sdp_packet_handler, BLUETOOTH_PROTOCOL_SDP, 0xffff, LEVEL_0);
|
||||
l2cap_register_service(sdp_packet_handler, BLUETOOTH_PSM_SDP, 0xffff, LEVEL_0);
|
||||
l2cap_waiting_list_count = 0;
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "hci.h"
|
||||
#include "hci_dump.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "bluetooth_psm.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
@ -1210,7 +1211,7 @@ void l2cap_require_security_level_2_for_outgoing_sdp(void){
|
||||
}
|
||||
|
||||
static int l2cap_security_level_0_allowed_for_PSM(uint16_t psm){
|
||||
return (psm == BLUETOOTH_PROTOCOL_SDP) && (!require_security_level2_for_outgoing_sdp);
|
||||
return (psm == BLUETOOTH_PSM_SDP) && (!require_security_level2_for_outgoing_sdp);
|
||||
}
|
||||
|
||||
static int l2cap_send_signaling_packet(hci_con_handle_t handle, L2CAP_SIGNALING_COMMANDS cmd, int identifier, ...){
|
||||
|
@ -49,16 +49,17 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "bluetooth_psm.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "btstack_stdin.h"
|
||||
#include "gap.h"
|
||||
#include "hci.h"
|
||||
#include "hci_cmd.h"
|
||||
#include "hci_dump.h"
|
||||
#include "l2cap.h"
|
||||
#include "btstack_stdin.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
|
||||
static void show_usage(void);
|
||||
|
||||
@ -165,9 +166,9 @@ static void stdin_process(char buffer){
|
||||
case 'c':
|
||||
printf("Creating L2CAP Connection to %s, PSM SDP\n", bd_addr_to_str(remote));
|
||||
if (l2cap_ertm){
|
||||
l2cap_create_ertm_channel(packet_handler, remote, BLUETOOTH_PROTOCOL_SDP, &ertm_config, ertm_buffer, sizeof(ertm_buffer), &local_cid);
|
||||
l2cap_create_ertm_channel(packet_handler, remote, BLUETOOTH_PSM_SDP, &ertm_config, ertm_buffer, sizeof(ertm_buffer), &local_cid);
|
||||
} else {
|
||||
l2cap_create_channel(packet_handler, remote, BLUETOOTH_PROTOCOL_SDP, 100, &local_cid);
|
||||
l2cap_create_channel(packet_handler, remote, BLUETOOTH_PSM_SDP, 100, &local_cid);
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
@ -233,7 +234,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
||||
l2cap_init();
|
||||
l2cap_register_service(packet_handler, BLUETOOTH_PROTOCOL_SDP, 100, LEVEL_0);
|
||||
l2cap_register_service(packet_handler, BLUETOOTH_PSM_SDP, 100, LEVEL_0);
|
||||
|
||||
// turn on!
|
||||
hci_power_control(HCI_POWER_ON);
|
||||
|
Loading…
x
Reference in New Issue
Block a user