Update hueplusplus dependency to 1.2.0

This commit is contained in:
Adam Honse
2025-02-14 11:40:34 -06:00
parent bb6f8e2ddd
commit 0d6ae64b24
153 changed files with 305 additions and 23091 deletions

View File

@@ -11,7 +11,7 @@
#include <iostream>
#include "ElgatoKeyLightController.h"
#include "json.hpp"
#include <nlohmann/json.hpp>
using json = nlohmann::json;

View File

@@ -14,7 +14,7 @@
#include <thread>
#include <vector>
#include "ElgatoLightStripController.h"
#include "json.hpp"
#include <nlohmann/json.hpp>
#include "LogManager.h"
using json = nlohmann::json;

View File

@@ -11,7 +11,7 @@
#include <cstdint>
#include "KasaSmartController.h"
#include "json.hpp"
#include <nlohmann/json.hpp>
#include "hsv.h"
using json = nlohmann::json;
@@ -273,7 +273,7 @@ void KasaSmartController::SetEffect(std::string effect)
is_initialized = false;
return;
}
std::string response;
KasaSmartController::SendCommand(effect, response);
port.tcp_close();

View File

@@ -10,7 +10,7 @@
\*---------------------------------------------------------*/
#include "LIFXController.h"
#include "json.hpp"
#include <nlohmann/json.hpp>
#include "hsv.h"
using json = nlohmann::json;

View File

@@ -12,7 +12,7 @@
#include "RGBController_Nanoleaf.h"
#include "ResourceManager.h"
#include "LogManager.h"
#include "json.hpp"
#include <nlohmann/json.hpp>
using json = nlohmann::json;

View File

@@ -10,7 +10,7 @@
\*---------------------------------------------------------*/
#include "PhilipsWizController.h"
#include "json.hpp"
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace std::chrono_literals;
@@ -130,7 +130,7 @@ void PhilipsWizController::SetColor(unsigned char red, unsigned char green, unsi
command["params"]["w"] = 0;
}
/*-----------------------------------------------------------------*\
| Fill in the setPilot command with RGB and brightness information. |
| The bulb will not respond to 0, 0, 0, so if all channels are zero,|

View File

@@ -10,7 +10,7 @@
\*---------------------------------------------------------*/
#include "YeelightController.h"
#include "json.hpp"
#include <nlohmann/json.hpp>
using json = nlohmann::json;

View File

