adapted to latest changes in gwen (msgio API v2 becomes v1).

This commit is contained in:
Martin Preuss
2023-07-12 19:30:53 +02:00
parent 7a4edb6854
commit 0fd58567fe
37 changed files with 956 additions and 956 deletions

View File

@@ -143,7 +143,7 @@ int main(int argc, char **argv)
int _serve(GWEN_DB_NODE *dbArgs)
{
const char *pidFile;
GWEN_MSG_ENDPOINT2 *epTcp;
GWEN_MSG_ENDPOINT *epTcp;
ITEM_LIST *itemList;
int rv;
int timeout;
@@ -186,7 +186,7 @@ int _serve(GWEN_DB_NODE *dbArgs)
rv=AqHomeMqttLog_MqttConnect(epTcp);
if (rv<0) {
DBG_INFO(NULL, "here (%d)", rv);
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
Item_List_free(itemList);
return rv;
}
@@ -194,7 +194,7 @@ int _serve(GWEN_DB_NODE *dbArgs)
rv=AqHomeMqttLog_Subscribe(epTcp, "#");
if (rv<0) {
DBG_INFO(NULL, "here (%d)", rv);
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
Item_List_free(itemList);
return rv;
}
@@ -203,14 +203,14 @@ int _serve(GWEN_DB_NODE *dbArgs)
while(!stopService) {
DBG_DEBUG(NULL, "Next loop");
GWEN_MsgEndpoint2_IoLoop(epTcp, 2000); /* 2000 ms */
if (GWEN_MsgEndpoint2_GetState(epTcp)!=GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */
if (GWEN_MsgEndpoint_GetState(epTcp)!=GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
DBG_INFO(NULL, "Not connected...");
}
else {
GWEN_MSG *msg;
msg=GWEN_MsgEndpoint2_TakeFirstReceivedMessage(epTcp);
msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp);
if (msg) {
#ifdef FULL_DEBUG
DBG_ERROR(NULL, "Received this message:");
@@ -267,7 +267,7 @@ int _serve(GWEN_DB_NODE *dbArgs)
if (pidFile && *pidFile)
remove(pidFile);
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
Item_List_free(itemList);
return 0;
}

View File

@@ -15,7 +15,7 @@
#include <aqhome/api.h>
#include <aqhome/aqhome.h>
#include "aqhome/mqtt/endpoint2_mqttc.h"
#include "aqhome/mqtt/endpoint_mqttc.h"
#include <aqhome/mqtt/msg_mqtt_connect.h>
#include <aqhome/mqtt/msg_mqtt_connack.h>
#include <aqhome/mqtt/msg_mqtt_publish.h>
@@ -44,7 +44,7 @@
* ------------------------------------------------------------------------------------------------
*/
static GWEN_MSG *_awaitPacket(GWEN_MSG_ENDPOINT2 *epTcp, uint8_t expectedPacketType, int timeoutInSeconds);
static GWEN_MSG *_awaitPacket(GWEN_MSG_ENDPOINT *epTcp, uint8_t expectedPacketType, int timeoutInSeconds);
@@ -53,7 +53,7 @@ static GWEN_MSG *_awaitPacket(GWEN_MSG_ENDPOINT2 *epTcp, uint8_t expectedPacketT
* ------------------------------------------------------------------------------------------------
*/
GWEN_MSG_ENDPOINT2 *AqHomeMqttLog_CreateMqttEndpoint(GWEN_DB_NODE *dbArgs)
GWEN_MSG_ENDPOINT *AqHomeMqttLog_CreateMqttEndpoint(GWEN_DB_NODE *dbArgs)
{
const char *mqttAddress;
int mqttPort;
@@ -68,17 +68,17 @@ GWEN_MSG_ENDPOINT2 *AqHomeMqttLog_CreateMqttEndpoint(GWEN_DB_NODE *dbArgs)
mqttKeepAlive=GWEN_DB_GetIntValue(dbArgs, "mqttKeepAlive", 0, 600);
if (mqttAddress && *mqttAddress && mqttPort) {
GWEN_MSG_ENDPOINT2 *epMqtt;
GWEN_MSG_ENDPOINT *epMqtt;
DBG_INFO(AQH_LOGDOMAIN, "Connecting to %s (port %d)", mqttAddress, mqttPort);
epMqtt=AQH_MqttClientEndpoint2_new(mqttClientId, mqttAddress, mqttPort, NULL, 0);
epMqtt=AQH_MqttClientEndpoint_new(mqttClientId, mqttAddress, mqttPort, NULL, 0);
if (epMqtt==NULL) {
DBG_ERROR(AQH_LOGDOMAIN, "Error creating endpoint TCP");
return NULL;
}
if (mqttTopicPrefix && *mqttTopicPrefix)
AQH_MqttClientEndpoint2_SetTopicPrefix(epMqtt, mqttTopicPrefix);
AQH_MqttClientEndpoint2_SetKeepAliveTime(epMqtt, mqttKeepAlive);
AQH_MqttClientEndpoint_SetTopicPrefix(epMqtt, mqttTopicPrefix);
AQH_MqttClientEndpoint_SetKeepAliveTime(epMqtt, mqttKeepAlive);
return epMqtt;
}
@@ -88,41 +88,41 @@ GWEN_MSG_ENDPOINT2 *AqHomeMqttLog_CreateMqttEndpoint(GWEN_DB_NODE *dbArgs)
int AqHomeMqttLog_MqttConnect(GWEN_MSG_ENDPOINT2 *epTcp)
int AqHomeMqttLog_MqttConnect(GWEN_MSG_ENDPOINT *epTcp)
{
if (GWEN_MsgEndpoint2_GetState(epTcp)==GWEN_MSG_ENDPOINT_STATE_UNCONNECTED) {
if (GWEN_MsgEndpoint_GetState(epTcp)==GWEN_MSG_ENDPOINT_STATE_UNCONNECTED) {
int rv;
rv=AQH_MqttClientEndpoint2_StartConnect(epTcp);
rv=AQH_MqttClientEndpoint_StartConnect(epTcp);
if (rv<0 && rv!=GWEN_ERROR_IN_PROGRESS) {
DBG_ERROR(NULL, "Error starting to connect (%d)", rv);
return rv;
}
}
while(GWEN_MsgEndpoint2_GetState(epTcp)!=GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
while(GWEN_MsgEndpoint_GetState(epTcp)!=GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
DBG_DEBUG(NULL, "Next loop");
GWEN_MsgEndpoint2_IoLoop(epTcp, 2000); /* 2000 ms */
GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */
}
return 0;
}
int AqHomeMqttLog_Subscribe(GWEN_MSG_ENDPOINT2 *epTcp, const char *topicFilter)
int AqHomeMqttLog_Subscribe(GWEN_MSG_ENDPOINT *epTcp, const char *topicFilter)
{
uint16_t pckId;
GWEN_MSG *msgOut;
GWEN_MSG *msgIn;
DBG_INFO(NULL, "Sending SUBSCRIBE %s", topicFilter);
pckId=AQH_MqttClientEndpoint2_GetNextPacketId(epTcp);
pckId=AQH_MqttClientEndpoint_GetNextPacketId(epTcp);
msgOut=GWEN_SubscribeMqttMsg_new(AQH_MQTTMSG_MSGTYPE_SUBSCRIBE, pckId, topicFilter, 0);
if (msgOut==NULL) {
DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_INTERNAL;
}
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
DBG_INFO(NULL, "Waiting for response");
msgIn=_awaitPacket(epTcp, AQH_MQTTMSG_MSGTYPE_SUBACK, AQHOME_MQTTLOG_DEFAULT_CMDTIMEOUT);
@@ -141,7 +141,7 @@ int AqHomeMqttLog_Subscribe(GWEN_MSG_ENDPOINT2 *epTcp, const char *topicFilter)
int AqHomeMqttLog_Ping(GWEN_MSG_ENDPOINT2 *epTcp)
int AqHomeMqttLog_Ping(GWEN_MSG_ENDPOINT *epTcp)
{
GWEN_MSG *msgOut;
@@ -151,14 +151,14 @@ int AqHomeMqttLog_Ping(GWEN_MSG_ENDPOINT2 *epTcp)
DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_INTERNAL;
}
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
return 0;
}
GWEN_MSG *_awaitPacket(GWEN_MSG_ENDPOINT2 *epTcp, uint8_t expectedPacketType, int timeoutInSeconds)
GWEN_MSG *_awaitPacket(GWEN_MSG_ENDPOINT *epTcp, uint8_t expectedPacketType, int timeoutInSeconds)
{
time_t startTime;
@@ -168,8 +168,8 @@ GWEN_MSG *_awaitPacket(GWEN_MSG_ENDPOINT2 *epTcp, uint8_t expectedPacketType, in
GWEN_MSG *msg;
time_t now;
GWEN_MsgEndpoint2_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint2_TakeFirstReceivedMessage(epTcp);
GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp);
if (msg) {
if ((AQH_MqttMsg_GetMsgTypeAndFlags(msg) & 0xf0)==(expectedPacketType & 0xf0)) {
return msg;

View File

@@ -10,16 +10,16 @@
#define AQHOME_TOOL_MQTT_H
#include "aqhome/mqtt/endpoint2_mqttc.h"
#include "aqhome/mqtt/endpoint_mqttc.h"
#include <gwenhywfar/db.h>
GWEN_MSG_ENDPOINT2 *AqHomeMqttLog_CreateMqttEndpoint(GWEN_DB_NODE *dbArgs);
int AqHomeMqttLog_MqttConnect(GWEN_MSG_ENDPOINT2 *epTcp);
int AqHomeMqttLog_Subscribe(GWEN_MSG_ENDPOINT2 *epTcp, const char *topicFilter);
int AqHomeMqttLog_Ping(GWEN_MSG_ENDPOINT2 *epTcp);
GWEN_MSG_ENDPOINT *AqHomeMqttLog_CreateMqttEndpoint(GWEN_DB_NODE *dbArgs);
int AqHomeMqttLog_MqttConnect(GWEN_MSG_ENDPOINT *epTcp);
int AqHomeMqttLog_Subscribe(GWEN_MSG_ENDPOINT *epTcp, const char *topicFilter);
int AqHomeMqttLog_Ping(GWEN_MSG_ENDPOINT *epTcp);

View File

@@ -13,7 +13,7 @@
#include "./flash.h"
#include "./utils.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h"
#include "aqhome/ipc/msg_ipc_forward.h"
#include "aqhome/msg/msg_node.h"
@@ -47,28 +47,28 @@ static int _doFlash(GWEN_DB_NODE *dbArgs);
static AQH_FLASHRECORD_LIST *_readHexfileIntoFlashRecordList(const char *hexFilename);
static int _rebootNode(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid, int timeoutInSeconds);
static int _performFlashProcedure(GWEN_MSG_ENDPOINT2 *epTcp,
static int _rebootNode(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid, int timeoutInSeconds);
static int _performFlashProcedure(GWEN_MSG_ENDPOINT *epTcp,
unsigned int uid,
const AQH_FLASHRECORD_LIST *flashRecordList,
int pageSize,
int timeoutInSeconds);
static int _flashStart(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid, int timeoutInSeconds);
static int _flashStart(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid, int timeoutInSeconds);
static GWEN_MSG *_waitForFlashReadyMessageForUid(GWEN_MSG_ENDPOINT2 *epTcp,
static GWEN_MSG *_waitForFlashReadyMessageForUid(GWEN_MSG_ENDPOINT *epTcp,
unsigned int uid, int timeoutInSeconds);
static int _sendRebootRequest(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid);
static int _sendFlashStart(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid);
static int _waitForFlashResponseMessage(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSeconds);
static int _waitForRebootResponseMessage(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSeconds);
static int _sendFlashRecord(GWEN_MSG_ENDPOINT2 *epTcp,
static int _sendRebootRequest(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid);
static int _sendFlashStart(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid);
static int _waitForFlashResponseMessage(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds);
static int _waitForRebootResponseMessage(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds);
static int _sendFlashRecord(GWEN_MSG_ENDPOINT *epTcp,
const AQH_FLASHRECORD *flashRecord,
uint16_t pageSize,
int timeoutInSeconds);
static int _sendFlashEnd(GWEN_MSG_ENDPOINT2 *epTcp, int reason);
static int _sendFlashEnd(GWEN_MSG_ENDPOINT *epTcp, int reason);
@@ -185,7 +185,7 @@ int AQH_Tool_Flash(GWEN_DB_NODE *dbGlobalArgs, int argc, char **argv)
int _doFlash(GWEN_DB_NODE *dbArgs)
{
GWEN_MSG_ENDPOINT2 *epTcp;
GWEN_MSG_ENDPOINT *epTcp;
int rv;
int timeoutInSeconds;
int doReboot;
@@ -222,7 +222,7 @@ int _doFlash(GWEN_DB_NODE *dbArgs)
rv=Utils_SendAcceptedMsgGroups(epTcp, AQH_MSG_TYPEGROUP_FLASH);
if (rv<0) {
DBG_INFO(NULL, "here (%d)", rv);
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
return 3;
}
@@ -231,7 +231,7 @@ int _doFlash(GWEN_DB_NODE *dbArgs)
rv=_rebootNode(epTcp, uid, timeoutInSeconds);
if (rv<0) {
DBG_INFO(NULL, "here (%d)", rv);
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
return 3;
}
fprintf(stdout, "Reboot in progress\n");
@@ -242,7 +242,7 @@ int _doFlash(GWEN_DB_NODE *dbArgs)
msg=_waitForFlashReadyMessageForUid(epTcp, uid, timeoutInSeconds);
if (msg==NULL) {
DBG_INFO(NULL, "No FLASH_READY message received.");
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
return 3;
}
DBG_INFO(NULL, "FLASH_READY message received");
@@ -255,14 +255,14 @@ int _doFlash(GWEN_DB_NODE *dbArgs)
if (rv<0) {
if (rv<0) {
DBG_INFO(NULL, "here (%d)", rv);
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
AQH_FlashRecord_List_free(flashRecordList);
return 4;
}
}
AQH_FlashRecord_List_free(flashRecordList);
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
return 0;
}
@@ -293,7 +293,7 @@ AQH_FLASHRECORD_LIST *_readHexfileIntoFlashRecordList(const char *hexFilename)
int _rebootNode(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid, int timeoutInSeconds)
int _rebootNode(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid, int timeoutInSeconds)
{
int rv;
@@ -316,7 +316,7 @@ int _rebootNode(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid, int timeoutInSecond
int _performFlashProcedure(GWEN_MSG_ENDPOINT2 *epTcp,
int _performFlashProcedure(GWEN_MSG_ENDPOINT *epTcp,
unsigned int uid,
const AQH_FLASHRECORD_LIST *flashRecordList,
int pageSize,
@@ -361,7 +361,7 @@ int _performFlashProcedure(GWEN_MSG_ENDPOINT2 *epTcp,
int _flashStart(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid, int timeoutInSeconds)
int _flashStart(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid, int timeoutInSeconds)
{
int rv;
int i;
@@ -399,7 +399,7 @@ int _flashStart(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid, int timeoutInSecond
GWEN_MSG *_waitForFlashReadyMessageForUid(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid, int timeoutInSeconds)
GWEN_MSG *_waitForFlashReadyMessageForUid(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid, int timeoutInSeconds)
{
int i;
@@ -428,7 +428,7 @@ GWEN_MSG *_waitForFlashReadyMessageForUid(GWEN_MSG_ENDPOINT2 *epTcp, unsigned in
int _waitForRebootResponseMessage(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSeconds)
int _waitForRebootResponseMessage(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds)
{
GWEN_MSG *msg;
@@ -443,7 +443,7 @@ int _waitForRebootResponseMessage(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSecond
int _waitForFlashResponseMessage(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSeconds)
int _waitForFlashResponseMessage(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds)
{
GWEN_MSG *msg;
int responseCode;
@@ -460,7 +460,7 @@ int _waitForFlashResponseMessage(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSeconds
int _sendRebootRequest(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid)
int _sendRebootRequest(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid)
{
GWEN_MSG *msgNode;
GWEN_MSG *msgOut;
@@ -472,14 +472,14 @@ int _sendRebootRequest(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid)
}
msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode));
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_Msg_free(msgNode);
return 0;
}
int _sendFlashStart(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid)
int _sendFlashStart(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid)
{
GWEN_MSG *msgNode;
GWEN_MSG *msgOut;
@@ -491,14 +491,14 @@ int _sendFlashStart(GWEN_MSG_ENDPOINT2 *epTcp, unsigned int uid)
}
msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode));
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_Msg_free(msgNode);
return 0;
}
int _sendFlashEnd(GWEN_MSG_ENDPOINT2 *epTcp, int reason)
int _sendFlashEnd(GWEN_MSG_ENDPOINT *epTcp, int reason)
{
GWEN_MSG *msgNode;
GWEN_MSG *msgOut;
@@ -510,14 +510,14 @@ int _sendFlashEnd(GWEN_MSG_ENDPOINT2 *epTcp, int reason)
}
msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode));
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_Msg_free(msgNode);
return 0;
}
int _sendFlashRecord(GWEN_MSG_ENDPOINT2 *epTcp,
int _sendFlashRecord(GWEN_MSG_ENDPOINT *epTcp,
const AQH_FLASHRECORD *flashRecord,
uint16_t pageSize,
int timeoutInSeconds)
@@ -556,7 +556,7 @@ int _sendFlashRecord(GWEN_MSG_ENDPOINT2 *epTcp,
}
msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode));
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_Msg_free(msgNode);
rv=_waitForFlashResponseMessage(epTcp, timeoutInSeconds);

View File

@@ -13,7 +13,7 @@
#include "./getdevices.h"
#include "./utils.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_getdevices_req.h"
#include "aqhome/ipc/msg_ipc_getdevices_rsp.h"
#include "aqhome/ipc/msg_ipc_error.h"
@@ -34,7 +34,7 @@
static int _doGetDevices(GWEN_DB_NODE *dbArgs);
static int _sendGetDevices(GWEN_MSG_ENDPOINT2 *epTcp);
static int _sendGetDevices(GWEN_MSG_ENDPOINT *epTcp);
@@ -118,7 +118,7 @@ int AQH_Tool_GetDevices(GWEN_DB_NODE *dbGlobalArgs, int argc, char **argv)
int _doGetDevices(GWEN_DB_NODE *dbArgs)
{
GWEN_MSG_ENDPOINT2 *epTcp;
GWEN_MSG_ENDPOINT *epTcp;
int rv;
int timeoutInSeconds;
@@ -149,7 +149,7 @@ int _doGetDevices(GWEN_DB_NODE *dbArgs)
msg=Utils_WaitForSpecificIpcMessage(epTcp, AQH_MSGTYPE_IPC_GETDEVICES_RSP, timeoutInSeconds);
if (msg==NULL) {
DBG_INFO(NULL, "No GET_DEVICE response received.");
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
return 2;
}
code=GWEN_IpcMsg_GetCode(msg);
@@ -196,13 +196,13 @@ int _doGetDevices(GWEN_DB_NODE *dbArgs)
}
}
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
return 0;
}
int _sendGetDevices(GWEN_MSG_ENDPOINT2 *epTcp)
int _sendGetDevices(GWEN_MSG_ENDPOINT *epTcp)
{
GWEN_MSG *msgOut;
@@ -211,7 +211,7 @@ int _sendGetDevices(GWEN_MSG_ENDPOINT2 *epTcp)
DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
return 0;
}

View File

@@ -16,7 +16,7 @@
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h"
#include "aqhome/ipc/msg_ipc_ping.h"
#include "aqhome/ipc/msg_ipc_forward.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/msg/msg_node.h"
#include <gwenhywfar/args.h>
@@ -34,7 +34,7 @@
static int _doPing(GWEN_DB_NODE *dbArgs);
static int _sendPing(GWEN_MSG_ENDPOINT2 *epTcp, int nodeAddr);
static int _sendPing(GWEN_MSG_ENDPOINT *epTcp, int nodeAddr);
@@ -129,7 +129,7 @@ int AQH_Tool_Ping(GWEN_DB_NODE *dbGlobalArgs, int argc, char **argv)
int _doPing(GWEN_DB_NODE *dbArgs)
{
GWEN_MSG_ENDPOINT2 *epTcp;
GWEN_MSG_ENDPOINT *epTcp;
int rv;
int nodeAddr;
int timeoutInSeconds;
@@ -165,13 +165,13 @@ int _doPing(GWEN_DB_NODE *dbArgs)
}
fprintf(stdout, "PONG response received\n");
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
return 0;
}
int _sendPing(GWEN_MSG_ENDPOINT2 *epTcp, int nodeAddr)
int _sendPing(GWEN_MSG_ENDPOINT *epTcp, int nodeAddr)
{
GWEN_MSG *msgOut;
@@ -180,7 +180,7 @@ int _sendPing(GWEN_MSG_ENDPOINT2 *epTcp, int nodeAddr)
DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
return 0;
}

View File

@@ -13,11 +13,11 @@
#include "./utils.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h"
#include "aqhome/ipc/msg_ipc_forward.h"
#include <gwenhywfar/endpoint2_tcpc.h>
#include <gwenhywfar/endpoint_tcpc.h>
#include <gwenhywfar/debug.h>
#include <time.h>
@@ -26,9 +26,9 @@
GWEN_MSG_ENDPOINT2 *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs)
GWEN_MSG_ENDPOINT *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs)
{
GWEN_MSG_ENDPOINT2 *epTcp;
GWEN_MSG_ENDPOINT *epTcp;
const char *tcpAddress;
int tcpPort;
int rv;
@@ -37,15 +37,15 @@ GWEN_MSG_ENDPOINT2 *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs)
tcpPort=GWEN_DB_GetIntValue(dbArgs, "tcpPort", 0, 45454);
DBG_INFO(NULL, "Setup tcp client endpoint to %s:%d", tcpAddress, tcpPort);
epTcp=AQH_IpcEndpoint2_CreateIpcTcpClient(tcpAddress, tcpPort, "aqhome-tool-IPC", 0);
epTcp=AQH_IpcEndpoint_CreateIpcTcpClient(tcpAddress, tcpPort, "aqhome-tool-IPC", 0);
if (epTcp==NULL) {
DBG_ERROR(NULL, "Error creating endpoint TCPc");
return NULL;
}
rv=GWEN_TcpcEndpoint2_StartConnect(epTcp);
rv=GWEN_TcpcEndpoint_StartConnect(epTcp);
if (rv<0 && rv!=GWEN_ERROR_IN_PROGRESS) {
DBG_ERROR(NULL, "Error connecting (%d)", rv);
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
return NULL;
}
@@ -54,7 +54,7 @@ GWEN_MSG_ENDPOINT2 *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs)
GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT *epTcp,
int msgCode,
int nodeAddr,
int timeoutInSeconds)
@@ -67,8 +67,8 @@ GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *msg;
time_t now;
GWEN_MsgEndpoint2_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint2_TakeFirstReceivedMessage(epTcp);
GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp);
if (msg) {
if (GWEN_IpcMsg_GetCode(msg)==AQH_MSGTYPE_IPC_FORWARD) {
GWEN_MSG *nodeMsg;
@@ -103,7 +103,7 @@ GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT *epTcp,
int msgCode,
int timeoutInSeconds)
{
@@ -115,8 +115,8 @@ GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *msg;
time_t now;
GWEN_MsgEndpoint2_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint2_TakeFirstReceivedMessage(epTcp);
GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp);
if (msg) {
uint16_t code;
@@ -143,16 +143,16 @@ GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT2 *epTcp,
int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSeconds)
int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds)
{
time_t startTime;
startTime=time(NULL);
while(GWEN_MsgEndpoint2_HaveMessageToSend(epTcp)) {
while(GWEN_MsgEndpoint_HaveMessageToSend(epTcp)) {
time_t now;
GWEN_MsgEndpoint2_IoLoop(epTcp, 2000); /* 2000 ms */
GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */
now=time(NULL);
if (now-startTime>timeoutInSeconds) {
DBG_INFO(NULL, "Timeout");
@@ -165,7 +165,7 @@ int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSeconds)
int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *epTcp, uint32_t groups)
int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT *epTcp, uint32_t groups)
{
GWEN_MSG *msgOut;
@@ -174,7 +174,7 @@ int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *epTcp, uint32_t groups)
DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
return 0;
}

View File

@@ -11,24 +11,24 @@
#include <gwenhywfar/db.h>
#include <gwenhywfar/endpoint2.h>
#include <gwenhywfar/endpoint.h>
GWEN_MSG_ENDPOINT2 *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs);
GWEN_MSG_ENDPOINT *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs);
GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT *epTcp,
int msgCode,
int nodeAddr,
int timeoutInSeconds);
GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT *epTcp,
int msgCode,
int timeoutInSeconds);
int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSeconds);
int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds);
int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *epTcp, uint32_t groups);
int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT *epTcp, uint32_t groups);
#endif

