adapted to latest changes in gwen (msgio API v2 becomes v1).
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user