mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-16 22:21:21 +00:00
fix unused parameters warning
This commit is contained in:
parent
fecc923b73
commit
9ec2630ce4
3
3rd-party/mbedtls/library/ecp.c
vendored
3
3rd-party/mbedtls/library/ecp.c
vendored
@ -1446,6 +1446,9 @@ static int ecp_mul_naive( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng )
|
||||
{
|
||||
(void) f_rng;
|
||||
(void) p_rng;
|
||||
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
|
@ -85,6 +85,9 @@ static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
static btstack_packet_callback_registration_t sm_event_callback_registration;
|
||||
|
||||
static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
switch (packet_type) {
|
||||
case HCI_EVENT_PACKET:
|
||||
switch (hci_event_packet_get_type(packet)) {
|
||||
@ -101,6 +104,10 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
|
||||
}
|
||||
|
||||
static void ancs_callback(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
const char * attribute_name;
|
||||
if (hci_event_packet_get_type(packet) != HCI_EVENT_ANCS_META) return;
|
||||
switch (hci_event_ancs_meta_get_subevent_code(packet)){
|
||||
@ -123,6 +130,9 @@ static void ancs_callback(uint8_t packet_type, uint16_t channel, uint8_t *packet
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
|
||||
UNUSED(argc);
|
||||
(void)argv;
|
||||
|
||||
printf("BTstack ANCS Client starting up...\n");
|
||||
|
||||
// register for HCI events
|
||||
|
@ -47,6 +47,9 @@ static bd_addr_t remote = {0x84, 0x38, 0x35, 0x65, 0xD1, 0x15};
|
||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
|
||||
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
|
||||
switch (hci_event_packet_get_type(packet)) {
|
||||
@ -65,6 +68,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
hci_event_callback_registration.callback = &packet_handler;
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
@ -129,6 +129,9 @@ static void continue_remote_names(void){
|
||||
*/
|
||||
|
||||
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
bd_addr_t addr;
|
||||
int i;
|
||||
int numResponses;
|
||||
@ -272,6 +275,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
/* LISTING_START(MainConfiguration): Setup packet handler for GAP inquiry */
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
hci_event_callback_registration.callback = &packet_handler;
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
@ -231,6 +231,9 @@ static void dump_advertisement_data(const uint8_t * adv_data, uint8_t adv_size){
|
||||
/* LISTING_START(GAPLEAdvPacketHandler): Scanning and receiving advertisements */
|
||||
|
||||
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
|
||||
switch (hci_event_packet_get_type(packet)) {
|
||||
|
@ -140,6 +140,10 @@ static void dump_service(gatt_client_service_t * service){
|
||||
|
||||
|
||||
static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
int status;
|
||||
uint8_t battery_level;
|
||||
|
||||
@ -236,6 +240,9 @@ static void fill_advertising_report_from_packet(advertising_report_t * adv_repor
|
||||
}
|
||||
|
||||
static void hci_event_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
|
||||
uint8_t event = hci_event_packet_get_type(packet);
|
||||
|
@ -164,6 +164,9 @@ static void fill_advertising_report_from_packet(advertising_report_t * report, u
|
||||
|
||||
/* LISTING_START(GATTBrowserHCIPacketHandler): Connecting and disconnecting from the GATT client */
|
||||
static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
advertising_report_t report;
|
||||
|
||||
@ -221,6 +224,10 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac
|
||||
static int search_services = 1;
|
||||
|
||||
static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
gatt_client_service_t service;
|
||||
gatt_client_characteristic_t characteristic;
|
||||
switch(hci_event_packet_get_type(packet)){
|
||||
|
@ -202,6 +202,8 @@ static void continue_remote_names(void){
|
||||
}
|
||||
|
||||
static void inquiry_packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||
UNUSED(size);
|
||||
|
||||
bd_addr_t addr;
|
||||
int i;
|
||||
int numResponses;
|
||||
@ -329,6 +331,9 @@ static void show_usage(void){
|
||||
}
|
||||
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
UNUSED(ds);
|
||||
UNUSED(callback_type);
|
||||
|
||||
cmd = btstack_stdin_read();
|
||||
switch (cmd){
|
||||
case 'a':
|
||||
@ -549,6 +554,8 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
|
||||
#endif
|
||||
|
||||
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t event_size){
|
||||
UNUSED(channel);
|
||||
|
||||
switch (packet_type){
|
||||
case HCI_EVENT_PACKET:
|
||||
switch (event[0]){
|
||||
@ -678,6 +685,8 @@ static hfp_phone_number_t subscriber_number = {
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
sco_demo_init();
|
||||
|
||||
|
@ -152,6 +152,8 @@ static void show_usage(void){
|
||||
}
|
||||
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
UNUSED(ds);
|
||||
UNUSED(callback_type);
|
||||
|
||||
cmd = btstack_stdin_read();
|
||||
|
||||
@ -433,7 +435,8 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
|
||||
#endif
|
||||
|
||||
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t event_size){
|
||||
|
||||
UNUSED(channel);
|
||||
|
||||
switch (packet_type){
|
||||
|
||||
case HCI_SCO_DATA_PACKET:
|
||||
@ -552,6 +555,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
/* LISTING_START(MainConfiguration): Setup HFP Hands-Free unit */
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
sco_demo_init();
|
||||
|
||||
|
@ -121,6 +121,8 @@ static void show_usage(void){
|
||||
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
UNUSED(ds);
|
||||
UNUSED(callback_type);
|
||||
|
||||
char buffer = btstack_stdin_read();
|
||||
|
||||
@ -178,6 +180,7 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
|
||||
#endif
|
||||
|
||||
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t event_size){
|
||||
UNUSED(channel);
|
||||
|
||||
switch (packet_type){
|
||||
|
||||
@ -273,6 +276,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
/* LISTING_START(MainConfiguration): Setup HSP Audio Gateway */
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
sco_demo_init();
|
||||
|
||||
|
@ -121,6 +121,8 @@ static void show_usage(void){
|
||||
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
UNUSED(ds);
|
||||
UNUSED(callback_type);
|
||||
|
||||
char buffer = btstack_stdin_read();
|
||||
|
||||
@ -178,6 +180,8 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
|
||||
#endif
|
||||
|
||||
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t event_size){
|
||||
UNUSED(channel);
|
||||
|
||||
switch (packet_type){
|
||||
case HCI_SCO_DATA_PACKET:
|
||||
sco_demo_receive(event, event_size);
|
||||
@ -275,6 +279,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
/* LISTING_START(MainConfiguration): Setup HSP Headset */
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
sco_demo_init();
|
||||
|
||||
|
@ -176,6 +176,9 @@ static void heartbeat_handler(struct btstack_timer_source *ts){
|
||||
|
||||
/* LISTING_START(packetHandler): Packet Handler */
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
switch (packet_type) {
|
||||
case HCI_EVENT_PACKET:
|
||||
switch (hci_event_packet_get_type(packet)) {
|
||||
@ -207,6 +210,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
// - if buffer != NULL, copy data and return number bytes copied
|
||||
// @param offset defines start of attribute value
|
||||
static uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size){
|
||||
UNUSED(connection_handle);
|
||||
|
||||
if (att_handle == ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_VALUE_HANDLE){
|
||||
if (buffer){
|
||||
memcpy(buffer, &counter_string[offset], buffer_size);
|
||||
@ -230,6 +235,10 @@ static uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t a
|
||||
|
||||
/* LISTING_START(attWrite): ATT Write */
|
||||
static int att_write_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size){
|
||||
UNUSED(transaction_mode);
|
||||
UNUSED(offset);
|
||||
UNUSED(buffer_size);
|
||||
|
||||
if (att_handle != ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_CLIENT_CONFIGURATION_HANDLE) return 0;
|
||||
le_notification_enabled = little_endian_read_16(buffer, 0) == GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION;
|
||||
con_handle = connection_handle;
|
||||
|
@ -135,7 +135,7 @@ static void test_reset(void){
|
||||
}
|
||||
|
||||
static void test_track_sent(int bytes_sent){
|
||||
test_data_sent += test_data_len;
|
||||
test_data_sent += bytes_sent;
|
||||
// evaluate
|
||||
uint32_t now = btstack_run_loop_get_time_ms();
|
||||
uint32_t time_passed = now - test_data_start;
|
||||
@ -160,6 +160,9 @@ static void test_track_sent(int bytes_sent){
|
||||
|
||||
/* LISTING_START(packetHandler): Packet Handler */
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
int mtu;
|
||||
switch (packet_type) {
|
||||
case HCI_EVENT_PACKET:
|
||||
@ -229,6 +232,9 @@ static void streamer(void){
|
||||
|
||||
/* LISTING_START(attWrite): ATT Write */
|
||||
static int att_write_callback(hci_con_handle_t con_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size){
|
||||
UNUSED(con_handle);
|
||||
UNUSED(offset);
|
||||
|
||||
// printf("att_write_callback att_handle %04x, transaction mode %u\n", att_handle, transaction_mode);
|
||||
if (transaction_mode != ATT_TRANSACTION_MODE_NONE) return 0;
|
||||
switch(att_handle){
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "btstack_run_loop.h"
|
||||
#include "btstack_defines.h"
|
||||
#include "hal_led.h"
|
||||
|
||||
#define HEARTBEAT_PERIOD_MS 1000
|
||||
@ -65,7 +66,9 @@ static btstack_timer_source_t heartbeat;
|
||||
*/
|
||||
|
||||
/* LISTING_START(LEDToggler): Periodic counter */
|
||||
static void heartbeat_handler(btstack_timer_source_t *ts){
|
||||
static void heartbeat_handler(btstack_timer_source_t *ts){
|
||||
UNUSED(ts);
|
||||
|
||||
// increment counter
|
||||
char lineBuffer[30];
|
||||
sprintf(lineBuffer, "BTstack counter %04u\n\r", ++counter);
|
||||
@ -89,6 +92,8 @@ static void heartbeat_handler(btstack_timer_source_t *ts){
|
||||
/* LISTING_START(MainConfiguration): Setup heartbeat timer */
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
// set one-shot timer
|
||||
heartbeat.process = &heartbeat_handler;
|
||||
|
@ -208,6 +208,9 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
|
||||
#endif
|
||||
|
||||
static void handle_pcm_data(int16_t * data, int num_samples, int num_channels, int sample_rate, void * context){
|
||||
UNUSED(context);
|
||||
UNUSED(sample_rate);
|
||||
|
||||
// printf("handle_pcm_data num samples %u, sample rate %d\n", num_samples, num_channels);
|
||||
#ifdef USE_PORTAUDIO
|
||||
if (!pa_stream_started && btstack_ring_buffer_bytes_available(&ring_buffer) >= MSBC_PREBUFFER_BYTES){
|
||||
@ -221,6 +224,8 @@ static void handle_pcm_data(int16_t * data, int num_samples, int num_channels, i
|
||||
}
|
||||
btstack_ring_buffer_write(&ring_buffer, (uint8_t *)data, num_samples*num_channels*2);
|
||||
// printf("bytes avail after write: %d\n", btstack_ring_buffer_bytes_available(&ring_buffer));
|
||||
#else
|
||||
UNUSED(num_channels);
|
||||
#endif
|
||||
|
||||
if (!num_samples_to_write) return;
|
||||
|
@ -112,6 +112,9 @@ static void sdp_client_init(void){
|
||||
|
||||
/* LISTING_START(SDPQueryUUID): Querying the a list of service records on a remote device. */
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
uint8_t event = hci_event_packet_get_type(packet);
|
||||
|
||||
@ -161,6 +164,10 @@ static char * get_string_from_data_element(uint8_t * element){
|
||||
|
||||
/* LISTING_START(HandleSDPQUeryResult): Extracting BNEP Protcol UUID and L2CAP PSM */
|
||||
static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
/* LISTING_PAUSE */
|
||||
des_iterator_t des_list_it;
|
||||
des_iterator_t prot_it;
|
||||
@ -266,6 +273,9 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
printf("Client HCI init done\r\n");
|
||||
|
||||
sdp_client_init();
|
||||
|
@ -107,6 +107,9 @@ static bd_addr_t remote = {0x04,0x0C,0xCE,0xE4,0x85,0xD3};
|
||||
|
||||
/* LISTING_START(SDPQueryUUID): Querying a list of service records on a remote device. */
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
uint8_t event = hci_event_packet_get_type(packet);
|
||||
|
||||
@ -144,6 +147,10 @@ static void assertBuffer(int size){
|
||||
|
||||
/* LISTING_START(HandleSDPQUeryResult): Handling query result chunks. */
|
||||
static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
switch (packet[0]){
|
||||
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
|
||||
// handle new record
|
||||
@ -170,7 +177,9 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
printf("Client HCI init done\r\n");
|
||||
|
||||
sdp_client_init();
|
||||
|
@ -71,6 +71,9 @@ static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
|
||||
|
||||
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
uint8_t event = hci_event_packet_get_type(packet);
|
||||
|
||||
@ -110,6 +113,10 @@ static void report_found_services(void){
|
||||
}
|
||||
|
||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
switch (packet[0]){
|
||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||
store_found_service(sdp_event_query_rfcomm_service_get_name(packet),
|
||||
@ -124,6 +131,9 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uin
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
printf("Client HCI init done\r\n");
|
||||
|
||||
// register for HCI events
|
||||
|
@ -129,6 +129,9 @@ static void sm_pairing_central_setup(void){
|
||||
/* LISTING_START(GAPLEAdvPacketHandler): Scanning and receiving advertisements */
|
||||
|
||||
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
hci_con_handle_t con_handle;
|
||||
|
||||
|
@ -147,6 +147,9 @@ static void sm_peripheral_setup(void){
|
||||
|
||||
/* LISTING_START(packetHandler): Packet Handler */
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
bd_addr_t addr;
|
||||
switch (packet_type) {
|
||||
case HCI_EVENT_PACKET:
|
||||
|
@ -99,6 +99,8 @@ uint8_t adv_data_len = sizeof(adv_data);
|
||||
*/
|
||||
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
|
||||
bd_addr_t event_addr;
|
||||
uint8_t rfcomm_channel_nr;
|
||||
uint16_t mtu;
|
||||
@ -180,6 +182,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
// - if buffer != NULL, copy data and return number bytes copied
|
||||
// @param offset defines start of attribute value
|
||||
static uint16_t att_read_callback(hci_con_handle_t con_handle, uint16_t att_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size){
|
||||
UNUSED(con_handle);
|
||||
|
||||
if (att_handle == ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_VALUE_HANDLE){
|
||||
if (buffer){
|
||||
memcpy(buffer, &counter_string[offset], buffer_size);
|
||||
|
@ -170,6 +170,8 @@ static void one_shot_timer_setup(void){
|
||||
|
||||
/* LISTING_START(SppServerPacketHandler): SPP Server - Heartbeat Counter over RFCOMM */
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
|
||||
/* LISTING_PAUSE */
|
||||
bd_addr_t event_addr;
|
||||
uint8_t rfcomm_channel_nr;
|
||||
@ -244,6 +246,9 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
one_shot_timer_setup();
|
||||
spp_service_setup();
|
||||
|
||||
|
@ -107,7 +107,7 @@ static void test_reset(void){
|
||||
}
|
||||
|
||||
static void test_track_sent(int bytes_sent){
|
||||
test_data_sent += test_data_len;
|
||||
test_data_sent += bytes_sent;
|
||||
// evaluate
|
||||
uint32_t now = btstack_run_loop_get_time_ms();
|
||||
uint32_t time_passed = now - test_data_start;
|
||||
@ -150,6 +150,9 @@ static void send_packet(void){
|
||||
}
|
||||
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
uint8_t event = hci_event_packet_get_type(packet);
|
||||
switch (event) {
|
||||
@ -204,6 +207,10 @@ static void handle_found_service(const char * name, uint8_t port){
|
||||
}
|
||||
|
||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
switch (packet[0]){
|
||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||
handle_found_service(sdp_event_query_rfcomm_service_get_name(packet),
|
||||
@ -226,6 +233,8 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uin
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
create_test_data();
|
||||
|
||||
|
@ -470,6 +470,10 @@ static void handle_completed_transfer(struct libusb_transfer *transfer){
|
||||
}
|
||||
|
||||
static void usb_process_ds(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type) {
|
||||
|
||||
UNUSED(ds);
|
||||
UNUSED(callback_type);
|
||||
|
||||
if (libusb_state != LIB_USB_TRANSFERS_ALLOCATED) return;
|
||||
|
||||
// log_info("begin usb_process_ds");
|
||||
@ -497,6 +501,9 @@ static void usb_process_ds(btstack_data_source_t *ds, btstack_data_source_callba
|
||||
}
|
||||
|
||||
static void usb_process_ts(btstack_timer_source_t *timer) {
|
||||
|
||||
UNUSED(timer);
|
||||
|
||||
// log_info("in usb_process_ts");
|
||||
|
||||
// timer is deactive, when timer callback gets called
|
||||
@ -1171,6 +1178,9 @@ static void usb_register_packet_handler(void (*handler)(uint8_t packet_type, uin
|
||||
}
|
||||
|
||||
static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(packet);
|
||||
UNUSED(size);
|
||||
}
|
||||
|
||||
// get usb singleton
|
||||
|
@ -8,7 +8,7 @@ COMMON += hci_transport_h2_libusb.c btstack_run_loop_posix.c le_device_db_fs.c
|
||||
include ${BTSTACK_ROOT}/example/Makefile.inc
|
||||
|
||||
# CC = gcc-fsf-4.9
|
||||
CFLAGS += -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Werror
|
||||
CFLAGS += -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Werror -Wunused-parameter
|
||||
# CFLAGS += -Werror
|
||||
|
||||
CFLAGS += -I${BTSTACK_ROOT}/platform/posix \
|
||||
|
@ -65,6 +65,8 @@ int btstack_main(int argc, const char * argv[]);
|
||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
if (hci_event_packet_get_type(packet) != BTSTACK_EVENT_STATE) return;
|
||||
if (btstack_event_state_get_state(packet) != HCI_STATE_WORKING) return;
|
||||
@ -72,7 +74,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
}
|
||||
|
||||
static void sigint_handler(int param){
|
||||
|
||||
UNUSED(param);
|
||||
|
||||
#ifndef _WIN32
|
||||
// reset anyway
|
||||
btstack_stdin_reset();
|
||||
|
@ -181,6 +181,10 @@ static void ancs_chunk_parser_handle_byte(uint8_t data){
|
||||
|
||||
static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
int connection_encrypted;
|
||||
|
||||
// handle connect / disconncet events first
|
||||
|
@ -323,6 +323,8 @@ static uint8_t att_validate_security(att_connection_t * att_connection, att_iter
|
||||
static uint16_t handle_exchange_mtu_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
|
||||
uint8_t * response_buffer){
|
||||
|
||||
UNUSED(request_len);
|
||||
|
||||
uint16_t client_rx_mtu = little_endian_read_16(request_buffer, 1);
|
||||
|
||||
// find min(local max mtu, remote mtu) and use as mtu for this connection
|
||||
@ -346,6 +348,8 @@ static uint16_t handle_exchange_mtu_request(att_connection_t * att_connection, u
|
||||
static uint16_t handle_find_information_request2(att_connection_t * att_connection, uint8_t * response_buffer, uint16_t response_buffer_size,
|
||||
uint16_t start_handle, uint16_t end_handle){
|
||||
|
||||
UNUSED(att_connection);
|
||||
|
||||
log_info("ATT_FIND_INFORMATION_REQUEST: from %04X to %04X", start_handle, end_handle);
|
||||
uint8_t request_type = ATT_FIND_INFORMATION_REQUEST;
|
||||
|
||||
@ -404,6 +408,7 @@ static uint16_t handle_find_information_request2(att_connection_t * att_connecti
|
||||
|
||||
static uint16_t handle_find_information_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
|
||||
uint8_t * response_buffer, uint16_t response_buffer_size){
|
||||
UNUSED(request_len);
|
||||
return handle_find_information_request2(att_connection, response_buffer, response_buffer_size, little_endian_read_16(request_buffer, 1), little_endian_read_16(request_buffer, 3));
|
||||
}
|
||||
|
||||
@ -423,6 +428,8 @@ static uint16_t handle_find_by_type_value_request2(att_connection_t * att_connec
|
||||
uint16_t start_handle, uint16_t end_handle,
|
||||
uint16_t attribute_type, uint16_t attribute_len, uint8_t* attribute_value){
|
||||
|
||||
UNUSED(att_connection);
|
||||
|
||||
log_info("ATT_FIND_BY_TYPE_VALUE_REQUEST: from %04X to %04X, type %04X, value: ", start_handle, end_handle, attribute_type);
|
||||
log_info_hexdump(attribute_value, attribute_len);
|
||||
uint8_t request_type = ATT_FIND_BY_TYPE_VALUE_REQUEST;
|
||||
@ -635,6 +642,7 @@ static uint16_t handle_read_request2(att_connection_t * att_connection, uint8_t
|
||||
|
||||
static uint16_t handle_read_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
|
||||
uint8_t * response_buffer, uint16_t response_buffer_size){
|
||||
UNUSED(request_len);
|
||||
return handle_read_request2(att_connection, response_buffer, response_buffer_size, little_endian_read_16(request_buffer, 1));
|
||||
}
|
||||
|
||||
@ -684,6 +692,7 @@ static uint16_t handle_read_blob_request2(att_connection_t * att_connection, uin
|
||||
|
||||
static uint16_t handle_read_blob_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
|
||||
uint8_t * response_buffer, uint16_t response_buffer_size){
|
||||
UNUSED(request_len);
|
||||
return handle_read_blob_request2(att_connection, response_buffer, response_buffer_size, little_endian_read_16(request_buffer, 1), little_endian_read_16(request_buffer, 3));
|
||||
}
|
||||
|
||||
@ -773,6 +782,8 @@ static uint16_t handle_read_by_group_type_request2(att_connection_t * att_connec
|
||||
uint16_t start_handle, uint16_t end_handle,
|
||||
uint16_t attribute_type_len, uint8_t * attribute_type){
|
||||
|
||||
UNUSED(att_connection);
|
||||
|
||||
log_info("ATT_READ_BY_GROUP_TYPE_REQUEST: from %04X to %04X, buffer size %u, type: ", start_handle, end_handle, response_buffer_size);
|
||||
log_info_hexdump(attribute_type, attribute_type_len);
|
||||
uint8_t request_type = ATT_READ_BY_GROUP_TYPE_REQUEST;
|
||||
@ -876,6 +887,8 @@ static uint16_t handle_read_by_group_type_request(att_connection_t * att_connect
|
||||
static uint16_t handle_write_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
|
||||
uint8_t * response_buffer, uint16_t response_buffer_size){
|
||||
|
||||
UNUSED(response_buffer_size);
|
||||
|
||||
uint8_t request_type = ATT_WRITE_REQUEST;
|
||||
|
||||
uint16_t handle = little_endian_read_16(request_buffer, 1);
|
||||
@ -912,6 +925,8 @@ static uint16_t handle_write_request(att_connection_t * att_connection, uint8_t
|
||||
static uint16_t handle_prepare_write_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
|
||||
uint8_t * response_buffer, uint16_t response_buffer_size){
|
||||
|
||||
UNUSED(response_buffer_size);
|
||||
|
||||
uint8_t request_type = ATT_PREPARE_WRITE_REQUEST;
|
||||
|
||||
uint16_t handle = little_endian_read_16(request_buffer, 1);
|
||||
@ -981,6 +996,9 @@ void att_clear_transaction_queue(att_connection_t * att_connection){
|
||||
static uint16_t handle_execute_write_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
|
||||
uint8_t * response_buffer, uint16_t response_buffer_size){
|
||||
|
||||
UNUSED(request_len);
|
||||
UNUSED(response_buffer_size);
|
||||
|
||||
uint8_t request_type = ATT_EXECUTE_WRITE_REQUEST;
|
||||
if (request_buffer[1]) {
|
||||
// deliver queued errors
|
||||
@ -1005,6 +1023,9 @@ static uint16_t handle_execute_write_request(att_connection_t * att_connection,
|
||||
static void handle_write_command(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
|
||||
uint8_t * response_buffer, uint16_t response_buffer_size){
|
||||
|
||||
UNUSED(response_buffer);
|
||||
UNUSED(response_buffer_size);
|
||||
|
||||
uint16_t handle = little_endian_read_16(request_buffer, 1);
|
||||
att_write_callback_t callback = att_write_callback_for_handle(handle);
|
||||
if (!callback) return;
|
||||
|
@ -132,6 +132,9 @@ static void att_handle_value_indication_timeout(btstack_timer_source_t *ts){
|
||||
}
|
||||
|
||||
static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
att_server_t * att_server;
|
||||
hci_con_handle_t con_handle;
|
||||
|
@ -60,6 +60,9 @@ static uint16_t battery_value_handle_client_configuration;
|
||||
|
||||
|
||||
static uint16_t battery_service_read_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size){
|
||||
UNUSED(offset);
|
||||
UNUSED(buffer_size);
|
||||
|
||||
if (attribute_handle == battery_value_handle_value){
|
||||
if (buffer) {
|
||||
buffer[0] = battery_value;
|
||||
@ -77,6 +80,11 @@ static uint16_t battery_service_read_callback(hci_con_handle_t con_handle, uint1
|
||||
}
|
||||
|
||||
static int battery_service_write_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size){
|
||||
UNUSED(con_handle);
|
||||
UNUSED(transaction_mode);
|
||||
UNUSED(offset);
|
||||
UNUSED(buffer_size);
|
||||
|
||||
if (attribute_handle == battery_value_handle_client_configuration){
|
||||
battery_value_client_configuration = little_endian_read_16(buffer, 0);
|
||||
}
|
||||
|
@ -682,6 +682,7 @@ static void report_gatt_long_characteristic_value_blob(gatt_client_t * periphera
|
||||
}
|
||||
|
||||
static void report_gatt_characteristic_descriptor(gatt_client_t * peripheral, uint16_t descriptor_handle, uint8_t *value, uint16_t value_length, uint16_t value_offset){
|
||||
UNUSED(value_offset);
|
||||
uint8_t * packet = setup_characteristic_value_packet(GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT, peripheral->con_handle, descriptor_handle, value, value_length);
|
||||
emit_event_new(peripheral->callback, packet, value_length + 8);
|
||||
}
|
||||
@ -996,6 +997,9 @@ static void gatt_client_report_error_if_pending(gatt_client_t *peripheral, uint8
|
||||
}
|
||||
|
||||
static void gatt_client_hci_event_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
|
||||
switch (hci_event_packet_get_type(packet)) {
|
||||
|
11
src/ble/sm.c
11
src/ble/sm.c
@ -454,6 +454,8 @@ static void gap_random_address_trigger(void){
|
||||
}
|
||||
|
||||
static void gap_random_address_update_handler(btstack_timer_source_t * timer){
|
||||
UNUSED(timer);
|
||||
|
||||
log_info("GAP Random Address Update due");
|
||||
btstack_run_loop_set_timer(&gap_random_address_update_timer, gap_random_adress_update_period);
|
||||
btstack_run_loop_add_timer(&gap_random_address_update_timer);
|
||||
@ -667,6 +669,8 @@ static void sm_setup_event_base(uint8_t * event, int event_size, uint8_t type, h
|
||||
}
|
||||
|
||||
static void sm_dispatch_event(uint8_t packet_type, uint16_t channel, uint8_t * packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
|
||||
// log event
|
||||
hci_dump_packet(packet_type, 1, packet, size);
|
||||
// dispatch to all event handlers
|
||||
@ -2706,6 +2710,8 @@ static void sm_handle_encryption_result(uint8_t * data){
|
||||
#ifdef USE_MBEDTLS_FOR_ECDH
|
||||
|
||||
static int sm_generate_f_rng(void * context, unsigned char * buffer, size_t size){
|
||||
UNUSED(context);
|
||||
|
||||
int offset = setup->sm_passkey_bit;
|
||||
log_info("sm_generate_f_rng: size %u - offset %u", (int) size, offset);
|
||||
while (size) {
|
||||
@ -2872,6 +2878,9 @@ static void sm_handle_random_result(uint8_t * data){
|
||||
|
||||
static void sm_event_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
sm_connection_t * sm_conn;
|
||||
hci_con_handle_t con_handle;
|
||||
|
||||
@ -3182,6 +3191,8 @@ static int sm_validate_stk_generation_method(void){
|
||||
|
||||
static void sm_pdu_handler(uint8_t packet_type, hci_con_handle_t con_handle, uint8_t *packet, uint16_t size){
|
||||
|
||||
UNUSED(size);
|
||||
|
||||
if (packet_type == HCI_EVENT_PACKET && packet[0] == L2CAP_EVENT_CAN_SEND_NOW){
|
||||
sm_run();
|
||||
}
|
||||
|
@ -55,7 +55,9 @@
|
||||
#endif
|
||||
|
||||
// Avoid complaints of unused arguments when log levels are disabled.
|
||||
static inline void __log_unused(const char *format, ...) {}
|
||||
static inline void __log_unused(const char *format, ...) {
|
||||
UNUSED(format);
|
||||
}
|
||||
|
||||
// allow to provide port specific printf
|
||||
#ifndef BTSTACK_PRINTF
|
||||
|
@ -1170,6 +1170,8 @@ static int bnep_handle_control_packet(bnep_channel_t *channel, uint8_t *packet,
|
||||
*/
|
||||
static int bnep_hci_event_handler(uint8_t *packet, uint16_t size)
|
||||
{
|
||||
UNUSED(size);
|
||||
|
||||
bd_addr_t event_addr;
|
||||
uint16_t psm;
|
||||
uint16_t l2cap_cid;
|
||||
|
@ -54,6 +54,7 @@ static void db_open(void){
|
||||
}
|
||||
|
||||
static void db_set_local_bd_addr(bd_addr_t bd_addr){
|
||||
(void)bd_addr;
|
||||
}
|
||||
|
||||
static void db_close(void){
|
||||
|
@ -503,6 +503,8 @@ void btstack_sbc_decoder_process_data(btstack_sbc_decoder_state_t * state, int p
|
||||
void btstack_sbc_encoder_init(btstack_sbc_encoder_state_t * state, btstack_sbc_mode_t mode,
|
||||
int blocks, int subbands, int allmethod, int sample_rate, int bitpool){
|
||||
|
||||
UNUSED(bitpool);
|
||||
|
||||
if (sbc_encoder_state_singleton && sbc_encoder_state_singleton != state ){
|
||||
log_error("SBC encoder: different sbc decoder state is allready registered");
|
||||
}
|
||||
|
@ -455,6 +455,10 @@ void hfp_create_sdp_record(uint8_t * service, uint32_t service_record_handle, ui
|
||||
static hfp_connection_t * connection_doing_sdp_query = NULL;
|
||||
|
||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
hfp_connection_t * hfp_connection = connection_doing_sdp_query;
|
||||
|
||||
if ( hfp_connection->state != HFP_W4_SDP_QUERY_COMPLETE) return;
|
||||
@ -528,6 +532,8 @@ static void hfp_handle_failed_sco_connection(uint8_t status){
|
||||
|
||||
|
||||
void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
|
||||
bd_addr_t event_addr;
|
||||
uint16_t rfcomm_cid, handle;
|
||||
hfp_connection_t * hfp_connection = NULL;
|
||||
|
@ -436,6 +436,8 @@ static int hfp_ag_retrieve_indicators_status_cmd(uint16_t cid){
|
||||
}
|
||||
|
||||
static int hfp_ag_set_indicator_status_update_cmd(uint16_t cid, uint8_t activate){
|
||||
UNUSED(activate);
|
||||
|
||||
// AT\r\n%s:3,0,0,%d\r\n
|
||||
return hfp_ag_ok(cid);
|
||||
}
|
||||
@ -1815,6 +1817,8 @@ static hfp_generic_status_indicator_t *get_hf_indicator_by_number(int number){
|
||||
}
|
||||
|
||||
static void hfp_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
|
||||
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_rfcomm_cid(channel);
|
||||
if (!hfp_connection) return;
|
||||
|
||||
|
@ -982,6 +982,8 @@ static void hfp_hf_switch_on_ok(hfp_connection_t *hfp_connection){
|
||||
|
||||
|
||||
static void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
|
||||
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_rfcomm_cid(channel);
|
||||
if (!hfp_connection) return;
|
||||
|
||||
|
@ -131,7 +131,12 @@ static void hsp_run(void);
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
||||
|
||||
static void dummy_notify(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t size){}
|
||||
static void dummy_notify(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(event);
|
||||
UNUSED(size);
|
||||
}
|
||||
|
||||
void hsp_ag_register_packet_handler(btstack_packet_handler_t callback){
|
||||
if (callback == NULL){
|
||||
@ -344,6 +349,8 @@ void hsp_ag_set_speaker_gain(uint8_t gain){
|
||||
}
|
||||
|
||||
static void hsp_ringing_timeout_handler(btstack_timer_source_t * timer){
|
||||
UNUSED(timer);
|
||||
|
||||
ag_ring = 1;
|
||||
btstack_run_loop_set_timer(&hs_timeout, 2000); // 2 seconds timeout
|
||||
btstack_run_loop_add_timer(&hs_timeout);
|
||||
@ -531,6 +538,8 @@ static void hsp_run(void){
|
||||
|
||||
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
|
||||
if (packet_type == RFCOMM_DATA_PACKET){
|
||||
while (size > 0 && (packet[0] == '\n' || packet[0] == '\r')){
|
||||
size--;
|
||||
@ -696,6 +705,10 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
}
|
||||
|
||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
switch (packet[0]){
|
||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||
channel_nr = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet);
|
||||
|
@ -124,7 +124,12 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
||||
|
||||
static btstack_packet_handler_t hsp_hs_callback;
|
||||
static void dummy_notify(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t size){}
|
||||
static void dummy_notify(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(event);
|
||||
UNUSED(size);
|
||||
}
|
||||
|
||||
void hsp_hs_register_packet_handler(btstack_packet_handler_t callback){
|
||||
if (callback == NULL){
|
||||
@ -442,6 +447,8 @@ static void hsp_run(void){
|
||||
|
||||
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
|
||||
// printf("packet_handler type %u, packet[0] %x\n", packet_type, packet[0]);
|
||||
if (packet_type == RFCOMM_DATA_PACKET){
|
||||
// skip over leading newline
|
||||
@ -598,6 +605,10 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
}
|
||||
|
||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
|
||||
switch (hci_event_packet_get_type(packet)){
|
||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||
channel_nr = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet);
|
||||
|
@ -909,6 +909,8 @@ static void rfcomm_multiplexer_set_state_and_request_can_send_now_event(rfcomm_m
|
||||
* @return handled packet
|
||||
*/
|
||||
static int rfcomm_hci_event_handler(uint8_t *packet, uint16_t size){
|
||||
UNUSED(size);
|
||||
|
||||
bd_addr_t event_addr;
|
||||
uint16_t psm;
|
||||
uint16_t l2cap_cid;
|
||||
@ -1038,6 +1040,7 @@ static int rfcomm_hci_event_handler(uint8_t *packet, uint16_t size){
|
||||
}
|
||||
|
||||
static int rfcomm_multiplexer_l2cap_packet_handler(uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(size);
|
||||
|
||||
// get or create a multiplexer for a certain device
|
||||
rfcomm_multiplexer_t *multiplexer = rfcomm_multiplexer_for_l2cap_cid(channel);
|
||||
@ -1403,7 +1406,8 @@ static void rfcomm_channel_state_machine_with_dlci(rfcomm_multiplexer_t * multip
|
||||
}
|
||||
|
||||
static void rfcomm_channel_packet_handler(rfcomm_multiplexer_t * multiplexer, uint8_t *packet, uint16_t size){
|
||||
|
||||
UNUSED(size);
|
||||
|
||||
// rfcomm: (0) addr [76543 server channel] [2 direction: initiator uses 1] [1 C/R: CMD by initiator = 1] [0 EA=1]
|
||||
const uint8_t frame_dlci = packet[0] >> 2;
|
||||
uint8_t message_dlci; // used by commands in UIH(_PF) packets
|
||||
|
@ -385,6 +385,8 @@ static void sdp_client_parse_service_search_attribute_response(uint8_t* packet){
|
||||
}
|
||||
|
||||
void sdp_client_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(size);
|
||||
|
||||
// uint16_t handle;
|
||||
if (packet_type == L2CAP_DATA_PACKET){
|
||||
uint16_t responseTransactionID = big_endian_read_16(packet,1);
|
||||
|
@ -100,6 +100,8 @@ static void sdp_rfcomm_query_emit_service(void){
|
||||
}
|
||||
|
||||
static void sdp_client_query_rfcomm_handle_protocol_descriptor_list_data(uint32_t attribute_value_length, uint32_t data_offset, uint8_t data){
|
||||
UNUSED(attribute_value_length);
|
||||
|
||||
// init state on first byte
|
||||
if (data_offset == 0){
|
||||
pdl_state = GET_PROTOCOL_LIST_LENGTH;
|
||||
@ -241,6 +243,9 @@ static void sdp_client_query_rfcomm_handle_service_name_data(uint32_t attribute_
|
||||
}
|
||||
|
||||
static void sdp_client_query_rfcomm_handle_sdp_parser_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
|
||||
switch (hci_event_packet_get_type(packet)){
|
||||
case SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE:
|
||||
// handle service without a name
|
||||
|
@ -448,6 +448,8 @@ static void sdp_respond(void){
|
||||
|
||||
// we assume that we don't get two requests in a row
|
||||
static void sdp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(size);
|
||||
|
||||
uint16_t transaction_id;
|
||||
SDP_PDU_ID_t pdu_id;
|
||||
uint16_t remote_mtu;
|
||||
|
@ -371,6 +371,8 @@ struct sdp_context_append_attributes {
|
||||
};
|
||||
|
||||
static int sdp_traversal_append_attributes(uint16_t attributeID, uint8_t * attributeValue, de_type_t type, de_size_t size, void *my_context){
|
||||
UNUSED(type);
|
||||
UNUSED(size);
|
||||
struct sdp_context_append_attributes * context = (struct sdp_context_append_attributes *) my_context;
|
||||
if (sdp_attribute_list_constains_id(context->attributeIDList, attributeID)) {
|
||||
// DES_HEADER(3) + DES_DATA + (UINT16(3) + attribute)
|
||||
@ -429,6 +431,9 @@ static int spd_append_range(struct sdp_context_filter_attributes* context, uint1
|
||||
}
|
||||
|
||||
static int sdp_traversal_filter_attributes(uint16_t attributeID, uint8_t * attributeValue, de_type_t type, de_size_t size, void *my_context){
|
||||
UNUSED(type);
|
||||
UNUSED(size);
|
||||
|
||||
struct sdp_context_filter_attributes * context = (struct sdp_context_filter_attributes *) my_context;
|
||||
|
||||
if (!sdp_attribute_list_constains_id(context->attributeIDList, attributeID)) return 0;
|
||||
@ -488,6 +493,9 @@ struct sdp_context_get_filtered_size {
|
||||
};
|
||||
|
||||
static int sdp_traversal_get_filtered_size(uint16_t attributeID, uint8_t * attributeValue, de_type_t type, de_size_t size, void *my_context){
|
||||
UNUSED(type);
|
||||
UNUSED(size);
|
||||
|
||||
struct sdp_context_get_filtered_size * context = (struct sdp_context_get_filtered_size *) my_context;
|
||||
if (sdp_attribute_list_constains_id(context->attributeIDList, attributeID)) {
|
||||
context->size += 3 + de_get_len(attributeValue);
|
||||
@ -510,6 +518,9 @@ struct sdp_context_attribute_by_id {
|
||||
uint8_t * attributeValue;
|
||||
};
|
||||
static int sdp_traversal_attribute_by_id(uint16_t attributeID, uint8_t * attributeValue, de_type_t attributeType, de_size_t size, void *my_context){
|
||||
UNUSED(attributeType);
|
||||
UNUSED(size);
|
||||
|
||||
struct sdp_context_attribute_by_id * context = (struct sdp_context_attribute_by_id *) my_context;
|
||||
if (attributeID == context->attributeID) {
|
||||
context->attributeValue = attributeValue;
|
||||
@ -574,6 +585,8 @@ struct sdp_context_contains_uuid128 {
|
||||
};
|
||||
int sdp_record_contains_UUID128(uint8_t *record, uint8_t *uuid128);
|
||||
static int sdp_traversal_contains_UUID128(uint8_t * element, de_type_t type, de_size_t size, void *my_context){
|
||||
UNUSED(size);
|
||||
|
||||
struct sdp_context_contains_uuid128 * context = (struct sdp_context_contains_uuid128 *) my_context;
|
||||
uint8_t normalizedUUID[16];
|
||||
if (type == DE_UUID){
|
||||
@ -602,6 +615,9 @@ struct sdp_context_match_pattern {
|
||||
};
|
||||
|
||||
int sdp_traversal_match_pattern(uint8_t * element, de_type_t attributeType, de_size_t size, void *my_context){
|
||||
UNUSED(attributeType);
|
||||
UNUSED(size);
|
||||
|
||||
struct sdp_context_match_pattern * context = (struct sdp_context_match_pattern *) my_context;
|
||||
uint8_t normalizedUUID[16];
|
||||
uint8_t uuidOK = de_get_normalized_uuid(normalizedUUID, element);
|
||||
|
@ -859,6 +859,9 @@ void gap_advertisements_get_address(uint8_t * addr_type, bd_addr_t addr){
|
||||
|
||||
#ifdef ENABLE_BLE
|
||||
void le_handle_advertisement_report(uint8_t *packet, int size){
|
||||
|
||||
UNUSED(size);
|
||||
|
||||
int offset = 3;
|
||||
int num_reports = packet[offset];
|
||||
offset += 1;
|
||||
@ -896,6 +899,8 @@ static uint32_t hci_transport_uart_get_main_baud_rate(void){
|
||||
}
|
||||
|
||||
static void hci_initialization_timeout_handler(btstack_timer_source_t * ds){
|
||||
UNUSED(ds);
|
||||
|
||||
switch (hci_stack->substate){
|
||||
case HCI_INIT_W4_SEND_RESET:
|
||||
log_info("Resend HCI Reset");
|
||||
@ -1168,6 +1173,8 @@ static void hci_init_done(void){
|
||||
}
|
||||
|
||||
static void hci_initializing_event_handler(uint8_t * packet, uint16_t size){
|
||||
UNUSED(size);
|
||||
|
||||
uint8_t command_completed = 0;
|
||||
|
||||
if (hci_event_packet_get_type(packet) == HCI_EVENT_COMMAND_COMPLETE){
|
||||
|
12
src/l2cap.c
12
src/l2cap.c
@ -197,6 +197,8 @@ void l2cap_register_packet_handler(void (*handler)(uint8_t packet_type, uint16_t
|
||||
}
|
||||
|
||||
void l2cap_request_can_send_fix_channel_now_event(hci_con_handle_t con_handle, uint16_t channel_id){
|
||||
UNUSED(con_handle);
|
||||
|
||||
int index = l2cap_fixed_channel_table_index_for_channel_id(channel_id);
|
||||
if (index < 0) return;
|
||||
fixed_channels[index].waiting_for_can_send_now = 1;
|
||||
@ -204,6 +206,8 @@ void l2cap_request_can_send_fix_channel_now_event(hci_con_handle_t con_handle, u
|
||||
}
|
||||
|
||||
int l2cap_can_send_fixed_channel_packet_now(hci_con_handle_t con_handle, uint16_t channel_id){
|
||||
UNUSED(channel_id);
|
||||
|
||||
return hci_can_send_acl_packet_now(con_handle);
|
||||
}
|
||||
|
||||
@ -1070,6 +1074,10 @@ static void l2cap_notify_channel_can_send(void){
|
||||
}
|
||||
|
||||
static void l2cap_hci_event_handler(uint8_t packet_type, uint16_t cid, uint8_t *packet, uint16_t size){
|
||||
|
||||
UNUSED(packet_type);
|
||||
UNUSED(cid);
|
||||
UNUSED(size);
|
||||
|
||||
bd_addr_t address;
|
||||
hci_con_handle_t handle;
|
||||
@ -1842,7 +1850,9 @@ static int l2cap_le_signaling_handler_dispatch(hci_con_handle_t handle, uint8_t
|
||||
#endif
|
||||
|
||||
static void l2cap_acl_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size ){
|
||||
|
||||
UNUSED(packet_type);
|
||||
UNUSED(channel);
|
||||
|
||||
l2cap_channel_t * l2cap_channel;
|
||||
UNUSED(l2cap_channel);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user