Skip to content

Commit

Permalink
Proto update
Browse files Browse the repository at this point in the history
  • Loading branch information
klew committed Dec 18, 2024
1 parent 5b3de7a commit b6dd2ac
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 21 deletions.
48 changes: 27 additions & 21 deletions src/supla-common/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ extern char sproto_tag[SUPLA_TAG_SIZE];
#define SUPLA_CHANNELFNC_PUMPSWITCH 960 // ver. >= 25
#define SUPLA_CHANNELFNC_HEATORCOLDSOURCESWITCH 970 // ver. >= 25
#define SUPLA_CHANNELFNC_CONTAINER 980 // ver. >= 26
#define SUPLA_CHANNELFNC_SEPTIC_TANK 981 // ver. >= 26
#define SUPLA_CHANNELFNC_WATER_TANK 982 // ver. >= 26
#define SUPLA_CHANNELFNC_CONTAINER_LEVEL_SENSOR 990 // ver. >= 26

#define SUPLA_BIT_FUNC_CONTROLLINGTHEGATEWAYLOCK 0x00000001
Expand Down Expand Up @@ -2113,6 +2115,7 @@ typedef struct {
#define SUPLA_CALCFG_CMD_RESTART_DEVICE 9400 // v. >= 25
#define SUPLA_CALCFG_CMD_RESTART_SUBDEVICE 9410 // v. >= 25
#define SUPLA_CALCFG_CMD_TAKE_OCR_PHOTO 9420 // v. >= 25
#define SUPLA_CALCFG_CMD_MUTE_ALARM_SOUND 9430 // v. >= 26

#define SUPLA_CALCFG_DATATYPE_RS_SETTINGS 1000
#define SUPLA_CALCFG_DATATYPE_FB_SETTINGS 1100 // v. >= 17
Expand Down Expand Up @@ -2323,8 +2326,14 @@ typedef struct {
active_bits; // Specifies which bits of the mask are not skipped
} TCSD_Digiglass_NewValue; // v. >= 14

#define CONTAINER_FLAG_WARNING_LEVEL (1 << 0)
#define CONTAINER_FLAG_ALARM_LEVEL (1 << 1)
#define CONTAINER_FLAG_INVALID_SENSOR_STATE (1 << 2)
#define CONTAINER_FLAG_SOUND_ALARM_ON (1 << 3)

typedef struct {
unsigned char level; // 0 - unknown; 1-101 - container fill level 0-100%
unsigned _supla_int16_t flags; // CONTAINER_FLAG_*
} TContainerChannel_Value; // v. >= 26

typedef struct {
Expand Down Expand Up @@ -3002,7 +3011,7 @@ typedef struct {
} TChannelConfig_TemperatureAndHumidity; // v. >= 21

// ChannelConfig for all binary sensors (all functions valid for
// SUPLA_CHANNELTYPE_BINARYSENSOR except Container Level Sensor)
// SUPLA_CHANNELTYPE_BINARYSENSOR)
// Device doesn't apply this inverted logic on communication towards server.
// It is used only for interanal purposes and for other external interfaces
// like MQTT
Expand All @@ -3016,20 +3025,6 @@ typedef struct {
unsigned char Reserved[29];
} TChannelConfig_BinarySensor; // v. >= 21

typedef struct {
unsigned char InvertedLogic; // 0 - not inverted, 1 - inverted
unsigned _supla_int16_t FilteringTimeMs; // 0 - not used, > 0 - time in ms
unsigned char FillLevel; // 0 - unknown, 1-101 - fill level in 0-100 %
union {
_supla_int_t ContainerChannelId;
struct {
unsigned char ContainerIsSet; // 0 - no; 1 - yes
unsigned char ContainerChannelNo;
};
};
unsigned char Reserved[24];
} TChannelConfig_ContainerLevelSensor; // v. >= 26

// Not set is set when there is no thermometer for "AUX" available
// at all.
// Disabled is set when thermometer is available (i.e. we can read it and show
Expand Down Expand Up @@ -3439,18 +3434,29 @@ typedef struct {
unsigned char Reserved[32];
} TChannelConfig_ImpulseCounter; // v. >= 25

typedef struct {
unsigned char FillLevel; // 0 - unknown, 1-101 - fill level in 0-100 %
union {
_supla_int_t ContainerChannelId;
struct {
unsigned char ContainerIsSet; // 0 - no; 1 - yes
unsigned char ContainerChannelNo;
};
};
} TContainer_SensorInfo;


typedef struct {
unsigned char WarningAboveLevel; // 0 - not set, 1-101 for 0-100%
unsigned char AlarmAboveLevel; // 0 - not set, 1-101 for 0-100%
unsigned char WarningBelowLevel; // 0 - not set, 1-101 for 0-100%
unsigned char AlarmBelowLevel; // 0 - not set, 1-101 for 0-100%

unsigned char VisualizationType; // 0 - default, other values depends on
// Cloud and App support,
// 1 - septic tank
// 2 - rainwater tank
// 3 - coal container (tbd)
// 4 - salt container (tbd)
unsigned char MuteAlarmSoundWithoutAdditionalAuth; // 0 - admin login is
// required, 1 - regular
// user is allowed

TContainer_SensorInfo SensorInfo[10];
unsigned char Reserved[32];
} TChannelConfig_Container; // v. >= 26

Expand Down
8 changes: 8 additions & 0 deletions src/supla-common/proto_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ static_assert(sizeof(TChannelConfig_PowerSwitch) == 42);
static_assert(sizeof(TChannelConfig_PowerSwitch) <=
(unsigned int)SUPLA_CHANNEL_CONFIG_MAXSIZE);

static_assert(sizeof(TContainerChannel_Value) == 3);
static_assert(sizeof(TContainerChannel_Value) <=
(unsigned int)SUPLA_CHANNELVALUE_SIZE);

static_assert(sizeof(TChannelConfig_Container) == 87);
static_assert(sizeof(TChannelConfig_Container) <=
(unsigned int)SUPLA_CHANNEL_CONFIG_MAXSIZE);

static_assert(SUPLA_CHANNEL_CAPTION_MAXSIZE == SUPLA_CAPTION_MAXSIZE);
static_assert(SUPLA_LOCATION_CAPTION_MAXSIZE == SUPLA_CAPTION_MAXSIZE);
static_assert(SUPLA_SCENE_CAPTION_MAXSIZE == SUPLA_CAPTION_MAXSIZE);
Expand Down

0 comments on commit b6dd2ac

Please sign in to comment.