Skip to content

Commit

Permalink
log controller address
Browse files Browse the repository at this point in the history
  • Loading branch information
William C Bonner committed Jul 10, 2024
1 parent f6a614b commit a77d99a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (POLICY CMP0115)
endif()

project (GoveeBTTempLogger
VERSION 2.20240610.0
VERSION 2.20240710.0
DESCRIPTION "Listen and log Govee Thermometer Bluetooth Low Energy Advertisments"
HOMEPAGE_URL https://github.com/wcbonner/GoveeBTTempLogger
)
Expand Down
8 changes: 4 additions & 4 deletions GoveeBTTempLogger.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.10.35013.160
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GoveeBTTempLogger", "GoveeBTTempLogger.vcxproj", "{87469263-8DEA-4963-9E12-C4F20FA83479}"
EndProject
Expand All @@ -13,8 +13,8 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{87469263-8DEA-4963-9E12-C4F20FA83479}.Debug|ARM.ActiveCfg = Debug|ARM
{87469263-8DEA-4963-9E12-C4F20FA83479}.Debug|ARM.Build.0 = Debug|ARM
{87469263-8DEA-4963-9E12-C4F20FA83479}.Debug|ARM.ActiveCfg = Debug|ARM64
{87469263-8DEA-4963-9E12-C4F20FA83479}.Debug|ARM.Build.0 = Debug|ARM64
{87469263-8DEA-4963-9E12-C4F20FA83479}.Debug|x86.ActiveCfg = Debug|x86
{87469263-8DEA-4963-9E12-C4F20FA83479}.Debug|x86.Build.0 = Debug|x86
{87469263-8DEA-4963-9E12-C4F20FA83479}.Debug|x86.Deploy.0 = Debug|x86
Expand Down
9 changes: 9 additions & 0 deletions goveebttemplogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3223,6 +3223,11 @@ int main(int argc, char **argv)
char LocalName[HCI_MAX_NAME_LENGTH] = { 0 };
hci_read_local_name(BlueToothDevice_Handle, sizeof(LocalName), LocalName, bt_TimeOut);

// TODO: get controller address and put it in the log. Useful for machines with multiple controllers to verify which is being used
bdaddr_t TheLocalBlueToothAddress({ 0 });
hci_read_bd_addr(BlueToothDevice_Handle, &TheLocalBlueToothAddress, bt_TimeOut);
ControllerAddress = ba2string(TheLocalBlueToothAddress);

if (ConsoleVerbosity > 0)
{
if (!ControllerAddress.empty())
Expand All @@ -3238,6 +3243,10 @@ int main(int argc, char **argv)
std::cout << std::endl;
}
}
else
if (!ControllerAddress.empty())
std::cerr << "Controller Address: " << ControllerAddress << std::endl;

auto btRVal = bt_LEScan(BlueToothDevice_Handle, true, BT_WhiteList);
if (btRVal < 0)
ExitValue = EXIT_FAILURE;
Expand Down

0 comments on commit a77d99a

Please sign in to comment.