supla-device
Loading...
Searching...
No Matches
register_device.h
1/*
2 Copyright (C) AC SOFTWARE SP. Z O.O
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef SRC_SUPLA_DEVICE_REGISTER_DEVICE_H_
20#define SRC_SUPLA_DEVICE_REGISTER_DEVICE_H_
21
22#include <supla-common/proto.h>
23
24#include <stdint.h>
25
26namespace Supla {
27namespace RegisterDevice {
28
29TDS_SuplaRegisterDeviceHeader *getRegDevHeaderPtr();
30// Returns pointer to structure, which is filled with values from channel
31// at given index. Next call will return exactly the same pointer, but with
32// data from another channel, so please be careful when using this function
33TDS_SuplaDeviceChannel_D *getChannelPtr_D(int index);
34TDS_SuplaDeviceChannel_E *getChannelPtr_E(int index);
35
36// Device parameters
37bool isGUIDEmpty();
38bool isAuthKeyEmpty();
39bool isSoftVerEmpty();
40bool isNameEmpty();
41bool isServerNameEmpty();
42bool isEmailEmpty();
43
44const char *getGUID();
45const char *getAuthKey();
46const char *getSoftVer();
47const char *getName();
48void fillGUIDText(char text[37]);
49
50void setGUID(const char *GUID);
51void setAuthKey(const char *AuthKey);
52void setSoftVer(const char *SoftVer);
53void setName(const char *Name);
54
55void setEmail(const char *email);
56void setServerName(const char *server);
57
58const char *getEmail();
59const char *getServerName();
60
61bool isSuplaPublicServerConfigured();
62bool isSleepingDeviceEnabled();
63bool isRemoteDeviceConfigEnabled();
64bool isPairingSubdeviceEnabled();
65bool isAutomaticFirmwareUpdateEnabled();
66bool isSetCfgModePasswordEnabled();
67
68void setManufacturerId(int16_t mfrId);
69void setProductId(int16_t productId);
70
71int16_t getManufacturerId();
72int16_t getProductId();
73
74void addFlags(int32_t newFlags);
75void removeFlags(int32_t removedFlags);
76
77// Channel operations
78int getNextFreeChannelNumber();
79bool isChannelNumberFree(int channelNumber);
80void addChannel(int channelNumber);
81void removeChannel(int channelNumber);
82int getChannelCount();
83int getMaxChannelNumberUsed();
84
85void generateHttpAgent(char *buffer, int size);
86
87#ifdef SUPLA_TEST
88void resetToDefaults();
89int32_t getChannelFunctionList(int channelNumber);
90int32_t getChannelDefaultFunction(int channelNumber);
91int32_t getChannelType(int channelNumber);
92int getChannelNumber(int index);
93int8_t *getChannelValuePtr(int channelNumber);
94uint64_t getChannelFlags(int channelNumber);
95#endif
96
97} // namespace RegisterDevice
98} // namespace Supla
99
100#endif // SRC_SUPLA_DEVICE_REGISTER_DEVICE_H_