aqhome: fixed compiler warnings.
This commit is contained in:
@@ -50,7 +50,6 @@ static void _writeToLogFile(const char *filename, const char *txt);
|
|||||||
|
|
||||||
GWEN_MSG_ENDPOINT *AQH_LogEndpoint_new(const char *filename, int groupId)
|
GWEN_MSG_ENDPOINT *AQH_LogEndpoint_new(const char *filename, int groupId)
|
||||||
{
|
{
|
||||||
int fd;
|
|
||||||
GWEN_MSG_ENDPOINT *ep;
|
GWEN_MSG_ENDPOINT *ep;
|
||||||
AQH_MSG_ENDPOINT_LOG *xep;
|
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)
|
void _logMessage(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
AQH_MSG_ENDPOINT_LOG *xep;
|
AQH_MSG_ENDPOINT_LOG *xep;
|
||||||
const uint8_t *ptr;
|
|
||||||
uint8_t len;
|
|
||||||
uint8_t msgType;
|
uint8_t msgType;
|
||||||
int msgIsValid;
|
int msgIsValid;
|
||||||
GWEN_BUFFER *dbuf;
|
GWEN_BUFFER *dbuf;
|
||||||
@@ -120,25 +117,28 @@ void _logMessage(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
|
|||||||
ti=NULL;
|
ti=NULL;
|
||||||
|
|
||||||
msgIsValid=(AQH_NodeMsg_IsChecksumValid(msg) && AQH_NodeMsg_IsMsgComplete(msg));
|
msgIsValid=(AQH_NodeMsg_IsChecksumValid(msg) && AQH_NodeMsg_IsMsgComplete(msg));
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg);
|
|
||||||
len=GWEN_Msg_GetBytesInBuffer(msg);
|
|
||||||
msgType=AQH_NodeMsg_GetMsgType(msg);
|
msgType=AQH_NodeMsg_GetMsgType(msg);
|
||||||
|
|
||||||
switch(msgType) {
|
if (msgIsValid) {
|
||||||
case AQH_MSG_TYPE_PING: AQH_PingMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
switch(msgType) {
|
||||||
case AQH_MSG_TYPE_PONG: AQH_PongMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_PING: AQH_PingMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_COMSENDSTATS: AQH_SendStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_PONG: AQH_PongMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_COMRECVSTATS: AQH_RecvStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_COMSENDSTATS: AQH_SendStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_TWIBUSMEMBER: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_COMRECVSTATS: AQH_RecvStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_DEBUG: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_TWIBUSMEMBER: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_VALUE: AQH_ValueMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_DEBUG: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_VALUE2: AQH_Value2Msg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_VALUE: AQH_ValueMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_NEED_ADDRESS: AQH_NeedAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_VALUE2: AQH_Value2Msg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_CLAIM_ADDRESS: AQH_ClaimAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_NEED_ADDRESS: AQH_NeedAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_HAVE_ADDRESS: AQH_HaveAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_CLAIM_ADDRESS: AQH_ClaimAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_DENY_ADDRESS: AQH_DenyAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_HAVE_ADDRESS: AQH_HaveAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_DEVICE: AQH_DeviceMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_DENY_ADDRESS: AQH_DenyAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
default: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
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));
|
_writeToLogFile(xep->filename, GWEN_Buffer_GetStart(dbuf));
|
||||||
GWEN_Buffer_free(dbuf);
|
GWEN_Buffer_free(dbuf);
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ int _handleReadable(GWEN_MSG_ENDPOINT *ep, GWEN_UNUSED GWEN_MSG_ENDPOINT_MGR *em
|
|||||||
/* complete msg received, add to list */
|
/* complete msg received, add to list */
|
||||||
if (!AQH_NodeMsg_IsChecksumValid(msg)) {
|
if (!AQH_NodeMsg_IsChecksumValid(msg)) {
|
||||||
DBG_ERROR(AQH_LOGDOMAIN, "Invalid checksum, discarding message");
|
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);
|
GWEN_MsgEndpoint_SetCurrentlyReceivedMsg(ep, NULL);
|
||||||
rv=GWEN_MsgEndpoint_DiscardInput(ep);
|
rv=GWEN_MsgEndpoint_DiscardInput(ep);
|
||||||
if (rv<0) {
|
if (rv<0) {
|
||||||
@@ -254,11 +254,8 @@ int _openDevice(GWEN_MSG_ENDPOINT *ep)
|
|||||||
{
|
{
|
||||||
AQH_MSG_ENDPOINT_TTY *xep;
|
AQH_MSG_ENDPOINT_TTY *xep;
|
||||||
int fd;
|
int fd;
|
||||||
int status;
|
|
||||||
int i;
|
|
||||||
struct termios options;
|
struct termios options;
|
||||||
int rv;
|
int rv;
|
||||||
int m;
|
|
||||||
|
|
||||||
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_MSG_ENDPOINT_TTY, ep);
|
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_MSG_ENDPOINT_TTY, ep);
|
||||||
assert(xep);
|
assert(xep);
|
||||||
@@ -336,6 +333,7 @@ int _endMsg(GWEN_MSG_ENDPOINT *ep)
|
|||||||
{
|
{
|
||||||
/* TODO: flush before releasing ATTN */
|
/* TODO: flush before releasing ATTN */
|
||||||
_attnHigh(ep);
|
_attnHigh(ep);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user