Publish LumaOps source

This commit is contained in:
LumaOps release export
2026-09-03 01:18:36 +02:00
commit 7f1c0e5f71
2363 changed files with 501543 additions and 0 deletions
@@ -0,0 +1,44 @@
/**
\file mock_BaseHttpHandler.h
Copyright Notice\n
Copyright (C) 2017 Jan Rogall - developer\n
Copyright (C) 2017 Moritz Wirger - developer\n
This file is part of hueplusplus.
hueplusplus is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
hueplusplus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with hueplusplus. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef _MOCK_BASE_HTTPHANDLER_H
#define _MOCK_BASE_HTTPHANDLER_H
#include <string>
#include <vector>
#include <gmock/gmock.h>
#include "hueplusplus/BaseHttpHandler.h"
#include <nlohmann/json.hpp>
//! Mock Class
class MockBaseHttpHandler : public hueplusplus::BaseHttpHandler
{
public:
MOCK_CONST_METHOD3(send, std::string(const std::string& msg, const std::string& adr, int port));
MOCK_CONST_METHOD4(
sendMulticast, std::vector<std::string>(const std::string& msg, const std::string& adr, int port, std::chrono::steady_clock::duration timeout));
};
#endif
@@ -0,0 +1,79 @@
/**
\file mock_HttpHandler.h
Copyright Notice\n
Copyright (C) 2017 Jan Rogall - developer\n
Copyright (C) 2017 Moritz Wirger - developer\n
This file is part of hueplusplus.
hueplusplus is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
hueplusplus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with hueplusplus. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef _MOCK_HTTPHANDLER_H
#define _MOCK_HTTPHANDLER_H
#include <string>
#include <vector>
#include <gmock/gmock.h>
#include "hueplusplus/IHttpHandler.h"
#include <nlohmann/json.hpp>
//! Mock Class
class MockHttpHandler : public hueplusplus::IHttpHandler
{
public:
MOCK_CONST_METHOD3(send, std::string(const std::string& msg, const std::string& adr, int port));
MOCK_CONST_METHOD3(sendGetHTTPBody, std::string(const std::string& msg, const std::string& adr, int port));
MOCK_CONST_METHOD4(sendMulticast,
std::vector<std::string>(
const std::string& msg, const std::string& adr, int port, std::chrono::steady_clock::duration timeout));
MOCK_CONST_METHOD6(sendHTTPRequest,
std::string(const std::string& method, const std::string& uri, const std::string& content_type,
const std::string& body, const std::string& adr, int port));
MOCK_CONST_METHOD5(GETString,
std::string(const std::string& uri, const std::string& content_type, const std::string& body,
const std::string& adr, int port));
MOCK_CONST_METHOD5(POSTString,
std::string(const std::string& uri, const std::string& content_type, const std::string& body,
const std::string& adr, int port));
MOCK_CONST_METHOD5(PUTString,
std::string(const std::string& uri, const std::string& content_type, const std::string& body,
const std::string& adr, int port));
MOCK_CONST_METHOD5(DELETEString,
std::string(const std::string& uri, const std::string& content_type, const std::string& body,
const std::string& adr, int port));
MOCK_CONST_METHOD4(
GETJson, nlohmann::json(const std::string& uri, const nlohmann::json& body, const std::string& adr, int port));
MOCK_CONST_METHOD4(
POSTJson, nlohmann::json(const std::string& uri, const nlohmann::json& body, const std::string& adr, int port));
MOCK_CONST_METHOD4(
PUTJson, nlohmann::json(const std::string& uri, const nlohmann::json& body, const std::string& adr, int port));
MOCK_CONST_METHOD4(DELETEJson,
nlohmann::json(const std::string& uri, const nlohmann::json& body, const std::string& adr, int port));
};
#endif
+130
View File
@@ -0,0 +1,130 @@
/**
\file mock_Light.h
Copyright Notice\n
Copyright (C) 2017 Jan Rogall - developer\n
Copyright (C) 2017 Moritz Wirger - developer\n
This file is part of hueplusplus.
hueplusplus is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
hueplusplus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with hueplusplus. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef _MOCK_HUE_LIGHT_H
#define _MOCK_HUE_LIGHT_H
#include <string>
#include <vector>
#include <gmock/gmock.h>
#include "../testhelper.h"
#include "hueplusplus/Light.h"
#include <nlohmann/json.hpp>
//! Mock Class
class MockLight : public hueplusplus::Light
{
public:
MockLight(std::shared_ptr<const hueplusplus::IHttpHandler> handler)
: Light(1, hueplusplus::HueCommandAPI(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler), nullptr,
nullptr, nullptr, std::chrono::steady_clock::duration::max(), nullptr)
{
// Set refresh duration to max, so random refreshes do not hinder the test setups
}
nlohmann::json& getState() { return state.getValue(); }
MOCK_METHOD1(on, bool(uint8_t transition));
MOCK_METHOD1(off, bool(uint8_t transition));
MOCK_METHOD0(isOn, bool());
MOCK_CONST_METHOD0(isOn, bool());
MOCK_CONST_METHOD0(getId, int());
MOCK_CONST_METHOD0(getType, std::string());
MOCK_METHOD0(getName, std::string());
MOCK_CONST_METHOD0(getName, std::string());
MOCK_CONST_METHOD0(getModelId, std::string());
MOCK_CONST_METHOD0(getUId, std::string());
MOCK_CONST_METHOD0(getManufacturername, std::string());
MOCK_CONST_METHOD0(getLuminaireUId, std::string());
MOCK_METHOD0(getSwVersion, std::string());
MOCK_CONST_METHOD0(getSwVersion, std::string());
MOCK_METHOD1(setName, bool(const std::string& name));
MOCK_CONST_METHOD0(getColorType, hueplusplus::ColorType());
MOCK_CONST_METHOD0(hasBrightnessControl, bool());
MOCK_CONST_METHOD0(hasTemperatureControl, bool());
MOCK_CONST_METHOD0(hasColorControl, bool());
MOCK_METHOD2(setBrightness, bool(unsigned int bri, uint8_t transition));
MOCK_CONST_METHOD0(getBrightness, unsigned int());
MOCK_METHOD0(getBrightness, unsigned int());
MOCK_METHOD2(setColorTemperature, bool(unsigned int mired, uint8_t transition));
MOCK_CONST_METHOD0(getColorTemperature, unsigned int());
MOCK_METHOD0(getColorTemperature, unsigned int());
MOCK_METHOD2(setColorHue, bool(uint16_t hue, uint8_t transition));
MOCK_METHOD2(setColorSaturation, bool(uint8_t sat, uint8_t transition));
MOCK_METHOD2(setColorHueSaturation, bool(const hueplusplus::HueSaturation& hueSat, uint8_t transition));
MOCK_CONST_METHOD0(getColorHueSaturation, hueplusplus::HueSaturation());
MOCK_METHOD0(getColorHueSaturation, hueplusplus::HueSaturation());
MOCK_METHOD2(setColorXY, bool(const hueplusplus::XYBrightness& xy, uint8_t transition));
MOCK_CONST_METHOD0(getColorXY, hueplusplus::XYBrightness());
MOCK_METHOD0(getColorXY, hueplusplus::XYBrightness());
MOCK_METHOD2(setColorRGB, bool(const hueplusplus::RGB& rgb, uint8_t transition));
MOCK_METHOD0(alert, bool());
MOCK_METHOD1(alertTemperature, bool(unsigned int mired));
MOCK_METHOD1(alertHueSaturation, bool(const hueplusplus::HueSaturation& hueSat));
MOCK_METHOD1(alertXY, bool(const hueplusplus::XYBrightness& xy));
MOCK_METHOD1(setColorLoop, bool(bool on));
MOCK_METHOD3(sendPutRequest,
nlohmann::json(const std::string& subPath, const nlohmann::json& request, hueplusplus::FileInfo fileInfo));
};
#endif