tried to support aliot again(untested)

This commit is contained in:
strawmanbobi
2024-02-12 19:26:03 +08:00
parent c9d70c68c7
commit e96ab56e62
37 changed files with 123 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
/**
*
* Filename: AliyunIoTSDK.cpp
* Filename: aliyun_iot_sdk.cpp
*
* Description: basic SDK for ESP32
*
@@ -10,10 +10,11 @@
*
**/
#include "AliyunIoTSDK.h"
#include <PubSubClient.h>
#include <SHA256.h>
#include "aliyun_iot_sdk.h"
#define CHECK_INTERVAL 30000
#define MESSAGE_BUFFER_SIZE 10
#define MQTT_CONNECT_RETRY_MAX 3
@@ -148,12 +149,12 @@ int AliyunIoTSDK::mqttCheckConnect() {
return mqttStatus;
}
int AliyunIoTSDK::begin(Client &espClient,
int AliyunIoTSDK::begin(PubSubClient &mqttClient,
const char *_productKey,
const char *_deviceName,
const char *_deviceSecret,
const char *_region) {
client = new PubSubClient(espClient);
client = new PubSubClient(mqttClient);
productKey = _productKey;
deviceName = _deviceName;
deviceSecret = _deviceSecret;

View File

@@ -1,6 +1,6 @@
/**
*
* Filename: AliyunIoTSDK.h
* Filename: aliyun_iot_sdk.h
*
* Description: header file of basic SDK for ESP32
*
@@ -58,13 +58,13 @@ public:
/**
* Initialize and connect to AliyunIoT
* @param espClient : WiFi client
* @param mqttClient : PubSubClient
* @param _productKey : AliyunIoT product key
* @param _deviceName : AliyunIoT device name
* @param _deviceSecret : AliyunIoT device secret
* @param _region : AliyunIoT region
*/
static int begin(Client &espClient,
static int begin(PubSubClient &mqttClient,
const char *_productKey,
const char *_deviceName,
const char *_deviceSecret,