panu_demo.c (84693d68c6491dc7d373104b704ec75cb7749221) panu_demo.c (a4fe6467953bdb173fdf96a604f6527ed88f81c3)
1/*
2 * Copyright (C) 2014 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

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

90
91/* LISTING_START(PanuSetup): Panu setup */
92static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
93static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
94static void network_send_packet_callback(const uint8_t * packet, uint16_t size);
95
96static void panu_setup(void){
97
1/*
2 * Copyright (C) 2014 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

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

90
91/* LISTING_START(PanuSetup): Panu setup */
92static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
93static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
94static void network_send_packet_callback(const uint8_t * packet, uint16_t size);
95
96static void panu_setup(void){
97
98 // register for HCI events
99 hci_event_callback_registration.callback = &packet_handler;
100 hci_add_event_handler(&hci_event_callback_registration);
101
102 // Initialize L2CAP
103 l2cap_init();
104
105 // Initialise BNEP
106 bnep_init();
107
108 // Minimum L2CAP MTU for bnep is 1691 bytes
109 bnep_register_service(packet_handler, BLUETOOTH_SERVICE_CLASS_PANU, 1691);
110
111 // Initialize network interface
112 btstack_network_init(&network_send_packet_callback);
98 // Initialize L2CAP
99 l2cap_init();
100
101 // Initialise BNEP
102 bnep_init();
103
104 // Minimum L2CAP MTU for bnep is 1691 bytes
105 bnep_register_service(packet_handler, BLUETOOTH_SERVICE_CLASS_PANU, 1691);
106
107 // Initialize network interface
108 btstack_network_init(&network_send_packet_callback);
109
110 // register for HCI events
111 hci_event_callback_registration.callback = &packet_handler;
112 hci_add_event_handler(&hci_event_callback_registration);
113}
114/* LISTING_END */
115
116// PANU client routines
117static char * get_string_from_data_element(uint8_t * element){
118 de_size_t de_size = de_get_size_type(element);
119 int pos = de_get_header_size(element);
120 int len = 0;

--- 296 unchanged lines hidden ---
113}
114/* LISTING_END */
115
116// PANU client routines
117static char * get_string_from_data_element(uint8_t * element){
118 de_size_t de_size = de_get_size_type(element);
119 int pos = de_get_header_size(element);
120 int len = 0;

--- 296 unchanged lines hidden ---