View File

@@ -14,9 +14,9 @@
#include "./tty_log.h"
#include "./tty_write.h"
#include "aqhome/msg/endpoint2_tty.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/mqtt/endpoint2_mqttc.h"
#include "aqhome/msg/endpoint_tty.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/mqtt/endpoint_mqttc.h"
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/debug.h>
@@ -51,7 +51,7 @@ AQHOMED *AqHomed_new(void)
AQHOMED *aqh;
GWEN_NEW_OBJECT(AQHOMED, aqh);
aqh->rootEndpoint=GWEN_MsgEndpoint2_new("root", 0);
aqh->rootEndpoint=GWEN_MsgEndpoint_new("root", 0);
aqh->nodeDb=AQH_NodeDb_new();
return aqh;
@@ -62,7 +62,7 @@ AQHOMED *AqHomed_new(void)
void AqHomed_free(AQHOMED *aqh)
{
if (aqh) {
GWEN_MsgEndpoint2_free(aqh->rootEndpoint);
GWEN_MsgEndpoint_free(aqh->rootEndpoint);
aqh->rootEndpoint=NULL;
aqh->ttyEndpoint=NULL;
aqh->ipcdEndpoint=NULL;
@@ -82,21 +82,21 @@ void AqHomed_free(AQHOMED *aqh)
GWEN_MSG_ENDPOINT2 *AqHomed_GetTtyEndpoint(const AQHOMED *aqh)
GWEN_MSG_ENDPOINT *AqHomed_GetTtyEndpoint(const AQHOMED *aqh)
{
return aqh?aqh->ttyEndpoint:NULL;
}
GWEN_MSG_ENDPOINT2 *AqHomed_GetIpcdEndpoint(const AQHOMED *aqh)
GWEN_MSG_ENDPOINT *AqHomed_GetIpcdEndpoint(const AQHOMED *aqh)
{
return aqh?aqh->ipcdEndpoint:NULL;
}
GWEN_MSG_ENDPOINT2 *AqHomed_GetMqttEndpoint(const AQHOMED *aqh)
GWEN_MSG_ENDPOINT *AqHomed_GetMqttEndpoint(const AQHOMED *aqh)
{
return aqh?aqh->mqttEndpoint:NULL;
}

View File

@@ -10,7 +10,7 @@
#define AQHOMED_H
#include <gwenhywfar/endpoint2.h>
#include <gwenhywfar/endpoint.h>
#include <gwenhywfar/db.h>
@@ -24,9 +24,9 @@ typedef struct AQHOMED AQHOMED;
AQHOMED *AqHomed_new(void);
void AqHomed_free(AQHOMED *aqh);
GWEN_MSG_ENDPOINT2 *AqHomed_GetTtyEndpoint(const AQHOMED *aqh);
GWEN_MSG_ENDPOINT2 *AqHomed_GetIpcdEndpoint(const AQHOMED *aqh);
GWEN_MSG_ENDPOINT2 *AqHomed_GetMqttEndpoint(const AQHOMED *aqh);
GWEN_MSG_ENDPOINT *AqHomed_GetTtyEndpoint(const AQHOMED *aqh);
GWEN_MSG_ENDPOINT *AqHomed_GetIpcdEndpoint(const AQHOMED *aqh);
GWEN_MSG_ENDPOINT *AqHomed_GetMqttEndpoint(const AQHOMED *aqh);
GWEN_DB_NODE *AqHomed_GetDbArgs(const AQHOMED *aqh);

View File

@@ -28,11 +28,11 @@
struct AQHOMED {
GWEN_MSG_ENDPOINT2 *rootEndpoint;
GWEN_MSG_ENDPOINT *rootEndpoint;
GWEN_MSG_ENDPOINT2 *ttyEndpoint;
GWEN_MSG_ENDPOINT2 *ipcdEndpoint;
GWEN_MSG_ENDPOINT2 *mqttEndpoint;
GWEN_MSG_ENDPOINT *ttyEndpoint;
GWEN_MSG_ENDPOINT *ipcdEndpoint;
GWEN_MSG_ENDPOINT *mqttEndpoint;
AQH_NODE_DB *nodeDb;

View File

@@ -28,7 +28,7 @@
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/args.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/endpoint2_tcpd.h>
#include <gwenhywfar/endpoint_tcpd.h>
#include <gwenhywfar/timestamp.h>

View File

@@ -17,7 +17,7 @@
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/args.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/endpoint2_tcpd.h>
#include <gwenhywfar/endpoint_tcpd.h>
#include <unistd.h>
@@ -39,7 +39,7 @@
* ------------------------------------------------------------------------------------------------
*/
static void _disconnectTree(GWEN_MSG_ENDPOINT2 *ep);
static void _disconnectTree(GWEN_MSG_ENDPOINT *ep);
@@ -53,7 +53,7 @@ void AqHomed_Fini(AQHOMED *aqh)
if (aqh) {
if (aqh->rootEndpoint) {
_disconnectTree(aqh->rootEndpoint);
GWEN_MsgEndpoint2_Disconnect(aqh->rootEndpoint);
GWEN_MsgEndpoint_Disconnect(aqh->rootEndpoint);
}
aqh->rootEndpoint=NULL;
aqh->ttyEndpoint=NULL;
@@ -67,17 +67,17 @@ void AqHomed_Fini(AQHOMED *aqh)
void _disconnectTree(GWEN_MSG_ENDPOINT2 *ep)
void _disconnectTree(GWEN_MSG_ENDPOINT *ep)
{
GWEN_MSG_ENDPOINT2 *epChild;
GWEN_MSG_ENDPOINT *epChild;
epChild=GWEN_MsgEndpoint2_Tree2_GetFirstChild(ep);
epChild=GWEN_MsgEndpoint_Tree2_GetFirstChild(ep);
while(epChild) {
_disconnectTree(epChild);
epChild=GWEN_MsgEndpoint2_Tree2_GetNext(epChild);
epChild=GWEN_MsgEndpoint_Tree2_GetNext(epChild);
} /* while */
GWEN_MsgEndpoint2_Disconnect(ep);
GWEN_MsgEndpoint_Disconnect(ep);
}

View File

@@ -16,14 +16,14 @@
#include "./tty_log.h"
#include "./tty_write.h"
#include "aqhome/msg/endpoint2_tty.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/mqtt/endpoint2_mqttc.h"
#include "aqhome/msg/endpoint_tty.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/mqtt/endpoint_mqttc.h"
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/args.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/endpoint2_tcpd.h>
#include <gwenhywfar/endpoint_tcpd.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
@@ -59,7 +59,7 @@
static int _setupTty(AQHOMED *aqh, GWEN_DB_NODE *dbArgs);
static void _setupIpc(AQHOMED *aqh, GWEN_DB_NODE *dbArgs);
static GWEN_MSG_ENDPOINT2 *_acceptIpcFn(GWEN_MSG_ENDPOINT2 *ep, GWEN_SOCKET *sk, const GWEN_INETADDRESS *addr, void *data);
static GWEN_MSG_ENDPOINT *_acceptIpcFn(GWEN_MSG_ENDPOINT *ep, GWEN_SOCKET *sk, const GWEN_INETADDRESS *addr, void *data);
static void _setupMqtt(AQHOMED *aqh, GWEN_DB_NODE *dbArgs);
static void _setupLog(AQHOMED *aqh, GWEN_DB_NODE *dbArgs);
static void _setupWriter(AQHOMED *aqh, GWEN_DB_NODE *dbArgs);
@@ -125,14 +125,14 @@ int _setupTty(AQHOMED *aqh, GWEN_DB_NODE *dbArgs)
devicePath=GWEN_DB_GetCharValue(dbArgs, "device", 0, AQHOMED_DEFAULT_DEVICE);
if (devicePath && *devicePath) {
GWEN_MSG_ENDPOINT2 *epTty;
GWEN_MSG_ENDPOINT *epTty;
epTty=AQH_TtyEndpoint2_new(devicePath, AQHOME_ENDPOINTGROUP_NODE);
epTty=AQH_TtyEndpoint_new(devicePath, AQHOME_ENDPOINTGROUP_NODE);
if (epTty==NULL) {
DBG_ERROR(NULL, "Error creating endpoint TTY");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint2_Tree2_AddChild(aqh->rootEndpoint, epTty);
GWEN_MsgEndpoint_Tree2_AddChild(aqh->rootEndpoint, epTty);
aqh->ttyEndpoint=epTty;
}
else {
@@ -154,12 +154,12 @@ void _setupIpc(AQHOMED *aqh, GWEN_DB_NODE *dbArgs)
tcpPort=GWEN_DB_GetIntValue(dbArgs, "tcpPort", 0, AQHOMED_DEFAULT_IPC_PORT);
if (tcpAddress && *tcpAddress && tcpPort) {
GWEN_MSG_ENDPOINT2 *ep;
GWEN_MSG_ENDPOINT *ep;
ep=GWEN_TcpdEndpoint2_new(tcpAddress, tcpPort, NULL, AQHOME_ENDPOINTGROUP_IPC);
GWEN_TcpdEndpoint2_SetAcceptFn(ep, _acceptIpcFn, aqh);
ep=GWEN_TcpdEndpoint_new(tcpAddress, tcpPort, NULL, AQHOME_ENDPOINTGROUP_IPC);
GWEN_TcpdEndpoint_SetAcceptFn(ep, _acceptIpcFn, aqh);
GWEN_MsgEndpoint2_Tree2_AddChild(aqh->rootEndpoint, ep);
GWEN_MsgEndpoint_Tree2_AddChild(aqh->rootEndpoint, ep);
aqh->ipcdEndpoint=ep;
}
}
@@ -181,18 +181,18 @@ void _setupMqtt(AQHOMED *aqh, GWEN_DB_NODE *dbArgs)
mqttKeepAlive=GWEN_DB_GetIntValue(dbArgs, "mqttKeepAlive", 0, AQHOMED_DEFAULT_MQTT_KEEPALIVE);
if (mqttAddress && *mqttAddress && mqttPort) {
GWEN_MSG_ENDPOINT2 *ep;
GWEN_MSG_ENDPOINT *ep;
int rv;
ep=AQH_MqttClientEndpoint2_new(mqttClientId, mqttAddress, mqttPort, NULL, AQHOME_ENDPOINTGROUP_MQTT);
ep=AQH_MqttClientEndpoint_new(mqttClientId, mqttAddress, mqttPort, NULL, AQHOME_ENDPOINTGROUP_MQTT);
AqHomed_SetMqttTopicPrefix(aqh, mqttTopicPrefix);
AQH_MqttClientEndpoint2_SetTopicPrefix(ep, mqttTopicPrefix);
AQH_MqttClientEndpoint2_SetKeepAliveTime(ep, mqttKeepAlive);
AQH_MqttClientEndpoint_SetTopicPrefix(ep, mqttTopicPrefix);
AQH_MqttClientEndpoint_SetKeepAliveTime(ep, mqttKeepAlive);
GWEN_MsgEndpoint2_Tree2_AddChild(aqh->rootEndpoint, ep);
GWEN_MsgEndpoint_Tree2_AddChild(aqh->rootEndpoint, ep);
aqh->mqttEndpoint=ep;
rv=AQH_MqttClientEndpoint2_StartConnect(ep);
rv=AQH_MqttClientEndpoint_StartConnect(ep);
if (rv<0 && rv!=GWEN_ERROR_IN_PROGRESS) {
DBG_ERROR(NULL, "Error connecting to MQTT server %s:%d (%d), will retry later", mqttAddress, mqttPort, rv);
}
@@ -201,17 +201,17 @@ void _setupMqtt(AQHOMED *aqh, GWEN_DB_NODE *dbArgs)
GWEN_MSG_ENDPOINT2 *_acceptIpcFn(GWEN_MSG_ENDPOINT2 *ep,
GWEN_SOCKET *sk,
const GWEN_INETADDRESS *addr,
GWEN_UNUSED void *data)
GWEN_MSG_ENDPOINT *_acceptIpcFn(GWEN_MSG_ENDPOINT *ep,
GWEN_SOCKET *sk,
const GWEN_INETADDRESS *addr,
GWEN_UNUSED void *data)
{
/* AQHOMED *aqh;
*
* aqh=(AQHOMED*) data;
*/
DBG_INFO(NULL, "Incoming IPC connection");
return AQH_IpcEndpoint2_CreateIpcTcpServiceForSocket(sk, NULL, AQHOME_ENDPOINTGROUP_IPC);
return AQH_IpcEndpoint_CreateIpcTcpServiceForSocket(sk, NULL, AQHOME_ENDPOINTGROUP_IPC);
}

View File

@@ -19,18 +19,18 @@
#include "./tty_write.h"
#include "./db.h"
#include "aqhome/msg/endpoint2_tty.h"
#include "aqhome/msg/endpoint_tty.h"
#include "aqhome/msg/msg_node.h"
#include "aqhome/msg/msg_value2.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_value.h"
#include "aqhome/mqtt/endpoint2_mqttc.h"
#include "aqhome/mqtt/endpoint_mqttc.h"
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/args.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/endpoint2_tcpd.h>
#include <gwenhywfar/endpoint_tcpd.h>
@@ -60,7 +60,7 @@
void AqHomed_Loop(AQHOMED *aqh, int timeoutInMsecs)
{
if (aqh) {
GWEN_MsgEndpoint2_ChildrenIoLoop(aqh->rootEndpoint, timeoutInMsecs);
GWEN_MsgEndpoint_ChildrenIoLoop(aqh->rootEndpoint, timeoutInMsecs);
AqHomed_ReadAndHandleTtyMessages(aqh);
AqHomed_ReadAndHandleIpcMessages(aqh);

View File

@@ -17,11 +17,11 @@
#include "./tty_write.h"
#include "./db.h"
#include "aqhome/msg/endpoint2_tty.h"
#include "aqhome/msg/endpoint_tty.h"
#include "aqhome/msg/msg_node.h"
#include "aqhome/msg/msg_value2.h"
#include "aqhome/msg/msg_ping.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc.h"
#include "aqhome/ipc/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_value.h"
@@ -33,7 +33,7 @@
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/args.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/endpoint2_tcpd.h>
#include <gwenhywfar/endpoint_tcpd.h>
@@ -52,12 +52,12 @@
* ------------------------------------------------------------------------------------------------
*/
static void _handleIpcEndpoint(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep);
static void _handleIpcMsg(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg);
void _handleIpcMsgPing(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg);
void _handleIpcMsgSetAccMsgGrps(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg);
void _handleIpcMsgForward(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg);
void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg);
static void _handleIpcEndpoint(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep);
static void _handleIpcMsg(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg);
void _handleIpcMsgPing(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg);
void _handleIpcMsgSetAccMsgGrps(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg);
void _handleIpcMsgForward(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg);
void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg);
@@ -70,23 +70,23 @@ void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN
void AqHomed_ReadAndHandleIpcMessages(AQHOMED *aqh)
{
if (aqh->ipcdEndpoint) {
GWEN_MSG_ENDPOINT2 *ep;
GWEN_MSG_ENDPOINT *ep;
ep=GWEN_MsgEndpoint2_Tree2_GetFirstChild(aqh->ipcdEndpoint);
ep=GWEN_MsgEndpoint_Tree2_GetFirstChild(aqh->ipcdEndpoint);
while(ep) {
_handleIpcEndpoint(aqh, ep);
ep=GWEN_MsgEndpoint2_Tree2_GetNext(ep);
ep=GWEN_MsgEndpoint_Tree2_GetNext(ep);
}
}
}
void _handleIpcEndpoint(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep)
void _handleIpcEndpoint(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep)
{
GWEN_MSG *msg;
while( (msg=GWEN_MsgEndpoint2_TakeFirstReceivedMessage(ep)) ) {
while( (msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(ep)) ) {
_handleIpcMsg(aqh, ep, msg);
GWEN_Msg_free(msg);
}
@@ -94,7 +94,7 @@ void _handleIpcEndpoint(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep)
void _handleIpcMsg(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg)
void _handleIpcMsg(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
{
uint16_t code;
@@ -112,46 +112,46 @@ void _handleIpcMsg(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg)
void _handleIpcMsgPing(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg)
void _handleIpcMsgPing(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
{
if (aqh->ttyEndpoint && GWEN_MsgEndpoint2_GetState(aqh->ttyEndpoint)==GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
if (aqh->ttyEndpoint && GWEN_MsgEndpoint_GetState(aqh->ttyEndpoint)==GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
GWEN_MSG *msgOut;
DBG_ERROR(AQH_LOGDOMAIN, "Received IPC PING message");
msgOut=AQH_PingMsg_new(aqh->nodeAddress, AQH_PingIpcMsg_GetDestAddr(msg), AQH_MSG_TYPE_PING);
GWEN_MsgEndpoint2_AddSendMessage(aqh->ttyEndpoint, msgOut);
GWEN_MsgEndpoint_AddSendMessage(aqh->ttyEndpoint, msgOut);
}
}
void _handleIpcMsgSetAccMsgGrps(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg)
void _handleIpcMsgSetAccMsgGrps(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
{
uint32_t groups;
DBG_ERROR(AQH_LOGDOMAIN, "Received IPC SET_ACCEPTED_MSG_GROUPS message");
groups=AQH_SetAcceptedMsgGroupsIpcMsg_GetMsgGroups(msg);
AQH_IpcEndpoint2_SetAcceptedMsgGroups(ep, groups);
AQH_IpcEndpoint_SetAcceptedMsgGroups(ep, groups);
// TODO: send response?
}
void _handleIpcMsgForward(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg)
void _handleIpcMsgForward(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
{
if (aqh->ttyEndpoint && GWEN_MsgEndpoint2_GetState(aqh->ttyEndpoint)==GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
if (aqh->ttyEndpoint && GWEN_MsgEndpoint_GetState(aqh->ttyEndpoint)==GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
GWEN_MSG *msgOut;
DBG_ERROR(AQH_LOGDOMAIN, "Received IPC FORWARD message");
msgOut=AQH_ForwardIpcMsg_GetCopyOfNodeMsg(msg);
if (msgOut)
GWEN_MsgEndpoint2_AddSendMessage(aqh->ttyEndpoint, msgOut);
GWEN_MsgEndpoint_AddSendMessage(aqh->ttyEndpoint, msgOut);
}
}
void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *msg)
void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
{
AQH_NODE_INFO_LIST *nodeInfoList;
@@ -168,7 +168,7 @@ void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN
niNext=AQH_NodeInfo_List_Next(ni);
DBG_INFO(AQH_LOGDOMAIN, "Sending response for node %02x (%08x)", AQH_NodeInfo_GetBusAddress(ni), AQH_NodeInfo_GetUid(ni));
msgOut=AQH_GetDevicesResponseIpcMsg_new(AQH_MSGTYPE_IPC_GETDEVICES_RSP, niNext?0:AQH_MSGIPC_GETDEVICES_RSP_FLAGS_LAST, ni);
GWEN_MsgEndpoint2_AddSendMessage(ep, msgOut);
GWEN_MsgEndpoint_AddSendMessage(ep, msgOut);
ni=niNext;
}
}
@@ -177,7 +177,7 @@ void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT2 *ep, const GWEN
DBG_INFO(AQH_LOGDOMAIN, "No nodes");
msgOut=AQH_ErrorIpcMsg_new(AQH_MSGTYPE_IPC_ERROR, AQH_MSG_IPC_ERROR_NODATA);
GWEN_MsgEndpoint2_AddSendMessage(ep, msgOut);
GWEN_MsgEndpoint_AddSendMessage(ep, msgOut);
}
}

View File

@@ -19,18 +19,18 @@
#include "./tty_write.h"
#include "./db.h"
#include "aqhome/msg/endpoint2_tty.h"
#include "aqhome/msg/endpoint_tty.h"
#include "aqhome/msg/msg_node.h"
#include "aqhome/msg/msg_value2.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_value.h"
#include "aqhome/mqtt/endpoint2_mqttc.h"
#include "aqhome/mqtt/endpoint_mqttc.h"
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/args.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/endpoint2_tcpd.h>
#include <gwenhywfar/endpoint_tcpd.h>
@@ -63,7 +63,7 @@ void AqHomed_ReadAndHandleTtyMessages(AQHOMED *aqh)
{
GWEN_MSG *msg;
while( (msg=GWEN_MsgEndpoint2_TakeFirstReceivedMessage(aqh->ttyEndpoint)) ) {
while( (msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(aqh->ttyEndpoint)) ) {
_handleTtyMsg(aqh, msg);
GWEN_Msg_free(msg);
}

View File

@@ -17,18 +17,18 @@
#include "./tty_write.h"
#include "./db.h"
#include "aqhome/msg/endpoint2_tty.h"
#include "aqhome/msg/endpoint_tty.h"
#include "aqhome/msg/msg_node.h"
#include "aqhome/msg/msg_value2.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_value.h"
#include "aqhome/mqtt/endpoint2_mqttc.h"
#include "aqhome/mqtt/endpoint_mqttc.h"
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/args.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/endpoint2_tcpd.h>
#include <gwenhywfar/endpoint_tcpd.h>
@@ -47,8 +47,8 @@
* ------------------------------------------------------------------------------------------------
*/
static void _forwardValue2MsgToIpc(GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *nodeMsg);
static void _forwardAnyMsgToIpc(GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *nodeMsg);
static void _forwardValue2MsgToIpc(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *nodeMsg);
static void _forwardAnyMsgToIpc(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *nodeMsg);
@@ -63,11 +63,11 @@ void AqHomed_ForwardTtyMsgToIpcClients(AQHOMED *aqh, const GWEN_MSG *msg)
msgGroup=AQH_NodeMsg_GetMsgGroup(AQH_NodeMsg_GetMsgType(msg));
if (msgGroup) {
GWEN_MSG_ENDPOINT2 *ep;
GWEN_MSG_ENDPOINT *ep;
ep=GWEN_MsgEndpoint2_Tree2_GetFirstChild(aqh->ipcdEndpoint);
ep=GWEN_MsgEndpoint_Tree2_GetFirstChild(aqh->ipcdEndpoint);
while(ep) {
if (msgGroup & AQH_IpcEndpoint2_GetAcceptedMsgGroups(ep)) {
if (msgGroup & AQH_IpcEndpoint_GetAcceptedMsgGroups(ep)) {
DBG_INFO(NULL, "Endpoint accepts msg group %d", msgGroup);
switch(AQH_NodeMsg_GetMsgType(msg)) {
case AQH_MSG_TYPE_VALUE2:
@@ -79,7 +79,7 @@ void AqHomed_ForwardTtyMsgToIpcClients(AQHOMED *aqh, const GWEN_MSG *msg)
}
}
ep=GWEN_MsgEndpoint2_Tree2_GetNext(ep);
ep=GWEN_MsgEndpoint_Tree2_GetNext(ep);
}
}
else {
@@ -89,7 +89,7 @@ void AqHomed_ForwardTtyMsgToIpcClients(AQHOMED *aqh, const GWEN_MSG *msg)
void _forwardValue2MsgToIpc(GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *nodeMsg)
void _forwardValue2MsgToIpc(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *nodeMsg)
{
GWEN_MSG *ipcMsg;
@@ -99,17 +99,17 @@ void _forwardValue2MsgToIpc(GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *nodeMsg)
AQH_Value2Msg_GetValueType(nodeMsg),
AQH_Value2Msg_GetValueNom(nodeMsg),
AQH_Value2Msg_GetValueDenom(nodeMsg));
GWEN_MsgEndpoint2_AddSendMessage(ep, ipcMsg);
GWEN_MsgEndpoint_AddSendMessage(ep, ipcMsg);
}
void _forwardAnyMsgToIpc(GWEN_MSG_ENDPOINT2 *ep, const GWEN_MSG *nodeMsg)
void _forwardAnyMsgToIpc(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *nodeMsg)
{
GWEN_MSG *ipcMsg;
ipcMsg=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(nodeMsg), GWEN_Msg_GetBytesInBuffer(nodeMsg));
GWEN_MsgEndpoint2_AddSendMessage(ep, ipcMsg);
GWEN_MsgEndpoint_AddSendMessage(ep, ipcMsg);
}

View File

@@ -17,21 +17,21 @@
#include "./tty_write.h"
#include "./db.h"
#include "aqhome/msg/endpoint2_tty.h"
#include "aqhome/msg/endpoint_tty.h"
#include "aqhome/msg/msg_node.h"
#include "aqhome/msg/msg_value2.h"
#include "aqhome/msg/msg_sendstats.h"
#include "aqhome/msg/msg_recvstats.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_value.h"
#include "aqhome/mqtt/endpoint2_mqttc.h"
#include "aqhome/mqtt/endpoint_mqttc.h"
#include "aqhome/mqtt/msg_mqtt_publish.h"
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/args.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/endpoint2_tcpd.h>
#include <gwenhywfar/endpoint_tcpd.h>
@@ -69,7 +69,7 @@ static void _publishString(AQHOMED *aqh, uint32_t uid, int valueId, const char *
void AqHomed_ForwardTtyMsgToMqttServer(AQHOMED *aqh, const GWEN_MSG *nodeMsg)
{
if (GWEN_MsgEndpoint2_GetState(aqh->mqttEndpoint)==GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
if (GWEN_MsgEndpoint_GetState(aqh->mqttEndpoint)==GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
DBG_DEBUG(AQH_LOGDOMAIN, "Processing output message");
switch(AQH_NodeMsg_GetMsgType(nodeMsg)) {
case AQH_MSG_TYPE_VALUE2:
@@ -207,7 +207,7 @@ void _publishString(AQHOMED *aqh, uint32_t uid, int valueId, const char *valuePa
pubMsg=AQH_PublishMqttMsg_new(0, 0, GWEN_Buffer_GetStart(bufTopic), (const uint8_t*) v, strlen(v));
if (pubMsg) {
DBG_INFO(AQH_LOGDOMAIN, "MQTT PUBLISH %s: %s", GWEN_Buffer_GetStart(bufTopic), v);
GWEN_MsgEndpoint2_AddSendMessage(aqh->mqttEndpoint, pubMsg);
GWEN_MsgEndpoint_AddSendMessage(aqh->mqttEndpoint, pubMsg);
}
GWEN_Buffer_free(bufTopic);
}