/**************************************************************************** * This file is part of the project AqHome. * AqHome (c) by 2025 Martin Preuss, all rights reserved. * * The license for this file can be found in the file COPYING which you * should have received along with this file. ****************************************************************************/ #ifndef AQHOME_CGI_MODULES_DEVICES_H #define AQHOME_CGI_MODULES_DEVICES_H #include "aqhome-cgi/modules/mdataclient.h" #include "aqhome/aqhome.h" #include "aqhome/dataclient/client.h" #include #include #include #define AQH_MODDEVICES_PERMS_DEVICEREAD 0x001 #define AQH_MODDEVICES_PERMS_DEVICEWRITE 0x002 #define AQH_MODDEVICES_PERMS_DEVICEADD 0x004 #define AQH_MODDEVICES_PERMS_DEVICEDEL 0x008 #define AQH_MODDEVICES_PERMS_VALUEREAD 0x010 #define AQH_MODDEVICES_PERMS_VALUEWRITE 0x020 #define AQH_MODDEVICES_PERMS_VALUEADD 0x040 #define AQH_MODDEVICES_PERMS_VALUEDEL 0x080 #define AQH_MODDEVICES_PERMS_VALUESET 0x100 #define AQH_MODDEVICES_GRAPH_WIDTH 640 #define AQH_MODDEVICES_GRAPH_HEIGHT 480 void AQH_ModDevices_Extend(AQH_MODULE *m, AQH_SERVICE *sv, const char *baseFolder); int AQH_ModDevices_Create(AQH_SERVICE *sv); uint32_t AQH_ModDevices_ColorFromHexString(const char *s); uint32_t AQH_ModDevices_HtmlColorToValueRGBW(uint32_t colorIn); uint32_t AQH_ModDevices_RgbwToHtmlColor(uint32_t colorIn); uint32_t AQH_ModDevices_RgbwFromComponents(int r, int g, int b, int w); int AQH_ModDevices_RgbwGetR(uint32_t color); int AQH_ModDevices_RgbwGetG(uint32_t color); int AQH_ModDevices_RgbwGetB(uint32_t color); int AQH_ModDevices_RgbwGetW(uint32_t color); AQH_VALUE *AQH_ModDevices_GetValueForDevice(AQH_DATACLIENT *dc, const char *sDeviceName, const char *sValueName); AQH_DEVICE *AQH_ModDevices_GetDevice(AQH_DATACLIENT *dc, const char *sDeviceName); int AQH_ModDevices_ValueGetLastDataAsInt(AQH_DATACLIENT *dc, const AQH_VALUE *value, int defaultValue); uint32_t AQH_ModDevices_ValueGetLastDataAsUint32(AQH_DATACLIENT *dc, const AQH_VALUE *value, uint32_t defaultValue); AQDG_GRAPH_DATAPAIR_LIST *AQH_ModDevices_RequestDataPairList(AQH_DATACLIENT *dc, const char *systemValueName, uint64_t tsBegin, uint64_t tsEnd, uint64_t num); #endif