updated iris-kit mqtt to aliot

This commit is contained in:
strawmanbobi
2024-02-18 14:47:28 +08:00
parent 4d54cb273a
commit 95297411a9
9 changed files with 546 additions and 85 deletions

View File

@@ -30,9 +30,11 @@
#include "global.h"
#include "emq_client.h"
#include "aliot_client.h"
#include "iris_kit.h"
#include "iot_hub.h"
// external variable declarations
extern int g_runtime_env;
@@ -88,13 +90,19 @@ int connectToIrextIoT() {
return -1;
}
// g_mqtt_user_name act as clientId for aliot and as userName for EMQX
g_mqtt_user_name = getDeviceID();
INFOF("Try connecting to IRext IoT %s:%d, client_id = %s, user_name = %s, password.size = %d\n",
g_mqtt_server.c_str(), g_mqtt_port,
g_mqtt_client_id.c_str(), g_mqtt_user_name.c_str(), g_mqtt_password.length());
INFOF("Try connecting to AliyunIoT, product_key = %s, device_name = %s, device_secret = %s\n",
g_product_key.c_str(), g_device_name.c_str(), g_device_token.c_str());
conn_ret = connectToAliot(mqtt_client);
conn_ret = connectToEMQXBroker(mqtt_client);
if (0 != conn_ret) {
INFOF("Try connecting to IRext IoT %s:%d, client_id = %s, user_name = %s, password.size = %d\n",
g_mqtt_server.c_str(), g_mqtt_port,
g_mqtt_client_id.c_str(), g_mqtt_user_name.c_str(), g_mqtt_password.length());
conn_ret = connectToEMQXBroker(mqtt_client);
}
if (0 != conn_ret) {
ERRORLN("Something may went wrong with your credential, please retry connect to Wifi...");