@@ -15,7 +15,7 @@
#include <vector>
#include <queue>
#include <memory>
#include "json.hpp"
#include <nlohmann/json.hpp>
#include "filesystem.h"
/*-------------------------------------------------*\
@@ -78,7 +78,7 @@ private:
// Logfile max level
unsigned int loglevel = LL_INFO;
// Verbosity (stdout) max level
unsigned int verbosity = LL_WARNING;

View File

@@ -143,8 +143,8 @@ INCLUDEPATH +=
$$GUI_INCLUDES \
dependencies/ColorWheel \
dependencies/CRCpp/ \
dependencies/hueplusplus-1.1.0/include \
dependencies/hueplusplus-1.1.0/include/hueplusplus \
dependencies/hueplusplus-1.2.0/include \
dependencies/hueplusplus-1.2.0/include/hueplusplus \
dependencies/httplib \
dependencies/json/ \
dependencies/mdns \
@@ -170,7 +170,7 @@ HEADERS +=
$$CONTROLLER_H \
Colors.h \
dependencies/ColorWheel/ColorWheel.h \
dependencies/json/json.hpp \
dependencies/json/nlohmann/json.hpp \
LogManager.h \
NetworkClient.h \
NetworkProtocol.h \
@@ -210,35 +210,35 @@ SOURCES +=
$$GUI_CPP \
$$CONTROLLER_CPP \
dependencies/ColorWheel/ColorWheel.cpp \
dependencies/hueplusplus-1.1.0/src/Action.cpp \
dependencies/hueplusplus-1.1.0/src/APICache.cpp \
dependencies/hueplusplus-1.1.0/src/BaseDevice.cpp \
dependencies/hueplusplus-1.1.0/src/BaseHttpHandler.cpp \
dependencies/hueplusplus-1.1.0/src/Bridge.cpp \
dependencies/hueplusplus-1.1.0/src/BridgeConfig.cpp \
dependencies/hueplusplus-1.1.0/src/CLIPSensors.cpp \
dependencies/hueplusplus-1.1.0/src/ColorUnits.cpp \
dependencies/hueplusplus-1.1.0/src/EntertainmentMode.cpp \
dependencies/hueplusplus-1.1.0/src/ExtendedColorHueStrategy.cpp \
dependencies/hueplusplus-1.1.0/src/ExtendedColorTemperatureStrategy.cpp \
dependencies/hueplusplus-1.1.0/src/Group.cpp \
dependencies/hueplusplus-1.1.0/src/HueCommandAPI.cpp \
dependencies/hueplusplus-1.1.0/src/HueDeviceTypes.cpp \
dependencies/hueplusplus-1.1.0/src/HueException.cpp \
dependencies/hueplusplus-1.1.0/src/Light.cpp \
dependencies/hueplusplus-1.1.0/src/ModelPictures.cpp \
dependencies/hueplusplus-1.1.0/src/NewDeviceList.cpp \
dependencies/hueplusplus-1.1.0/src/Scene.cpp \
dependencies/hueplusplus-1.1.0/src/Schedule.cpp \
dependencies/hueplusplus-1.1.0/src/Sensor.cpp \
dependencies/hueplusplus-1.1.0/src/SimpleBrightnessStrategy.cpp \
dependencies/hueplusplus-1.1.0/src/SimpleColorHueStrategy.cpp \
dependencies/hueplusplus-1.1.0/src/SimpleColorTemperatureStrategy.cpp \
dependencies/hueplusplus-1.1.0/src/StateTransaction.cpp \
dependencies/hueplusplus-1.1.0/src/TimePattern.cpp \
dependencies/hueplusplus-1.1.0/src/UPnP.cpp \
dependencies/hueplusplus-1.1.0/src/Utils.cpp \
dependencies/hueplusplus-1.1.0/src/ZLLSensors.cpp \
dependencies/hueplusplus-1.2.0/src/Action.cpp \
dependencies/hueplusplus-1.2.0/src/APICache.cpp \
dependencies/hueplusplus-1.2.0/src/BaseDevice.cpp \
dependencies/hueplusplus-1.2.0/src/BaseHttpHandler.cpp \
dependencies/hueplusplus-1.2.0/src/Bridge.cpp \
dependencies/hueplusplus-1.2.0/src/BridgeConfig.cpp \
dependencies/hueplusplus-1.2.0/src/CLIPSensors.cpp \
dependencies/hueplusplus-1.2.0/src/ColorUnits.cpp \
dependencies/hueplusplus-1.2.0/src/EntertainmentMode.cpp \
dependencies/hueplusplus-1.2.0/src/ExtendedColorHueStrategy.cpp \
dependencies/hueplusplus-1.2.0/src/ExtendedColorTemperatureStrategy.cpp \
dependencies/hueplusplus-1.2.0/src/Group.cpp \
dependencies/hueplusplus-1.2.0/src/HueCommandAPI.cpp \
dependencies/hueplusplus-1.2.0/src/HueDeviceTypes.cpp \
dependencies/hueplusplus-1.2.0/src/HueException.cpp \
dependencies/hueplusplus-1.2.0/src/Light.cpp \
dependencies/hueplusplus-1.2.0/src/ModelPictures.cpp \
dependencies/hueplusplus-1.2.0/src/NewDeviceList.cpp \
dependencies/hueplusplus-1.2.0/src/Scene.cpp \
dependencies/hueplusplus-1.2.0/src/Schedule.cpp \
dependencies/hueplusplus-1.2.0/src/Sensor.cpp \
dependencies/hueplusplus-1.2.0/src/SimpleBrightnessStrategy.cpp \
dependencies/hueplusplus-1.2.0/src/SimpleColorHueStrategy.cpp \
dependencies/hueplusplus-1.2.0/src/SimpleColorTemperatureStrategy.cpp \
dependencies/hueplusplus-1.2.0/src/StateTransaction.cpp \
dependencies/hueplusplus-1.2.0/src/TimePattern.cpp \
dependencies/hueplusplus-1.2.0/src/UPnP.cpp \
dependencies/hueplusplus-1.2.0/src/Utils.cpp \
dependencies/hueplusplus-1.2.0/src/ZLLSensors.cpp \
main.cpp \
cli.cpp \
dmiinfo/dmiinfo.cpp \
@@ -333,7 +333,7 @@ win32:INCLUDEPATH +=
win32:SOURCES += $$CONTROLLER_CPP_WINDOWS
win32:SOURCES += \
dependencies/hueplusplus-1.1.0/src/WinHttpHandler.cpp \
dependencies/hueplusplus-1.2.0/src/WinHttpHandler.cpp \
dependencies/mbedtls-2.28.8/library/aes.c \
dependencies/mbedtls-2.28.8/library/aesni.c \
dependencies/mbedtls-2.28.8/library/arc4.c \
@@ -601,7 +601,7 @@ contains(QMAKE_PLATFORM, linux) {
SOURCES += $$CONTROLLER_CPP_LINUX
SOURCES += \
dependencies/hueplusplus-1.1.0/src/LinHttpHandler.cpp \
dependencies/hueplusplus-1.2.0/src/LinHttpHandler.cpp \
dependencies/NVFC/nvapi.cpp \
i2c_smbus/i2c_smbus_linux.cpp \
scsiapi/scsiapi_linux.c \
@@ -727,7 +727,7 @@ contains(QMAKE_PLATFORM, freebsd) {
SOURCES += $$CONTROLLER_CPP_FREEBSD
SOURCES += \
dependencies/hueplusplus-1.1.0/src/LinHttpHandler.cpp \
dependencies/hueplusplus-1.2.0/src/LinHttpHandler.cpp \
serial_port/find_usb_serial_port_linux.cpp \
AutoStart/AutoStart-FreeBSD.cpp \
SuspendResume/SuspendResume_Linux_FreeBSD.cpp \
@@ -795,7 +795,7 @@ macx {
HEADERS += $$CONTROLLER_H_MACOS
SOURCES += \
dependencies/hueplusplus-1.1.0/src/LinHttpHandler.cpp \
dependencies/hueplusplus-1.2.0/src/LinHttpHandler.cpp \
serial_port/find_usb_serial_port_macos.cpp \
AutoStart/AutoStart-MacOS.cpp \
qt/macutils.mm \

View File

@@ -24,7 +24,7 @@
#include "i2c_smbus.h"
#include "ResourceManagerInterface.h"
#include "filesystem.h"
#include "json.hpp"
#include <nlohmann/json.hpp>
using json = nlohmann::json;

View File

@@ -13,7 +13,7 @@
#pragma once
#include "json.hpp"
#include <nlohmann/json.hpp>
#include <mutex>
#include "filesystem.h"

View File

@@ -1,55 +0,0 @@
timestamps {
node('master')
{
stage('SCM')
{
checkout scm
}
stage('Build')
{
sh returnStatus: true, script: 'rm -r build'
sh '''#!/bin/bash
mkdir build
cd build
cmake .. -Dhueplusplus_TESTS=ON
make -j8 2>&1 | tee buildlog.txt
test ${PIPESTATUS[0]} -eq 0'''
}
stage('Test')
{
sh '''cd build
hueplusplus/test/test_HuePlusPlus --gtest_output=xml:test.xml
make -j8 coveragetest'''
step([$class: 'XUnitBuilder', testTimeMargin: '3000', thresholdMode: 1,
thresholds: [
[$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: ''],
[$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']
],
tools: [
[$class: 'GoogleTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/test.xml', skipNoTestFiles: false, stopProcessingIfError: true]
]
])
publishHTML(
[allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/coveragetest', reportFiles: 'index.html', reportName: 'Coveragetest', reportTitles: '']
)
}
stage('CppCheck')
{
sh 'cppcheck -j 8 --force -ihueplusplus/test -ihueplusplus/jsoncpp.cpp hueplusplus/ 2>build/CppCheckResult'
rtp nullAction: '1', parserName: 'HTML', stableText: '${FILE:build/CppCheckResult}'
}
stage('Documentation')
{
sh 'doxygen Doxyfile'
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'doc/html/', reportFiles: 'index.html', reportName: 'Doxygen'])
}
stage('Parse warnings')
{
warnings canComputeNew: false, canResolveRelativePaths: false, categoriesPattern: '', defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', parserConfigurations: [[parserName: 'Doxygen', pattern: 'doxylog.txt']], unHealthy: ''
sh returnStatus: true, script: 'rm doxylog.txt'
warnings canComputeNew: false, canResolveRelativePaths: false, categoriesPattern: '', defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', parserConfigurations: [[parserName: 'GNU C Compiler 4 (gcc)', pattern: 'build/buildlog.txt']], unHealthy: ''
sh returnStatus: true, script: 'rm build/buildlog.txt'
}
}
}

View File

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [enwi]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -0,0 +1,72 @@
name: CI
on:
push:
branches:
- master
- development
pull_request:
jobs:
build:
runs-on: ubuntu-24.04
env:
LINUX_DIST: bionic
DEPS_DIR: ${{ github.workspace }}/deps
COMPILER_NAME: gcc
CXX: g++
CC: gcc
RUN_TESTS: true
COVERAGE: false
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# PATH: ${{ github.workspace }}/deps/cmake/bin:${{ env.PATH }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y gcc g++ lcov doxygen graphviz python3-yaml
# - name: Install CodeCov and LCOV
# run: |
# sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-7 90
# wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz
# tar xf lcov_1.13.orig.tar.gz
# make -C lcov-1.13 "PREFIX=${HOME}/.local" install
# echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Show tool versions
run: |
echo $PATH
echo $CXX
$CXX --version
$CXX -v
cmake --version
lcov --version
gcov --version
- name: Build project
run: |
mkdir -p build
cd build
cmake .. -Dhueplusplus_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -Dhueplusplus_EXAMPLES=ON
make hueplusplus_examples hueplusplus_snippets
make coveragetest
cd ..
doxygen Doxyfile
touch doc/html/.nojekyll
- name: Upload coverage to Codecov
run: |
bash <(curl -s https://codecov.io/bash)
- name: Deploy documentation to GitHub Pages
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/html

View File

@@ -1,3 +1,6 @@
[submodule "lib/mbedtls"]
path = lib/mbedtls
url = https://github.com/ARMmbed/mbedtls.git
[submodule "lib/json"]
path = lib/json
url = https://github.com/nlohmann/json.git

View File

@@ -1,15 +1,9 @@
cmake_minimum_required(VERSION 3.8)
if(${CMAKE_VERSION} VERSION_LESS 3.11)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.11)
endif()
cmake_minimum_required(VERSION 3.10.2...3.28)
# Add cmake dir to module path, so Find*.cmake can be found
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
project(hueplusplus VERSION 1.1.0 LANGUAGES CXX)
project(hueplusplus VERSION 1.2.0 LANGUAGES CXX)
# check whether hueplusplus is compiled directly or included as a subdirectory
if(NOT DEFINED hueplusplus_master_project)
@@ -23,6 +17,16 @@ endif()
# options to set
option(hueplusplus_TESTS "Build tests" OFF)
option(hueplusplus_EXAMPLES "Build examples" OFF)
option(hueplusplus_NO_EXTERNAL_LIBRARIES "Do not try to use external libraries" OFF)
# Try to find installed packages
if(NOT hueplusplus_NO_EXTERNAL_LIBRARIES)
# Suppress warnings if libraries are not found, they will be built from submodules
find_package(MbedTLS QUIET)
find_package(nlohmann_json QUIET)
endif()
set(NEED_SUBMODULES NOT (${MbedTLS_FOUND} AND ${nlohmann_json_FOUND}))
option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF)
find_program(CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable")
@@ -38,7 +42,7 @@ endif()
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
if(GIT_SUBMODULE AND NEED_SUBMODULES)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
@@ -83,15 +87,34 @@ if (1 AND APPLE)
set(CMAKE_MACOSX_RPATH 1)
endif()
set(USE_STATIC_MBEDTLS_LIBRARY ON)
set(USE_SHARED_MBEDTLS_LIBRARY OFF)
add_subdirectory("lib/mbedtls" EXCLUDE_FROM_ALL)
if(NOT MbedTLS_FOUND)
# Build mbedtls if not installed
message(STATUS "MbedTLS was not found, the submodule is used.")
set(USE_STATIC_MBEDTLS_LIBRARY ON)
set(USE_SHARED_MBEDTLS_LIBRARY OFF)
add_subdirectory("lib/mbedtls" EXCLUDE_FROM_ALL)
# Compile the mbedtls library as a static with position independent code,
# because we need it for both a shared and static library
set_property(TARGET mbedtls PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET mbedcrypto PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET mbedx509 PROPERTY POSITION_INDEPENDENT_CODE ON)
# Compile the mbedtls library as a static with position independent code,
# because we need it for both a shared and static library
set_property(TARGET mbedtls PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET mbedcrypto PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET mbedx509 PROPERTY POSITION_INDEPENDENT_CODE ON)
if(CMAKE_VERSION VERSION_LESS 3.18)
# Aliases for compatibility with find_package, newer cmake versions add these already
add_library(MbedTLS::mbedtls ALIAS mbedtls)
add_library(MbedTLS::mbedcrypto ALIAS mbedcrypto)
add_library(MbedTLS::mbedx509 ALIAS mbedx509)
endif()
endif()
if(NOT nlohmann_json_FOUND)
# Use embedded json
message(STATUS "nlohmann_json was not found, the submodule is used.")
# disable tests for json
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory("lib/json" EXCLUDE_FROM_ALL)
endif()
add_subdirectory(src)

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = hueplusplus
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 1.0.0
PROJECT_NUMBER = 1.2.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@@ -1,10 +1,10 @@
# hueplusplus
A simple and easy to use library for Philips Hue Lights
| Branch | Travis CI | Codecov | LGTM
| Branch | CI | Codecov | LGTM
|:-|:-|:-|:-|
| [Master](https://github.com/enwi/hueplusplus/tree/master) | [![Build Status](https://travis-ci.com/enwi/hueplusplus.svg?branch=master)](https://travis-ci.com/enwi/hueplusplus) | [![codecov](https://codecov.io/gh/enwi/hueplusplus/branch/master/graph/badge.svg)](https://codecov.io/gh/enwi/hueplusplus) | [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/enwi/hueplusplus.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/enwi/hueplusplus/context:cpp) |
| [Development](https://github.com/enwi/hueplusplus/tree/development) | [![Build Status](https://travis-ci.com/enwi/hueplusplus.svg?branch=development)](https://travis-ci.com/enwi/hueplusplus) | [![codecov](https://codecov.io/gh/enwi/hueplusplus/branch/development/graph/badge.svg)](https://codecov.io/gh/enwi/hueplusplus) | |
| [Master](https://github.com/enwi/hueplusplus/tree/master) | [![CI](https://github.com/enwi/hueplusplus/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/enwi/hueplusplus/actions/workflows/build.yml)| [![codecov](https://codecov.io/gh/enwi/hueplusplus/branch/master/graph/badge.svg)](https://codecov.io/gh/enwi/hueplusplus) | [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/enwi/hueplusplus.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/enwi/hueplusplus/context:cpp) |
| [Development](https://github.com/enwi/hueplusplus/tree/development) | [![CI](https://github.com/enwi/hueplusplus/actions/workflows/build.yml/badge.svg?branch=development)](https://github.com/enwi/hueplusplus/actions/workflows/build.yml) | [![codecov](https://codecov.io/gh/enwi/hueplusplus/branch/development/graph/badge.svg)](https://codecov.io/gh/enwi/hueplusplus) | |
## Features
* find bridges with SSDP or set an ip manually

View File

@@ -18,7 +18,7 @@ When you want to update the library for a new version, use pull with rebase.
```
## Build with CMake {#build-cmake}
To build the library, you need to use [CMake](https://cmake.org) version 3.8 or higher.
To build the library, you need to use [CMake](https://cmake.org) version 3.10 or higher.
It is easiest to create a separate build directory where the build files are stored.
```{.sh}
~/hueplusplus $ mkdir build
@@ -84,3 +84,7 @@ cd build
cmake .. -Dhueplusplus_EXAMPLES=ON
make hueplusplus_examples
```
## External libraries
Hueplusplus requires a few external libraries (e.g. Mbed TLS and GTest), which are included automatically. If these are pre-installed on your system, those versions will be used by default. This can potentially cause issues if your installed versions are incompatible.
In this case, set `hueplusplus_NO_EXTERNAL_LIBRARIES=ON` to force using the embedded versions instead of the installed libraries.

View File

@@ -22,7 +22,7 @@
#ifndef INCLUDE_HUEPLUSPLUS_ACTION_H
#define INCLUDE_HUEPLUSPLUS_ACTION_H
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -27,7 +27,7 @@
#include "APICache.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -30,7 +30,7 @@
#include "IHttpHandler.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -47,7 +47,7 @@
#include "SensorList.h"
#include "Utils.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
//! \brief Namespace for the hueplusplus library
namespace hueplusplus

View File

@@ -24,7 +24,7 @@
#include "TimePattern.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -31,7 +31,7 @@
#include "HueCommandAPI.h"
#include "StateTransaction.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -26,7 +26,7 @@
#include <exception>
#include <string>
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -29,7 +29,7 @@
#include <string>
#include <vector>
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -33,7 +33,7 @@
#include "HueCommandAPI.h"
#include "StateTransaction.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -28,7 +28,7 @@
#include "BaseHttpHandler.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -27,7 +27,7 @@
#include "TimePattern.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -26,7 +26,7 @@
#include <string>
#include <vector>
#include <json/json.hpp>
#include <nlohmann/json.hpp>
#include "APICache.h"
#include "ColorUnits.h"

View File

@@ -30,7 +30,7 @@
#include "HueCommandAPI.h"
#include "TimePattern.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -29,7 +29,7 @@
#include "ColorUnits.h"
#include "HueCommandAPI.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -23,7 +23,7 @@
#ifndef INCLUDE_HUEPLUSPLUS_UTILS_H
#define INCLUDE_HUEPLUSPLUS_UTILS_H
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -27,7 +27,7 @@
#include "hueplusplus/HueExceptionMacro.h"
#include "hueplusplus/Utils.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

View File

@@ -57,20 +57,33 @@ foreach(src ${hueplusplus_SOURCES})
endforeach()
set(hueplusplus_SOURCES ${_srcList} PARENT_SCOPE)
# For install dir variables
include(GNUInstallDirs)
# hueplusplus shared library
add_library(hueplusplusshared SHARED ${hueplusplus_SOURCES})
target_link_libraries(hueplusplusshared PRIVATE mbedtls)
target_link_libraries(hueplusplusshared PRIVATE MbedTLS::mbedtls)
target_link_libraries(hueplusplusshared PUBLIC nlohmann_json::nlohmann_json)
target_compile_features(hueplusplusshared PUBLIC cxx_std_14)
target_include_directories(hueplusplusshared PUBLIC $<BUILD_INTERFACE:${hueplusplus_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
install(TARGETS hueplusplusshared DESTINATION lib)
# hueplusplus static library
add_library(hueplusplusstatic STATIC ${hueplusplus_SOURCES})
target_link_libraries(hueplusplusstatic PRIVATE mbedtls)
target_link_libraries(hueplusplusstatic PRIVATE MbedTLS::mbedtls)
target_link_libraries(hueplusplusstatic PUBLIC nlohmann_json::nlohmann_json)
target_compile_features(hueplusplusstatic PUBLIC cxx_std_14)
install(TARGETS hueplusplusstatic DESTINATION lib)
if(NOT WIN32)
# On windows, a shared library will also generate a .lib import library, making different names necessary.
# On other platforms the file endings are different, so the names can be the same.
set_target_properties(hueplusplusshared PROPERTIES OUTPUT_NAME hueplusplus SOVERSION 1)
set_target_properties(hueplusplusstatic PROPERTIES OUTPUT_NAME hueplusplus)
endif()
install(TARGETS hueplusplusshared DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS hueplusplusstatic DESTINATION ${CMAKE_INSTALL_LIBDIR})
target_include_directories(hueplusplusstatic PUBLIC $<BUILD_INTERFACE:${hueplusplus_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION include)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)

View File

@@ -21,7 +21,6 @@
**/
#include "hueplusplus/EntertainmentMode.h"
#include "mbedtls/certs.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/debug.h"
#include "mbedtls/entropy.h"
@@ -30,6 +29,8 @@
#include "mbedtls/ssl.h"
#include "mbedtls/timing.h"
#include "hueplusplus/HueExceptionMacro.h"
namespace hueplusplus
{
constexpr uint8_t HUE_ENTERTAINMENT_HEADER_SIZE = 16;
@@ -121,7 +122,16 @@ EntertainmentMode::EntertainmentMode(Bridge& b, Group& g)
/*-------------------------------------------------*\
| Seed the Deterministic Random Bit Generator (RNG) |
\*-------------------------------------------------*/
int ret = mbedtls_ctr_drbg_seed(&tls_context->ctr_drbg, mbedtls_entropy_func, &tls_context->entropy, NULL, 0);
if (mbedtls_ctr_drbg_seed(&tls_context->ctr_drbg, mbedtls_entropy_func, &tls_context->entropy, NULL, 0) != 0)
{
mbedtls_entropy_free(&tls_context->entropy);
mbedtls_ctr_drbg_free(&tls_context->ctr_drbg);
mbedtls_x509_crt_free(&tls_context->cacert);
mbedtls_ssl_config_free(&tls_context->conf);
mbedtls_ssl_free(&tls_context->ssl);
mbedtls_net_free(&tls_context->server_fd);
throw HueException(CURRENT_FILE_INFO, "Failed to seed mbedtls RNG");
}
}
EntertainmentMode::~EntertainmentMode()

View File

@@ -267,10 +267,7 @@ nlohmann::json CreateGroup::getRequest() const
{
result["name"] = name;
}
if (!roomType.empty())
{
result["class"] = roomType;
}
result["class"] = roomType.empty() ? "Other" : roomType;
return result;
}

View File

@@ -27,7 +27,7 @@
#include "hueplusplus/HueExceptionMacro.h"
#include "hueplusplus/Light.h"
#include "hueplusplus/Utils.h"
#include "json/json.hpp"
#include <nlohmann/json.hpp>
namespace hueplusplus
{

Some files were not shown because too many files have changed in this diff Show More