aqhome: Started rewriting endpoints for version 2 of the msgio interface.

This interface is much simpler.
First rewritten endpoint is that for MQTT.
This commit is contained in:
Martin Preuss
2023-07-09 20:47:47 +02:00
parent d766a3635a
commit 6f5a26b0cf
7 changed files with 697 additions and 5 deletions

View File

@@ -14,6 +14,7 @@
#include "aqhome/ipc/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h"
#include "aqhome/mqtt/endpoint_mqttc.h"
#include "aqhome/mqtt/endpoint2_mqttc.h"
#include "aqhome/mqtt/msg_mqtt_connect.h"
#include "aqhome/mqtt/msg_mqtt_connack.h"
#include "aqhome/mqtt/msg_mqtt_publish.h"
@@ -249,6 +250,29 @@ int testMqttConnection()
int testMqttConnection2()
{
GWEN_MSG_ENDPOINT2 *epClient;
int loop;
AQH_Init();
epClient=AQH_MqttClientEndpoint2_new("TESTCLIENT1234", "127.0.0.1", 1883, NULL, 1);
for (loop=0;; loop++) {
DBG_INFO(GWEN_LOGDOMAIN, "Loop %d:", loop);
GWEN_MsgEndpoint2_IoLoop(epClient, 2000); /* 2000 ms */
if (GWEN_MsgEndpoint2_GetState(epClient)==GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
DBG_INFO(AQH_LOGDOMAIN, "Connected.");
break;
}
}
return 0;
}
int testMqttSubscribe(int argc, char **argv)
{
int rv;
@@ -557,7 +581,8 @@ int main(int argc, char **argv)
//return testIpcConnection();
//return testHexfile(argc, argv);
//return testFlashRecords(argc, argv);
return testMqttSubscribe(argc, argv);
//return testMqttSubscribe(argc, argv);
return testMqttConnection2();
}