mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 22:20:37 +00:00
fix typo, use log_ macros
This commit is contained in:
parent
7f2435e617
commit
cf0b66f05f
@ -37,7 +37,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#ifdef EMBEEDED
|
||||
#ifdef EMBEDDED
|
||||
|
||||
#define log_dbg(format, ...)
|
||||
#define log_err(format, ...)
|
||||
|
14
src/hci.c
14
src/hci.c
@ -269,7 +269,7 @@ static void event_handler(uint8_t *packet, int size){
|
||||
bt_flip_addr(addr, &packet[2]);
|
||||
// TODO: eval COD 8-10
|
||||
uint8_t link_type = packet[11];
|
||||
printf("Connection_incoming: "); print_bd_addr(addr); printf(", type %u\n", link_type);
|
||||
log_dbg("Connection_incoming: "); print_bd_addr(addr); log_dbg(", type %u\n", link_type);
|
||||
if (link_type == 1) { // ACL
|
||||
conn = connection_for_address(addr);
|
||||
if (!conn) {
|
||||
@ -286,7 +286,7 @@ static void event_handler(uint8_t *packet, int size){
|
||||
case HCI_EVENT_CONNECTION_COMPLETE:
|
||||
// Connection management
|
||||
bt_flip_addr(addr, &packet[5]);
|
||||
printf("Connection_complete (status=%u)", packet[2]); print_bd_addr(addr); printf("\n");
|
||||
log_dbg("Connection_complete (status=%u)", packet[2]); print_bd_addr(addr); log_dbg("\n");
|
||||
conn = connection_for_address(addr);
|
||||
if (conn) {
|
||||
if (!packet[2]){
|
||||
@ -298,9 +298,9 @@ static void event_handler(uint8_t *packet, int size){
|
||||
run_loop_set_timer(&conn->timeout, HCI_CONNECTION_TIMEOUT_MS);
|
||||
run_loop_add_timer(&conn->timeout);
|
||||
|
||||
printf("New connection: handle %u, ", conn->con_handle);
|
||||
log_dbg("New connection: handle %u, ", conn->con_handle);
|
||||
print_bd_addr( conn->address );
|
||||
printf("\n");
|
||||
log_dbg("\n");
|
||||
|
||||
hci_emit_nr_connections_changed();
|
||||
} else {
|
||||
@ -316,9 +316,9 @@ static void event_handler(uint8_t *packet, int size){
|
||||
handle = READ_BT_16(packet, 3);
|
||||
hci_connection_t * conn = connection_for_handle(handle);
|
||||
if (conn) {
|
||||
printf("Connection closed: handle %u, ", conn->con_handle);
|
||||
log_dbg("Connection closed: handle %u, ", conn->con_handle);
|
||||
print_bd_addr( conn->address );
|
||||
printf("\n");
|
||||
log_dbg("\n");
|
||||
run_loop_remove_timer(&conn->timeout);
|
||||
linked_list_remove(&hci_stack.connections, (linked_item_t *) conn);
|
||||
free( conn );
|
||||
@ -484,7 +484,7 @@ int hci_send_cmd_packet(uint8_t *packet, int size){
|
||||
// create_connection?
|
||||
if (IS_COMMAND(packet, hci_create_connection)){
|
||||
bt_flip_addr(addr, &packet[3]);
|
||||
printf("Create_connection to "); print_bd_addr(addr); printf("\n");
|
||||
log_dbg("Create_connection to "); print_bd_addr(addr); log_dbg("\n");
|
||||
conn = connection_for_address(addr);
|
||||
if (conn) {
|
||||
// if connection exists
|
||||
|
@ -74,25 +74,31 @@ void bt_flip_addr(bd_addr_t dest, bd_addr_t src){
|
||||
}
|
||||
|
||||
void hexdump(void *data, int size){
|
||||
#ifndef EMBEDDED
|
||||
int i;
|
||||
for (i=0; i<size;i++){
|
||||
printf("%02X ", ((uint8_t *)data)[i]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void printUUID(uint8_t *uuid) {
|
||||
#ifndef EMBEDDED
|
||||
printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
|
||||
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void print_bd_addr( bd_addr_t addr){
|
||||
#ifndef EMBEDDED
|
||||
int i;
|
||||
for (i=0; i<BD_ADDR_LEN-1;i++){
|
||||
printf("%02X-", ((uint8_t *)addr)[i]);
|
||||
}
|
||||
printf("%02X", ((uint8_t *)addr)[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
int sscan_bd_addr(uint8_t * addr_string, bd_addr_t addr){
|
||||
|
Loading…
x
Reference in New Issue
Block a user