ant_test.c (95c72533b4bc9186bda51341ba575bef06666f9a) | ant_test.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 --- 217 unchanged lines hidden (view full) --- 226 227 btstack_run_loop_set_timer(ts, HEARTBEAT_PERIOD_MS); 228 btstack_run_loop_add_timer(ts); 229} 230 231int btstack_main(int argc, const char * argv[]); 232int btstack_main(int argc, const char * argv[]){ 233 | 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 --- 217 unchanged lines hidden (view full) --- 226 227 btstack_run_loop_set_timer(ts, HEARTBEAT_PERIOD_MS); 228 btstack_run_loop_add_timer(ts); 229} 230 231int btstack_main(int argc, const char * argv[]); 232int btstack_main(int argc, const char * argv[]){ 233 |
234 // register for HCI events 235 hci_event_callback_registration.callback = &packet_handler; 236 hci_add_event_handler(&hci_event_callback_registration); 237 | |
238 // init L2CAP 239 l2cap_init(); 240 241 // init RFCOMM 242 rfcomm_init(); 243 rfcomm_register_service(packet_handler, rfcomm_channel_nr, 100); // reserved channel, mtu=100 244 245 // init SDP, create record for SPP and register with SDP 246 sdp_init(); 247 memset(spp_service_buffer, 0, sizeof(spp_service_buffer)); 248 spp_create_sdp_record(spp_service_buffer, 0x10001, RFCOMM_SERVER_CHANNEL, "SPP Counter"); 249 sdp_register_service(spp_service_buffer); | 234 // init L2CAP 235 l2cap_init(); 236 237 // init RFCOMM 238 rfcomm_init(); 239 rfcomm_register_service(packet_handler, rfcomm_channel_nr, 100); // reserved channel, mtu=100 240 241 // init SDP, create record for SPP and register with SDP 242 sdp_init(); 243 memset(spp_service_buffer, 0, sizeof(spp_service_buffer)); 244 spp_create_sdp_record(spp_service_buffer, 0x10001, RFCOMM_SERVER_CHANNEL, "SPP Counter"); 245 sdp_register_service(spp_service_buffer); |
250 printf("SDP service record size: %u\n", de_get_len(spp_service_buffer)); 251 | 246 247 // register for HCI events 248 hci_event_callback_registration.callback = &packet_handler; 249 hci_add_event_handler(&hci_event_callback_registration); 250 251 // set local name 252 gap_set_local_name("ANT Demo"); 253 // make discoverable 254 gap_discoverable_control(1); 255 |
252 // set one-shot timer 253 heartbeat.process = &heartbeat_handler; 254 btstack_run_loop_set_timer(&heartbeat, HEARTBEAT_PERIOD_MS); 255 btstack_run_loop_add_timer(&heartbeat); | 256 // set one-shot timer 257 heartbeat.process = &heartbeat_handler; 258 btstack_run_loop_set_timer(&heartbeat, HEARTBEAT_PERIOD_MS); 259 btstack_run_loop_add_timer(&heartbeat); |
256 257 // set local name 258 gap_set_local_name("BlueMSP-Demo"); 259 // make discoverable 260 gap_discoverable_control(1); | |
261 262 printf("Run...\n\r"); 263 // turn on! 264 hci_power_control(HCI_POWER_ON); 265 return 0; 266} 267 | 260 261 printf("Run...\n\r"); 262 // turn on! 263 hci_power_control(HCI_POWER_ON); 264 return 0; 265} 266 |