From 1b4bd57b8ca8724472e73e53c87ee438812b7fca Mon Sep 17 00:00:00 2001 From: William C Bonner Date: Thu, 10 Oct 2024 16:37:01 -0700 Subject: [PATCH] remove extra files add_compile_definitions(_BLUEZ_HCI_) --- CMakeLists.txt | 7 +++--- GoveeBTTempLogger.vcxproj | 3 --- goveebttemplogger-hci.cpp | 45 --------------------------------------- goveebttemplogger-hci.h | 10 --------- goveebttemplogger.cpp | 8 +++---- goveebttemplogger.h | 2 -- 6 files changed, 8 insertions(+), 67 deletions(-) delete mode 100644 goveebttemplogger-hci.cpp delete mode 100644 goveebttemplogger-hci.h delete mode 100644 goveebttemplogger.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 9631d58..9148947 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,8 +20,10 @@ if (POLICY CMP0115) cmake_policy(SET CMP0115 NEW) endif() +add_compile_definitions(_BLUEZ_HCI_) + project (GoveeBTTempLogger - VERSION 3.20241008.0 + VERSION 3.20241010.0 DESCRIPTION "Listen and log Govee Thermometer Bluetooth Low Energy Advertisments via BlueZ and DBus" HOMEPAGE_URL https://github.com/wcbonner/GoveeBTTempLogger ) @@ -37,8 +39,6 @@ pkg_check_modules( dbus REQUIRED dbus-1 ) add_executable (goveebttemplogger goveebttemplogger.cpp goveebttemplogger-version.h - goveebttemplogger-hci.cpp - goveebttemplogger-hci.h att-types.h uuid.c uuid.h @@ -46,6 +46,7 @@ add_executable (goveebttemplogger wimiso8601.h ) + target_link_libraries(goveebttemplogger -lbluetooth -lstdc++fs diff --git a/GoveeBTTempLogger.vcxproj b/GoveeBTTempLogger.vcxproj index 1e6501f..a3c4360 100644 --- a/GoveeBTTempLogger.vcxproj +++ b/GoveeBTTempLogger.vcxproj @@ -78,7 +78,6 @@ - true @@ -118,8 +117,6 @@ - - diff --git a/goveebttemplogger-hci.cpp b/goveebttemplogger-hci.cpp deleted file mode 100644 index 78552b2..0000000 --- a/goveebttemplogger-hci.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include // apt install libbluetooth-dev -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // sudo apt install libdbus-1-dev -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // For close() -#include -#include -#include "wimiso8601.h" -#include "att-types.h" -#include "uuid.h" -#include "goveebttemplogger.h" -#include "goveebttemplogger-hci.h" - diff --git a/goveebttemplogger-hci.h b/goveebttemplogger-hci.h deleted file mode 100644 index bbc99b0..0000000 --- a/goveebttemplogger-hci.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -int hci_le_set_ext_scan_parameters(int dd, uint8_t type, uint16_t interval, uint16_t window, uint8_t own_type, uint8_t filter, int to); -int hci_le_set_ext_scan_enable(int dd, uint8_t enable, uint8_t filter_dup, int to); -int hci_le_set_random_address(int dd, int to); -std::string iBeacon(const uint8_t* const data); -int bt_LEScan(int BlueToothDevice_Handle, const bool enable, const std::set& BT_WhiteList, const bool HCI_Passive_Scanning); -void bt_ListDevices(void); -time_t ConnectAndDownload(int BlueToothDevice_Handle, const bdaddr_t GoveeBTAddress, const time_t GoveeLastReadTime, const int BatteryToRecord); -void BlueZ_HCI_MainLoop(std::string& ControllerAddress, std::set& BT_WhiteList, int& ExitValue, const bool bMonitorLoggingDirectory, const bool HCI_Passive_Scanning); diff --git a/goveebttemplogger.cpp b/goveebttemplogger.cpp index 005b912..c7cb2d9 100644 --- a/goveebttemplogger.cpp +++ b/goveebttemplogger.cpp @@ -53,8 +53,6 @@ // https://www.argenox.com/library/bluetooth-low-energy/using-raspberry-pi-ble/ // -//#define _BLUEZ_HCI_ - #include #include #include @@ -4527,10 +4525,12 @@ static void usage(int argc, char **argv) std::cout << " -b | --battery graph Draw the battery status on SVG graphs. 1:daily, 2:weekly, 4:monthly, 8:yearly" << std::endl; std::cout << " -x | --minmax graph Draw the minimum and maximum temperature and humidity status on SVG graphs. 1:daily, 2:weekly, 4:monthly, 8:yearly" << std::endl; std::cout << " -d | --download Periodically attempt to connect and download stored data" << std::endl; - std::cout << " -p | --passive Bluetooth LE Passive Scanning" << std::endl; std::cout << " -n | --no-bluetooth Monitor Logging Directory and process logs without Bluetooth Scanning" << std::endl; - std::cout << " -H | --HCI Prefer deprecated BlueZ HCI interface instead of DBus" << std::endl; std::cout << " -M | --monitor Monitor Logging Directory" << std::endl; + #ifdef _BLUEZ_HCI_ + std::cout << " -H | --HCI Prefer deprecated BlueZ HCI interface instead of DBus" << std::endl; + std::cout << " -p | --passive Bluetooth LE Passive Scanning" << std::endl; + #endif // _BLUEZ_HCI_ std::cout << std::endl; } static const char short_options[] = "hl:t:v:m:o:C:a:f:s:i:T:cb:x:dpnHM"; diff --git a/goveebttemplogger.h b/goveebttemplogger.h deleted file mode 100644 index 3f59c93..0000000 --- a/goveebttemplogger.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -