feat: 移植腾讯云物联网开发平台 C SDK

This commit is contained in:
fancyxu
2022-07-01 11:06:09 +08:00
parent 2be1169b0b
commit 0acc079ed6
195 changed files with 36646 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
/**
* @copyright
*
* Tencent is pleased to support the open source community by making IoT Hub available.
* Copyright(C) 2018 - 2021 THL A29 Limited, a Tencent company.All rights reserved.
*
* Licensed under the MIT License(the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
* @file qcloud_iot_config.h
* @brief sdk config define
* @author fancyxu (fancyxu@tencent.com)
* @version 1.0
* @date 2021-06-01
*
* @par Change Log:
* <table>
* <tr><th>Date <th>Version <th>Author <th>Description
* <tr><td>2021-06-01 <td>1.0 <td>fancyxu <td>first commit
* <tr><td>2021-07-12 <td>1.1 <td>fancyxu <td>rename AUTH_WITH_NOTLS to AUTH_WITH_NO_TLS
* </table>
*/
#ifndef IOT_HUB_DEVICE_C_SDK_INCLUDE_CONFIG_QCLOUD_IOT_CONFIG_H_
#define IOT_HUB_DEVICE_C_SDK_INCLUDE_CONFIG_QCLOUD_IOT_CONFIG_H_
#ifdef __cplusplus
extern "C" {
#endif
/* #undef AUTH_MODE_CERT */
#define AUTH_MODE_KEY
#define AUTH_WITH_NO_TLS
/* #undef GATEWAY_ENABLED */
/* #undef SYSTEM_COMM */
/* #undef DEV_DYN_REG_ENABLED */
/* #undef LOG_UPLOAD */
/* #undef IOT_DEBUG */
#define DEBUG_DEV_INFO_USED
#define AT_MODULE_ENABLE
#define MULTITHREAD_ENABLED
/* #undef LOG_UPLOAD_TYPE_JSON */
/* #undef LOG_UPLOAD_AES_ENCRYPT_POST */
#ifdef __cplusplus
}
#endif
#endif // IOT_HUB_DEVICE_C_SDK_INCLUDE_CONFIG_QCLOUD_IOT_CONFIG_H_

View File

@@ -0,0 +1,87 @@
/**
* @copyright
*
* Tencent is pleased to support the open source community by making IoT Hub available.
* Copyright(C) 2018 - 2021 THL A29 Limited, a Tencent company.All rights reserved.
*
* Licensed under the MIT License(the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
* @file qcloud_iot_host.h
* @brief
* @author fancyxu (fancyxu@tencent.com)
* @version 1.0
* @date 2021-05-28
*
* @par Change Log:
* <table>
* <tr><th>Date <th>Version <th>Author <th>Description
* <tr><td>2021-05-28 <td>1.0 <td>fancyxu <td>first commit
* <tr><td>2021-07-12 <td>1.1 <td>fancyxu <td>change port to str format
* </table>
*/
#ifndef IOT_HUB_DEVICE_C_SDK_INCLUDE_CONFIG_QCLOUD_IOT_HOST_H_
#define IOT_HUB_DEVICE_C_SDK_INCLUDE_CONFIG_QCLOUD_IOT_HOST_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief IoT C-SDK APPID.
*
*/
#define QCLOUD_IOT_DEVICE_SDK_APPID "21010406"
#define QCLOUD_IOT_DEVICE_SDK_APPID_LEN (sizeof(QCLOUD_IOT_DEVICE_SDK_APPID) - 1)
/**
* @brief MQTT server domain.
*
*/
#define QCLOUD_IOT_MQTT_DIRECT_DOMAIN "iotcloud.tencentdevices.com"
#define MQTT_SERVER_PORT_TLS "8883"
#define MQTT_SERVER_PORT_NO_TLS "1883"
/**
* @brief Server domain for dynamic registering device.
*
*/
#define DYN_REG_SERVER_URL "ap-guangzhou.gateway.tencentdevices.com"
#define DYN_REG_URI_PATH "/device/register"
#define DYN_REG_SERVER_PORT "80"
#define DYN_REG_SERVER_PORT_TLS "443"
/**
* @brief URL for doing log upload.
*
*/
#define LOG_UPLOAD_SERVER_URL "ap-guangzhou.gateway.tencentdevices.com"
#define LOG_UPLOAD_URI_PATH "/device/reportlog"
#define LOG_UPLOAD_SERVER_PORT "80"
/**
* @brief (old)URL for doing log upload.
* Compatible with old versions, new users are recommended to use up
*
*/
#define LOG_UPLOAD_OLD_SERVER_URL "http://devicelog.iot.cloud.tencent.com/cgi-bin/report-log"
#define LOG_UPLOAD_OLD_SERVER_PORT "80"
/**
* @brief Max size of a host name.
*
*/
#define HOST_STR_LENGTH 64
#ifdef __cplusplus
}
#endif
#endif // IOT_HUB_DEVICE_C_SDK_INCLUDE_CONFIG_QCLOUD_IOT_HOST_H_

