From 0e537d1e668ca57002704d39b7cf97994de47883 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Sun, 31 Jan 2016 20:31:52 +0100 Subject: [PATCH] move btstack_version.h to platform/daemon and only use by daemon --- example/embedded/Makefile.inc | 4 ---- platform/daemon/daemon.c | 10 ++++++++++ port/arduino/Makefile | 2 +- port/libusb/Makefile | 2 +- port/mtk/package.sh | 2 +- port/posix-h4/Makefile | 2 +- src/btstack.h | 1 - src/hci.c | 13 ------------- src/hci.h | 1 - test/hfp/Makefile | 2 +- test/pts/Makefile | 2 +- tool/get_version.sh | 2 +- 12 files changed, 17 insertions(+), 26 deletions(-) diff --git a/example/embedded/Makefile.inc b/example/embedded/Makefile.inc index bda4d9031..da02564ca 100644 --- a/example/embedded/Makefile.inc +++ b/example/embedded/Makefile.inc @@ -95,9 +95,6 @@ PAN_OBJ = $(PAN:.c=.o) default_target: all -${BTSTACK_ROOT}/src/btstack_version.h: - ${BTSTACK_ROOT}/tool/get_version.sh - # compile .gatt descriptions profile.h: profile.gatt python ${BTSTACK_ROOT}/tool/compile-gatt.py $< $@ @@ -171,7 +168,6 @@ hsp_hs_test: ${CORE_OBJ} ${COMMON_OBJ} ${SDP_CLIENT} hsp_hs.o hsp_hs_test.c clean: rm -f ${EXAMPLES} rm -f *.o *.out *.hex - rm -f ${BTSTACK_ROOT}/src/btstack_version.h rm -f ancs_client_demo.h profile.h spp_and_le_counter.h rm -rf *.dSYM rm -rf ${BTSTACK_ROOT}/ble/*.o diff --git a/platform/daemon/daemon.c b/platform/daemon/daemon.c index 4668d2a05..9ec160db3 100644 --- a/platform/daemon/daemon.c +++ b/platform/daemon/daemon.c @@ -668,6 +668,16 @@ static void daemon_disconnect_client(connection_t * connection){ free(client); } +static void hci_emit_btstack_version(void){ + log_info("BTSTACK_EVENT_VERSION %u.%u", BTSTACK_MAJOR, BTSTACK_MINOR); + uint8_t event[6]; + event[0] = BTSTACK_EVENT_VERSION; + event[1] = sizeof(event) - 2; + event[2] = BTSTACK_MAJOR; + event[3] = BTSTACK_MINOR; + little_endian_store_16(event, 4, 3257); // last SVN commit on Google Code + 1 + socket_connection_send_packet_all(HCI_EVENT_PACKET, 0, event, sizeof(event)); +} static void send_l2cap_connection_open_failed(connection_t * connection, bd_addr_t address, uint16_t psm, uint8_t status){ // emit error - see l2cap.c:l2cap_emit_channel_opened(..) diff --git a/port/arduino/Makefile b/port/arduino/Makefile index a1eac2999..0f3ec6f6b 100644 --- a/port/arduino/Makefile +++ b/port/arduino/Makefile @@ -5,7 +5,7 @@ DIR=. BTSTACK_ROOT=${DIR}/../.. DUMMY=$(shell ) -VERSION=`sed -n -e 's/^.*BTSTACK_VERSION \"\(.*\)\"/\1/p' ${BTSTACK_ROOT}/src/btstack_version.h` +VERSION=`sed -n -e 's/^.*BTSTACK_VERSION \"\(.*\)\"/\1/p' ${BTSTACK_ROOT}/platform/daemon/btstack_version.h` BTSTACK_PACKAGE=/tmp/btstack ARCHIVE=btstack-arduino-${VERSION}.zip diff --git a/port/libusb/Makefile b/port/libusb/Makefile index 4628292af..bd88a0a28 100644 --- a/port/libusb/Makefile +++ b/port/libusb/Makefile @@ -28,4 +28,4 @@ CFLAGS += $(shell pkg-config libusb-1.0 --cflags) LDFLAGS += $(shell pkg-config libusb-1.0 --libs) endif -all: ${BTSTACK_ROOT}/src/btstack_version.h ${EXAMPLES} +all: ${EXAMPLES} diff --git a/port/mtk/package.sh b/port/mtk/package.sh index 1603f836f..18510a9f6 100755 --- a/port/mtk/package.sh +++ b/port/mtk/package.sh @@ -19,7 +19,7 @@ popd pushd . cd $DIR/../.. -VERSION=`sed -n -e 's/^.*BTSTACK_VERSION \"\(.*\)\"/\1/p' src/btstack_version.h` +VERSION=`sed -n -e 's/^.*BTSTACK_VERSION \"\(.*\)\"/\1/p' platform/daemon/btstack_version.h` ARCHIVE=btstack-android-mtk-$VERSION.tar.gz echo "Create Archive $ARCHIVE" rm -f $ARCHIVE diff --git a/port/posix-h4/Makefile b/port/posix-h4/Makefile index 475bdd4fc..f06dc76e2 100644 --- a/port/posix-h4/Makefile +++ b/port/posix-h4/Makefile @@ -54,4 +54,4 @@ ifneq ($(OS),Windows_NT) EXAMPLES += ${EXAMPLES_CLI} endif -all: ${BTSTACK_ROOT}/src/btstack_version.h ${EXAMPLES} +all: ${EXAMPLES} diff --git a/src/btstack.h b/src/btstack.h index 75a01929c..148b700a8 100644 --- a/src/btstack.h +++ b/src/btstack.h @@ -56,7 +56,6 @@ #include "btstack_memory_pool.h" #include "btstack_run_loop.h" #include "btstack_util.h" -#include "btstack_version.h" #include "gap.h" #include "hci.h" #include "hci_cmd.h" diff --git a/src/hci.c b/src/hci.c index 81e06308a..596453742 100644 --- a/src/hci.c +++ b/src/hci.c @@ -65,7 +65,6 @@ #include "btstack_debug.h" #include "btstack_linked_list.h" #include "btstack_memory.h" -#include "btstack_version.h" #include "gap.h" #include "hci.h" #include "hci_cmd.h" @@ -2997,18 +2996,6 @@ void hci_emit_hci_open_failed(void){ hci_stack->packet_handler(HCI_EVENT_PACKET, event, sizeof(event)); } -void hci_emit_btstack_version(void){ - log_info("BTSTACK_EVENT_VERSION %u.%u", BTSTACK_MAJOR, BTSTACK_MINOR); - uint8_t event[6]; - event[0] = BTSTACK_EVENT_VERSION; - event[1] = sizeof(event) - 2; - event[2] = BTSTACK_MAJOR; - event[3] = BTSTACK_MINOR; - little_endian_store_16(event, 4, 3257); // last SVN commit on Google Code + 1 - hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); - hci_stack->packet_handler(HCI_EVENT_PACKET, event, sizeof(event)); -} - void hci_emit_system_bluetooth_enabled(uint8_t enabled){ log_info("BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED %u", enabled); uint8_t event[3]; diff --git a/src/hci.h b/src/hci.h index c7b681a59..97ba2acd9 100644 --- a/src/hci.h +++ b/src/hci.h @@ -703,7 +703,6 @@ void hci_emit_l2cap_check_timeout(hci_connection_t *conn); void hci_emit_disconnection_complete(uint16_t handle, uint8_t reason); void hci_emit_nr_connections_changed(void); void hci_emit_hci_open_failed(void); -void hci_emit_btstack_version(void); void hci_emit_system_bluetooth_enabled(uint8_t enabled); void hci_emit_remote_name_cached(bd_addr_t addr, device_name_t *name); void hci_emit_discoverable_enabled(uint8_t enabled); diff --git a/test/hfp/Makefile b/test/hfp/Makefile index 8e4263c55..fd71658f5 100644 --- a/test/hfp/Makefile +++ b/test/hfp/Makefile @@ -60,7 +60,7 @@ LDFLAGS += -lCppUTest -lCppUTestExt EXAMPLES = hfp_ag_parser_test hfp_ag_client_test hfp_hf_parser_test hfp_hf_client_test -all: ${BTSTACK_ROOT}/src/btstack_version.h ${EXAMPLES} +all: ${EXAMPLES} clean: rm -rf *.o $(EXAMPLES) $(CLIENT_EXAMPLES) *.dSYM diff --git a/test/pts/Makefile b/test/pts/Makefile index 0a71b3411..a64c97973 100644 --- a/test/pts/Makefile +++ b/test/pts/Makefile @@ -31,7 +31,7 @@ LDFLAGS += $(shell pkg-config libusb-1.0 --libs) EXAMPLES = iopt hfp_hf_test hfp_ag_test ble_peripheral_test ble_central_test l2cap_test classic_test bnep_test hsp_ag_test hsp_hs_test sco_loopback -all: ${BTSTACK_ROOT}/src/btstack_version.h ${EXAMPLES} +all: ${EXAMPLES} # compile .gatt descriptions ble_peripheral_test.h: ble_peripheral_test.gatt diff --git a/tool/get_version.sh b/tool/get_version.sh index 0214dd84f..388cd850a 100755 --- a/tool/get_version.sh +++ b/tool/get_version.sh @@ -1,6 +1,6 @@ #!/bin/sh DIR=`dirname $0` -FILE=$DIR/../src/btstack_version.h +FILE=$DIR/../platform/daemon/btstack_version.h COMMIT=`git log -1 --pretty=format:%h` MAJOR=0 MINOR=9