avdtp_sink.c (19af95b4393364faa7eabd8f926dd2bc9c318fcb) | avdtp_sink.c (45a58b3093f5320b8ffda59b52081d2b540d3217) |
---|---|
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 --- 92 unchanged lines hidden (view full) --- 101 102/* END: tracking can send now requests pro l2cap cid */ 103// TODO remove 104 105static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ 106 avdtp_packet_handler(packet_type, channel, packet, size, avdtp_sink_context); 107} 108 | 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 --- 92 unchanged lines hidden (view full) --- 101 102/* END: tracking can send now requests pro l2cap cid */ 103// TODO remove 104 105static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ 106 avdtp_packet_handler(packet_type, channel, packet, size, avdtp_sink_context); 107} 108 |
109// TODO: find out which security level is needed, and replace LEVEL_0 in avdtp_sink_init | |
110void avdtp_sink_init(avdtp_context_t * avdtp_context){ 111 if (!avdtp_context){ 112 log_error("avdtp_source_context is NULL"); 113 return; 114 } 115 avdtp_sink_context = avdtp_context; 116 avdtp_sink_context->stream_endpoints = NULL; 117 avdtp_sink_context->connections = NULL; 118 avdtp_sink_context->stream_endpoints_id_counter = 0; 119 avdtp_sink_context->packet_handler = packet_handler; 120 | 109void avdtp_sink_init(avdtp_context_t * avdtp_context){ 110 if (!avdtp_context){ 111 log_error("avdtp_source_context is NULL"); 112 return; 113 } 114 avdtp_sink_context = avdtp_context; 115 avdtp_sink_context->stream_endpoints = NULL; 116 avdtp_sink_context->connections = NULL; 117 avdtp_sink_context->stream_endpoints_id_counter = 0; 118 avdtp_sink_context->packet_handler = packet_handler; 119 |
121 l2cap_register_service(&packet_handler, BLUETOOTH_PROTOCOL_AVDTP, 0xffff, LEVEL_0); | 120 l2cap_register_service(&packet_handler, BLUETOOTH_PROTOCOL_AVDTP, 0xffff, LEVEL_2); |
122} 123 124avdtp_stream_endpoint_t * avdtp_sink_create_stream_endpoint(avdtp_sep_type_t sep_type, avdtp_media_type_t media_type){ 125 return avdtp_create_stream_endpoint(sep_type, media_type, avdtp_sink_context); 126} 127 128void avdtp_sink_register_media_handler(void (*callback)(uint8_t local_seid, uint8_t *packet, uint16_t size)){ 129 if (callback == NULL){ --- 98 unchanged lines hidden --- | 121} 122 123avdtp_stream_endpoint_t * avdtp_sink_create_stream_endpoint(avdtp_sep_type_t sep_type, avdtp_media_type_t media_type){ 124 return avdtp_create_stream_endpoint(sep_type, media_type, avdtp_sink_context); 125} 126 127void avdtp_sink_register_media_handler(void (*callback)(uint8_t local_seid, uint8_t *packet, uint16_t size)){ 128 if (callback == NULL){ --- 98 unchanged lines hidden --- |