avr/reed: implemented tilt detection mode
- implemented tilt detection mode - added docu - change the way a VALUE2 message is printed when value type is "door"
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
uint32_t AQH_Value2Msg_GetUid(const GWEN_MSG *msg)
|
||||
{
|
||||
return GWEN_Msg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_UID, 0);
|
||||
@@ -72,6 +73,7 @@ const char *AQH_Value2Msg_GetValueTypeName(const GWEN_MSG *msg)
|
||||
switch(t) {
|
||||
case AQH_MSG_VALUE2_TYPE_TEMP: return "temperature";
|
||||
case AQH_MSG_VALUE2_TYPE_HUMIDITY: return "humidity";
|
||||
case AQH_MSG_VALUE2_TYPE_DOOR: return "door/window";
|
||||
default: break;
|
||||
}
|
||||
return "unknown";
|
||||
@@ -79,6 +81,19 @@ const char *AQH_Value2Msg_GetValueTypeName(const GWEN_MSG *msg)
|
||||
|
||||
|
||||
|
||||
const char *AQH_Value2Msg_GetValueAsWindowStateString(const GWEN_MSG *msg)
|
||||
{
|
||||
switch(AQH_Value2Msg_GetValueNom(msg)) {
|
||||
case 0: return "closed";
|
||||
case 128: return "tilted";
|
||||
case 255: return "fully open";
|
||||
default: break;
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
|
||||
|
||||
double AQH_Value2Msg_GetValue(const GWEN_MSG *msg)
|
||||
{
|
||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_VALUE2) &&
|
||||
@@ -106,18 +121,27 @@ void AQH_Value2Msg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const ch
|
||||
{
|
||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_VALUE2) &&
|
||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE2_MINSIZE)) {
|
||||
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: VALUE2 %s (uid=0x%08x, value_id=0x%02x type=%s value=%f)\n",
|
||||
AQH_NodeMsg_GetSourceAddress(msg),
|
||||
AQH_NodeMsg_GetDestAddress(msg),
|
||||
sText,
|
||||
(unsigned int) AQH_Value2Msg_GetUid(msg),
|
||||
AQH_Value2Msg_GetValueId(msg),
|
||||
AQH_Value2Msg_GetValueTypeName(msg),
|
||||
AQH_Value2Msg_GetValue(msg));
|
||||
if (AQH_Value2Msg_GetValueType(msg)==AQH_MSG_VALUE2_TYPE_DOOR)
|
||||
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: VALUE2 %s (uid=0x%08x, value_id=0x%02x type=%s value=%s)\n",
|
||||
AQH_NodeMsg_GetSourceAddress(msg),
|
||||
AQH_NodeMsg_GetDestAddress(msg),
|
||||
sText,
|
||||
(unsigned int) AQH_Value2Msg_GetUid(msg),
|
||||
AQH_Value2Msg_GetValueId(msg),
|
||||
AQH_Value2Msg_GetValueTypeName(msg),
|
||||
AQH_Value2Msg_GetValueAsWindowStateString(msg));
|
||||
else
|
||||
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: VALUE2 %s (uid=0x%08x, value_id=0x%02x type=%s value=%f)\n",
|
||||
AQH_NodeMsg_GetSourceAddress(msg),
|
||||
AQH_NodeMsg_GetDestAddress(msg),
|
||||
sText,
|
||||
(unsigned int) AQH_Value2Msg_GetUid(msg),
|
||||
AQH_Value2Msg_GetValueId(msg),
|
||||
AQH_Value2Msg_GetValueTypeName(msg),
|
||||
AQH_Value2Msg_GetValue(msg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#define AQH_MSG_VALUE2_TYPE_TEMP 1
|
||||
#define AQH_MSG_VALUE2_TYPE_HUMIDITY 2
|
||||
#define AQH_MSG_VALUE2_TYPE_DOOR 3
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +32,7 @@ AQHOME_API int16_t AQH_Value2Msg_GetValueDenom(const GWEN_MSG *msg);
|
||||
|
||||
AQHOME_API double AQH_Value2Msg_GetValue(const GWEN_MSG *msg);
|
||||
|
||||
AQHOME_API const char *AQH_Value2Msg_GetValueAsWindowStateString(const GWEN_MSG *msg);
|
||||
|
||||
AQHOME_API void AQH_Value2Msg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user