View File

@@ -0,0 +1,119 @@
/**
* @copyright
*
* Tencent is pleased to support the open source community by making IoT Hub available.
* Copyright(C) 2018 - 2021 THL A29 Limited, a Tencent company.All rights reserved.
*
* Licensed under the MIT License(the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
* @file qcloud_iot_variables.h
* @brief variables can be set depend on user resource.
* @author fancyxu (fancyxu@tencent.com)
* @version 1.0
* @date 2021-05-28
*
* @par Change Log:
* <table>
* <tr><th>Date <th>Version <th>Author <th>Description
* <tr><td>2021-05-28 <td>1.0 <td>fancyxu <td>first commit
* </table>
*/
#ifndef IOT_HUB_DEVICE_C_SDK_INCLUDE_CONFIG_QCLOUD_IOT_VARIABLES_H_
#define IOT_HUB_DEVICE_C_SDK_INCLUDE_CONFIG_QCLOUD_IOT_VARIABLES_H_
#ifdef __cplusplus
extern "C" {
#endif
// Variables are dependant on user situation (network status/device memory/application context). Adjust the default
// value to meet your requirement
/**
* @brief default MQTT timeout value when connect/pub/sub (unit: ms)
*
*/
#define QCLOUD_IOT_MQTT_COMMAND_TIMEOUT (5 * 1000)
/**
* @brief default MQTT timeout value when wait server ack
*
*/
#define QCLOUD_IOT_MQTT_WAIT_ACK_TIMEOUT (5 * 1000)
/**
* @brief default MQTT keep alive interval (unit: s)
*
*/
#define QCLOUD_IOT_MQTT_KEEP_ALIVE_INTERNAL (240)
/**
* @brief default MQTT Tx buffer size, MAX: 16*1024
*
*/
#define QCLOUD_IOT_MQTT_TX_BUF_LEN (4096)
/**
* @brief default MQTT Rx buffer size, MAX: 16*1024
*
*/
#define QCLOUD_IOT_MQTT_RX_BUF_LEN (4096)
/**
* @brief default MQTT timeout value when yield
*
*/
#define QCLOUD_IOT_MQTT_YIELD_TIMEOUT (500)
/**
* @brief MAX MQTT reconnect interval (unit: ms)
*
*/
#define MAX_RECONNECT_WAIT_INTERVAL (60 * 1000)
/**
* @brief MAX valid time when connect to MQTT server. 0: always valid.
* Use this only if the device has accurate UTC time. Otherwise, set to 0.
*
*/
#define MAX_ACCESS_EXPIRE_TIMEOUT (0)
// Log upload related params, which will affect the size of device memory/disk consumption Log upload related params,
// which will affect the size of device memory/disk consumption
/**
* @brief size of buffer for log upload
*
*/
#define LOG_UPLOAD_BUFFER_SIZE 5000
/**
* @brief Max size of one http log upload. Should not larger than 5000
*
*/
#define MAX_HTTP_LOG_POST_SIZE 5000
/**
* @brief MAX size for saving log into NVS (files/FLASH) after upload fail
*
*/
#define MAX_LOG_SAVE_SIZE (3 * LOG_UPLOAD_BUFFER_SIZE)
/**
* @brief interval of log upload (unit: ms) Decrease this value if LOG_UPLOAD_BUFFER_SIZE is small
*
*/
#define LOG_UPLOAD_INTERVAL_MS 1800000
#ifdef __cplusplus
}
#endif
#endif // IOT_HUB_DEVICE_C_SDK_INCLUDE_CONFIG_QCLOUD_IOT_VARIABLES_H_