Skip to content

Commit

Permalink
Cache Directory stubs, cmake setup test
Browse files Browse the repository at this point in the history
  • Loading branch information
William C Bonner committed Sep 18, 2023
1 parent 5e78e87 commit 1f70821
Show file tree
Hide file tree
Showing 7 changed files with 295 additions and 11 deletions.
56 changes: 56 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# CMakeList.txt : CMake project for influxd-wind-svg, include source and define
# project specific logic here.
#
cmake_minimum_required(VERSION 3.12.0)

# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()

project ("goveebttemplogger"
VERSION 2.20230918-1
DESCRIPTION "Govee H5074, H5075, H5100, H5174, H5177, H5179, H5181, H5182, and H5183 Bluetooth Low Energy Temperature and Humidity Logger"
HOMEPAGE_URL https://github.com/wcbonner/GoveeBTTempLogger
)

configure_file(goveebttemplogger-version.h.in goveebttemplogger-version.h)

# Add source to this project's executable.
add_executable (goveebttemplogger "goveebttemplogger.cpp" "uuid.c" "uuid.h")

add_executable(gvh-organizelogs "gvh-organizelogs.cpp")

if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET goveebttemplogger PROPERTY CXX_STANDARD 20)
endif()

target_include_directories(goveebttemplogger PUBLIC
"${PROJECT_BINARY_DIR}"
${EXTRA_INCLUDES}
)

# TODO: Add tests and install targets if needed.

install(TARGETS goveebttemplogger
DESTINATION bin
RUNTIME DESTINATION "/usr/local/bin/"
LIBRARY DESTINATION "/usr/local/lib/"
)

install(FILES "GoveeBTTempLogger/usr/local/lib/systemd/system/goveebttemplogger.service"
DESTINATION "/usr/local/lib/systemd/system"
COMPONENT "goveebttemplogger"
)

set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_CONTACT "[email protected]")
include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_RELEASE ${CMAKE_PROJECT_VERSION_PATCH})
set(CPACK_DEBIAN_PACKAGE_DEPENDS curl,influxdb)
set(CPACK_DEBIAN_PACKAGE_SECTION custom)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/GoveeBTTempLogger/DEBIAN/postinst" "${CMAKE_CURRENT_SOURCE_DIR}/GoveeBTTempLogger/DEBIAN/prerm" "${CMAKE_CURRENT_SOURCE_DIR}/GoveeBTTempLogger/DEBIAN/postrm")
include(CPack)
101 changes: 101 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"version": 3,
"configurePresets": [
{
"name": "windows-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "x64-debug",
"displayName": "x64 Debug",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x64-release",
"displayName": "x64 Release",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "x86-debug",
"displayName": "x86 Debug",
"inherits": "windows-base",
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x86-release",
"displayName": "x86 Release",
"inherits": "x86-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "linux-debug",
"displayName": "Linux Debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
},
{
"name": "macos-debug",
"displayName": "macOS Debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
}
]
}
5 changes: 4 additions & 1 deletion GoveeBTTempLogger.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
<ClCompile Include="uuid.c" />
</ItemGroup>
<ItemGroup>
<None Include="CMakePresets.json" />
<None Include="goveebttemplogger-version.h.in" />
<None Include="GoveeBTTempLogger\DEBIAN\control" />
<None Include="GoveeBTTempLogger\DEBIAN\postinst" />
<None Include="GoveeBTTempLogger\DEBIAN\postrm" />
Expand All @@ -108,6 +110,7 @@
<ItemGroup>
<Text Include="BTData\btsnoop-details.txt" />
<Text Include="BTData\btsnoop_hci.log" />
<Text Include="CMakeLists.txt" />
<Text Include="gvh-titlemap.txt" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -218,4 +221,4 @@
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>
</Project>
2 changes: 1 addition & 1 deletion GoveeBTTempLogger/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: GoveeBTTempLogger
Version: 2.20230906-1
Version: 2.20230918-1
Section: custom
Priority: optional
Architecture: armhf
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ For the longest time I've had fixed values set in my code for Scan Window and Sc
The values are in increments of 0.625 msec. The First value was 11.25 msec, and the second value was (5000 msec).
Doing a bunch of reading I came across recommendations to use 40 msec and 30 msec, so I've tried bt_ScanInterval(64) and bt_ScanWindow(48). When it's set this way, I seem to get advertisments, but I'm not able to connect and download.

## --only ff:ff:ff:ff:ff:ff Hack
I included a hack some time ago related to the bluetooth filtering to easily filter on devices that have already been logged. If a filter is specified with all the bits set, the program will submit a filter of known addresses to the stack when scanning is started. This disables new device discovery, but may improve performance in some situations.

Connections on bluetooth devices are all based on handles and UUIDs. There are some defined UUIDs that every bluetooth device is required to support, and then there are custom UUIDs. This listing came from a GVH5177.
```
Expand Down
4 changes: 4 additions & 0 deletions goveebttemplogger-version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma once
#define QUOTE(x) #x
#define STR(x) QUOTE(x)
#define GoveeBTTempLogger_VERSION STR(@CMAKE_PROJECT_VERSION@)
Loading

0 comments on commit 1f70821

Please sign in to comment.