allow to config unix domain path and daemon log file via btstack-config.h

This commit is contained in:
matthias.ringwald@gmail.com 2014-05-12 21:25:01 +00:00
parent 4e6f32d5a8
commit ea3e9e661d
2 changed files with 16 additions and 2 deletions

View File

@ -45,6 +45,8 @@
#include <btstack/run_loop.h>
#include <btstack/utils.h>
#include "btstack-config.h"
#include <stdint.h>
#if defined __cplusplus
@ -52,10 +54,14 @@ extern "C" {
#endif
// Default TCP port for BTstack daemon
#ifndef BTSTACK_PORT
#define BTSTACK_PORT 13333
#endif
// UNIX domain socket for BTstack */
#ifndef BTSTACK_UNIX
#define BTSTACK_UNIX "/tmp/BTstack"
#endif
// packet handler
typedef void (*btstack_packet_handler_t) (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);

View File

@ -87,6 +87,15 @@
#include <libusb-1.0/libusb.h>
#endif
#ifndef BTSTACK_LOG_FILE
#define BTSTACK_LOG_FILE "/tmp/hci_dump.pklg"
#endif
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
#ifndef BTSTACK_LOG_TYPE
#define BTSTACK_LOG_TYPE HCI_DUMP_PACKETLOGGER
#endif
#define DAEMON_NO_ACTIVE_CLIENT_TIMEOUT 10000
@ -744,8 +753,7 @@ static int daemon_client_handler(connection_t *connection, uint16_t packet_type,
static void daemon_set_logging_enabled(int enabled){
if (enabled && !loggingEnabled){
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
hci_dump_open("/data/btstack/hci_dump.pklg", HCI_DUMP_PACKETLOGGER);
hci_dump_open(BTSTACK_LOG_FILE, BTSTACK_LOG_TYPE);
}
if (!enabled && loggingEnabled){
hci_dump_close();