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

@@ -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);
}