spp_streamer.c (58d7a529a0f0016607f916c1c6bd81e6dfe94a19) spp_streamer.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

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

246
247
248/* LISTING_START(MainConfiguration): Init L2CAP RFCOMM SDP SPP */
249int btstack_main(int argc, const char * argv[])
250{
251 (void)argc;
252 (void)argv;
253
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

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

246
247
248/* LISTING_START(MainConfiguration): Init L2CAP RFCOMM SDP SPP */
249int btstack_main(int argc, const char * argv[])
250{
251 (void)argc;
252 (void)argv;
253
254 // register for HCI events
255 hci_event_callback_registration.callback = &packet_handler;
256 hci_add_event_handler(&hci_event_callback_registration);
257
258 l2cap_init();
259
260 rfcomm_init();
261 rfcomm_register_service(packet_handler, RFCOMM_SERVER_CHANNEL, 0xffff);
262
263 // init SDP, create record for SPP and register with SDP
264 sdp_init();
265 memset(spp_service_buffer, 0, sizeof(spp_service_buffer));
266 spp_create_sdp_record(spp_service_buffer, 0x10001, RFCOMM_SERVER_CHANNEL, "SPP Streamer");
267 sdp_register_service(spp_service_buffer);
268 // printf("SDP service record size: %u\n", de_get_len(spp_service_buffer));
269
254 l2cap_init();
255
256 rfcomm_init();
257 rfcomm_register_service(packet_handler, RFCOMM_SERVER_CHANNEL, 0xffff);
258
259 // init SDP, create record for SPP and register with SDP
260 sdp_init();
261 memset(spp_service_buffer, 0, sizeof(spp_service_buffer));
262 spp_create_sdp_record(spp_service_buffer, 0x10001, RFCOMM_SERVER_CHANNEL, "SPP Streamer");
263 sdp_register_service(spp_service_buffer);
264 // printf("SDP service record size: %u\n", de_get_len(spp_service_buffer));
265
266 // register for HCI events
267 hci_event_callback_registration.callback = &packet_handler;
268 hci_add_event_handler(&hci_event_callback_registration);
269
270 // short-cut to find other SPP Streamer
271 gap_set_class_of_device(TEST_COD);
272
273 gap_ssp_set_io_capability(SSP_IO_CAPABILITY_DISPLAY_YES_NO);
274 gap_set_local_name("SPP Streamer 00:00:00:00:00:00");
275 gap_discoverable_control(1);
276
277 spp_create_test_data();
278
279 // turn on!
280 hci_power_control(HCI_POWER_ON);
281
282 return 0;
283}
284/* LISTING_END */
285/* EXAMPLE_END */
270 // short-cut to find other SPP Streamer
271 gap_set_class_of_device(TEST_COD);
272
273 gap_ssp_set_io_capability(SSP_IO_CAPABILITY_DISPLAY_YES_NO);
274 gap_set_local_name("SPP Streamer 00:00:00:00:00:00");
275 gap_discoverable_control(1);
276
277 spp_create_test_data();
278
279 // turn on!
280 hci_power_control(HCI_POWER_ON);
281
282 return 0;
283}
284/* LISTING_END */
285/* EXAMPLE_END */