aqhome: fixed compiler warnings.

This commit is contained in:
Martin Preuss
2023-03-20 22:49:39 +01:00
parent 8712958228
commit ce899896bf
2 changed files with 22 additions and 24 deletions

View File

@@ -50,7 +50,6 @@ static void _writeToLogFile(const char *filename, const char *txt);
GWEN_MSG_ENDPOINT *AQH_LogEndpoint_new(const char *filename, int groupId)
{
int fd;
GWEN_MSG_ENDPOINT *ep;
AQH_MSG_ENDPOINT_LOG *xep;
@@ -104,8 +103,6 @@ void _run(GWEN_MSG_ENDPOINT *ep)
void _logMessage(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
{
AQH_MSG_ENDPOINT_LOG *xep;
const uint8_t *ptr;
uint8_t len;
uint8_t msgType;
int msgIsValid;
GWEN_BUFFER *dbuf;
@@ -120,10 +117,9 @@ void _logMessage(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
ti=NULL;
msgIsValid=(AQH_NodeMsg_IsChecksumValid(msg) && AQH_NodeMsg_IsMsgComplete(msg));
ptr=GWEN_Msg_GetConstBuffer(msg);
len=GWEN_Msg_GetBytesInBuffer(msg);
msgType=AQH_NodeMsg_GetMsgType(msg);
if (msgIsValid) {
switch(msgType) {
case AQH_MSG_TYPE_PING: AQH_PingMsg_DumpToBuffer(msg, dbuf, "received"); break;
case AQH_MSG_TYPE_PONG: AQH_PongMsg_DumpToBuffer(msg, dbuf, "received"); break;
@@ -140,6 +136,10 @@ void _logMessage(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
case AQH_MSG_TYPE_DEVICE: AQH_DeviceMsg_DumpToBuffer(msg, dbuf, "received"); break;
default: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
}
}
else {
AQH_NodeMsg_DumpToBuffer(msg, dbuf, "(invalid) received");
}
_writeToLogFile(xep->filename, GWEN_Buffer_GetStart(dbuf));
GWEN_Buffer_free(dbuf);
}

View File

@@ -167,7 +167,7 @@ int _handleReadable(GWEN_MSG_ENDPOINT *ep, GWEN_UNUSED GWEN_MSG_ENDPOINT_MGR *em
/* complete msg received, add to list */
if (!AQH_NodeMsg_IsChecksumValid(msg)) {
DBG_ERROR(AQH_LOGDOMAIN, "Invalid checksum, discarding message");
GWEN_Text_DumpString(GWEN_Msg_GetBuffer(msg), GWEN_Msg_GetBytesInBuffer(msg), 6);
GWEN_Text_DumpString((const char*) GWEN_Msg_GetBuffer(msg), GWEN_Msg_GetBytesInBuffer(msg), 6);
GWEN_MsgEndpoint_SetCurrentlyReceivedMsg(ep, NULL);
rv=GWEN_MsgEndpoint_DiscardInput(ep);
if (rv<0) {
@@ -254,11 +254,8 @@ int _openDevice(GWEN_MSG_ENDPOINT *ep)
{
AQH_MSG_ENDPOINT_TTY *xep;
int fd;
int status;
int i;
struct termios options;
int rv;
int m;
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_MSG_ENDPOINT_TTY, ep);
assert(xep);
@@ -336,6 +333,7 @@ int _endMsg(GWEN_MSG_ENDPOINT *ep)
{
/* TODO: flush before releasing ATTN */
_attnHigh(ep);
return 0;
}