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();
65
66void setManufacturerId(int16_t mfrId);
67void setProductId(int16_t productId);
68
69int16_t getManufacturerId();
70int16_t getProductId();
71
72void addFlags(int32_t newFlags);
73void removeFlags(int32_t removedFlags);
74
75// Channel operations
76int getNextFreeChannelNumber();
77bool isChannelNumberFree(int channelNumber);
78void addChannel(int channelNumber);
79void removeChannel(int channelNumber);
80int getChannelCount();
81int getMaxChannelNumberUsed();
82
83#ifdef SUPLA_TEST
84void resetToDefaults();
85int32_t getChannelFunctionList(int channelNumber);
86int32_t getChannelDefaultFunction(int channelNumber);
87int32_t getChannelType(int channelNumber);
88int getChannelNumber(int index);
89int8_t *getChannelValuePtr(int channelNumber);
90uint64_t getChannelFlags(int channelNumber);
91#endif
92
93} // namespace RegisterDevice
94} // namespace Supla
95
96#endif // SRC_SUPLA_DEVICE_REGISTER_DEVICE_H_