Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

String concatenation does not add '0円', causing an error during OTA running #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Yangyuanxin wants to merge 39 commits into TencentCloud:master
base: master
Choose a base branch
Loading
from Yangyuanxin:master
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0584302
1. 增加设备动态注册功能。
May 15, 2019
452a91b
1. 修改各Sample设备信息获取方式为设备信息HAL层接口实现。
May 15, 2019
6de2b00
1. 基于影子增加数据模板功能。
May 16, 2019
f6cb325
修改readme,增加文档目录docs及物联网开发平台.md
May 16, 2019
6d26cef
调整文档目录
May 17, 2019
2536d89
update readme
May 30, 2019
a4a6a7e
1. MQTT增加subscribe的event handler,及时通知subscribe状态,可解决log及sys主题在destroy...
spikelin Jun 10, 2019
75b9f02
v3.0.1发布
spikelin Jun 11, 2019
76fe477
1. 数据模板字符串类型支持json类型。
Jul 17, 2019
f757f37
update SDK version
Jul 17, 2019
50e1926
优化数据模板相关示例
Jul 18, 2019
ef3263b
1. OTA支持断点续传。
Aug 9, 2019
7b9c241
Corrected the typo in the template
twowinter Aug 23, 2019
13cc46c
1. 修正http接收的超时判断。
Aug 26, 2019
758c48e
delete all old SDK files
Sep 19, 2019
4f3306c
v3.1.0 C-SDK refactor
Sep 19, 2019
e517183
update document and delete garbled
Sep 24, 2019
d62a536
v3.1.1
Oct 10, 2019
79a95e2
1. 修复OTA内存泄漏
Nov 11, 2019
8ae3ff8
v3.1.2
Nov 11, 2019
213b1a9
fix Windows time format error
Nov 11, 2019
f4553ad
update document about topic forward
spikelin Nov 25, 2019
c1f61a6
fix: 消除编译警告
caodj Nov 29, 2019
e2ef5e0
统一代码缩进风格
spikelin Mar 5, 2020
af362aa
C-SDK v3.1.3
spikelin Mar 5, 2020
60a1419
fix some potential bugs
spikelin Mar 6, 2020
dd9fb78
fix coap running bug
Apr 7, 2020
2ed2231
Merge pull request #25 from caodj/master
spikelin Apr 27, 2020
af25f2e
Merge pull request #23 from twowinter/master
spikelin Apr 27, 2020
33118e9
v3.2.0
Apr 30, 2020
f800546
1. fix bugs of OTA reload and HTTP download
Jun 23, 2020
e398ffa
C-SDK v3.2.1
Aug 4, 2020
7ffb37c
fix Windows build error
Aug 4, 2020
0d2c305
fix build error of AT socket
Oct 13, 2020
5381d0e
v3.2.2
Oct 14, 2020
2616003
v3.2.3
spikelin Nov 3, 2020
df06a4b
fix reply puback/pubrec timer expired issue
spikelin Dec 4, 2020
4afac4f
fix socket close error
spikelin Feb 22, 2022
bbc4748
Fixed the error in the return format when compiling and running in Mi...
Yangyuanxin Aug 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
C-SDK v3.1.3
1.优化ota_mqtt_sample,将ota流程以及需要文件操作的地方解耦分离,并且sample支持MQTT断开重连之后仍然可以恢复下载。
2.优化gateway_sample,并增加代理一个以上子设备示例代码。
3.增加查询MQTT主题是否订阅成功的接口。
4.优化及更新文档。
5.修复一些编译警告及bug
  • Loading branch information
spikelin committed Mar 5, 2020
commit af362aa358a677b7f57322533b5a7584f66ed723
2 changes: 1 addition & 1 deletion CMakeLists.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set(FEATURE_MQTT_DEVICE_SHADOW ON)
set(FEATURE_COAP_COMM_ENABLED ON)

# 是否打开MQTT通道网关功能
set(FEATURE_GATEWAY_ENABLED OFF)
set(FEATURE_GATEWAY_ENABLED ON)

# 是否打开OTA固件升级总开关
set(FEATURE_OTA_COMM_ENABLED ON)
Expand Down
6 changes: 6 additions & 0 deletions docs/C-SDK_API及可变参数说明.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ C-SDK 的使用可以根据具体场景需求,配置相应的参数,满足

## API 函数说明
以下是 C-SDK v3.1.0版本提供的主要功能和对应 API 接口说明,用于客户编写业务逻辑,更加详细的说明如接口参数及返回值可查看SDK代码 include/exports/qcloud_iot_export_*.h 等头文件中的注释
接口使用示例代码请参考samples目录下的对应代码,以及docs/IoT_Hub目录下的文档说明

### 1. MQTT 接口

Expand Down Expand Up @@ -154,3 +155,8 @@ SDK对于MQTT接口在多线程环境下的使用有如下注意事项:
| 5 | IOT_Gateway_Subscribe | 订阅 MQTT 主题 |
| 6 | IOT_Gateway_Unsubscribe | 取消订阅已订阅的 MQTT 主题 |

### 8. 动态注册接口

| 序号 | 函数名 | 说明 |
| ---- | ---------------------------- | ------------------------------------------------- |
| 1 | IOT_DynReg_Device | 向后台动态注册设备并获取设备密钥或者证书 |
1 change: 1 addition & 0 deletions docs/C-SDK_Build编译环境及配置选项说明.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ sdk_src为SDK的核心逻辑及协议相关代码,一般不需要修改,其
| FEATURE_LOG_UPLOAD_ENABLED | ON/OFF | 日志上报开关 |
| FEATURE_DEBUG_DEV_INFO_USED | ON/OFF | 设备信息获取来源开关 |
| FEATURE_SYSTEM_COMM_ENABLED | ON/OFF | 获取后台时间开关 |
| FEATURE_OTA_USE_HTTPS | ON/OFF | 是否使用HTTPS下载固件 |
| FEATURE_AT_TCP_ENABLED | ON/OFF | AT模组TCP功能开关 |
| FEATURE_AT_UART_RECV_IRQ | ON/OFF | AT模组中断接受功能开关 |
| FEATURE_AT_OS_USED | ON/OFF | AT模组多线程功能开关 |
Expand Down
3 changes: 3 additions & 0 deletions docs/IoT_Hub/IoT_Hub通信平台快速入门.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
## 设备影子
请参考**shadow_sample_设备影子.md**文档,介绍设备影子功能,并结合 SDK 的**shadow_sample**展示影子的数据流和功能

## 固件升级
请参考**ota_sample_固件升级.md**文档,介绍固件升级功能,并结合 SDK 的**ota_mqtt_sample**展示固件升级的流程和功能

## 网关功能
请参考**gateway_sample_网关功能.md**文档,介绍如何在腾讯IoT Hub控制台申请网关设备并绑定子设备, 并结合本 SDK 的**gateway_sample**快速体验网关设备通过 MQTT 协议连接到腾讯云IoT Hub, 代理子设备上下线,发送和接收消息。

Expand Down
19 changes: 18 additions & 1 deletion docs/IoT_Hub/gateway_sample_网关功能.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,21 @@ INF|2019年09月16日 14:35:35|gateway_common.c|_gateway_message_handler(134): client_i
DBG|2019年09月16日 14:35:35|mqtt_client_publish.c|qcloud_iot_mqtt_publish(329): publish topic seq=27804|topicName=S3EUVBRJLB/test_device/data|payload={"data":"test gateway"}
INF|2019年09月16日 14:35:35|gateway_sample.c|_event_handler(88): publish success, packet-id=27804
INF|2019年09月16日 14:35:35|gateway_sample.c|_message_handler(111): Receive Message With topicName:S3EUVBRJLB/test_device/data, payload:{"data":"test gateway"}
```
```

## 三. 代码说明

gateway_sample示例演示了网关代理一个子设备的情况,如果用户需要增加更多子设备,可以先在控制台添加子设备,然后在代码里面通过创建更多GatewayParam参数实例,并将GatewayParam参数传递给网关各个API,即可以实现网关代理多个子设备进行通讯。
```
// one GatewayParam only support one sub-device
// use more GatewayParam to add more sub-device
GatewayParam gw_param1 = DEFAULT_GATEWAY_PARAMS;;
gw_param1.product_id = gw_dev_info.gw_info.product_id;
gw_param1.device_name = gw_dev_info.gw_info.device_name;

gw_param1.subdev_product_id = "SUB-PRODUCT1";
gw_param1.subdev_device_name = "SUB-DEVICE1";

IOT_Gateway_Subdev_Online(client, &gw_param1);
```

112 changes: 112 additions & 0 deletions docs/IoT_Hub/ota_sample_固件升级.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# OTA设备固件升级

关于物联平台 OTA 固件升级功能及流程介绍,请参考官网文档[设备固件升级](https://cloud.tencent.com/document/product/634/14674)

## 一. 上传固件

进行固件升级,首先要上传固件到物联网后台,可以通过控制台进行上传,如下图示:
![](https://main.qcloudimg.com/raw/219ab155f886e2ac1a1ebd0d7a1184aa.png)

## 二. 编译运行示例程序(以**MQTT密钥认证设备**为例)
#### 1. 编译 SDK
修改CMakeLists.txt确保以下选项存在
```
set(BUILD_TYPE "release")
set(COMPILE_TOOLS "gcc")
set(PLATFORM "linux")
set(FEATURE_MQTT_COMM_ENABLED ON)
set(FEATURE_OTA_COMM_ENABLED ON)
set(FEATURE_OTA_SIGNAL_CHANNEL "MQTT")
set(FEATURE_AUTH_MODE "KEY")
set(FEATURE_AUTH_WITH_NOTLS OFF)
set(FEATURE_DEBUG_DEV_INFO_USED OFF)
```
执行脚本编译
```
./cmake_build.sh
```
示例输出ota_mqtt_sample位于`output/release/bin`文件夹中

#### 2. 填写设备信息
将设备信息填写到配置文件device_info.json中
```
{
"auth_mode":"KEY",
"productId":"S3EUVBRJLB",
"deviceName":"test_device",
"key_deviceinfo":{
"deviceSecret":"vX6PQqazsGsMyf5SMfs6OA6y"
}
}
```

#### 3. 运行示例
执行OTA MQTT例程ota_mqtt_sample:
```
./output/release/bin/ota_mqtt_sample
INF|2020年03月04日 16:50:35|qcloud_iot_device.c|iot_device_info_set(50): SDK_Ver: 3.1.2, Product_ID: S3EUVBRJLB, Device_Name: test_device
DBG|2020年03月04日 16:50:35|HAL_TLS_mbedtls.c|HAL_TLS_Connect(206): Setting up the SSL/TLS structure...
DBG|2020年03月04日 16:50:35|HAL_TLS_mbedtls.c|HAL_TLS_Connect(248): Performing the SSL/TLS handshake...
DBG|2020年03月04日 16:50:35|HAL_TLS_mbedtls.c|HAL_TLS_Connect(249): Connecting to /S3EUVBRJLB.iotcloud.tencentdevices.com/8883...
INF|2020年03月04日 16:50:35|HAL_TLS_mbedtls.c|HAL_TLS_Connect(271): connected with /S3EUVBRJLB.iotcloud.tencentdevices.com/8883...
INF|2020年03月04日 16:50:35|mqtt_client.c|IOT_MQTT_Construct(111): mqtt connect with id: BzaMF success
INF|2020年03月04日 16:50:35|ota_mqtt_sample.c|main(516): Cloud Device Construct Success
DBG|2020年03月04日 16:50:35|mqtt_client_subscribe.c|qcloud_iot_mqtt_subscribe(141): topicName=$ota/update/S3EUVBRJLB/test_device|packet_id=63333
INF|2020年03月04日 16:50:35|ota_mqtt_sample.c|_event_handler(77): subscribe success, packet-id=63333
DBG|2020年03月04日 16:50:35|ota_mqtt.c|_otamqtt_event_callback(117): OTA topic subscribe success
INF|2020年03月04日 16:50:36|ota_mqtt_sample.c|_get_local_fw_running_version(363): FW running version: 1.0.0
DBG|2020年03月04日 16:50:36|mqtt_client_publish.c|qcloud_iot_mqtt_publish(334): publish topic seq=63334|topicName=$ota/report/S3EUVBRJLB/test_device|payload={"type": "report_version", "report":{"version":"1.0.0"}}
INF|2020年03月04日 16:50:36|ota_mqtt_sample.c|_event_handler(89): publish success, packet-id=63334
DBG|2020年03月04日 16:50:36|ota_mqtt.c|_otamqtt_upgrage_cb(103): topic=$ota/update/S3EUVBRJLB/test_device
INF|2020年03月04日 16:50:36|ota_mqtt.c|_otamqtt_upgrage_cb(104): len=86, topic_msg={"result_code":0,"result_msg":"success","type":"report_version_rsp","version":"1.0.0"}
INF|2020年03月04日 16:50:36|ota_client.c|_ota_callback(102): Report version success!
INF|2020年03月04日 16:50:36|ota_mqtt_sample.c|process_ota(389): wait for ota upgrade command...
INF|2020年03月04日 16:50:37|ota_mqtt_sample.c|process_ota(389): wait for ota upgrade command...
```
可以看到设备已经上报了当前的固件版本,并在等待固件升级的命令下发

#### 4. 执行固件升级命令

在收到设备上报的固件版本之后,可以选择要升级的新固件版本并执行升级命令,可以通过控制台进行操作,如下图示:
![](https://main.qcloudimg.com/raw/ac71788c5bc5d542eb10292751e12fbe.png)

这个时候再观察sample的示例打印,可以看到设备端通过MQTT接收到升级命令,并且通过HTTPS去下载固件并保存到本地
```
INF|2020年03月04日 16:50:38|ota_mqtt_sample.c|process_ota(389): wait for ota upgrade command...
DBG|2020年03月04日 16:50:39|ota_mqtt.c|_otamqtt_upgrage_cb(103): topic=$ota/update/S3EUVBRJLB/test_device
INF|2020年03月04日 16:50:39|ota_mqtt.c|_otamqtt_upgrage_cb(104): len=454, topic_msg={"file_size":175436,"md5sum":"ad4615b866c13afb8b293a679bfa5dc4","type":"update_firmware","url":"https://ota-1255858890.cos.ap-guangzhou.myqcloud.com/100008768029_S3EUVBRJLB_1.3.0?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDdO8ldrUa0Uts4H5Gzx6FZ9nfedjpiCd7%26q-sign-time%3D1583311839%3B1583398239%26q-key-time%3D1583311839%3B1583398239%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D1215yt303628f88f31c9a7734ead8a7fa32ed1b3%00","version":"1.3.0"}

INF|2020年03月04日 16:50:39|ota_mqtt_sample.c|process_ota(389): wait for ota upgrade command...
ERR|2020年03月04日 16:50:39|ota_mqtt_sample.c|_get_local_fw_info(251): open file ./FW_S3EUVBRJLBtest_device.json failed
DBG|2020年03月04日 16:50:39|ota_client.c|IOT_OTA_StartDownload(347): to download FW from offset: 0, size: 175436
DBG|2020年03月04日 16:50:39|ota_fetch.c|ofc_Init(83): head_content:Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate
Range: bytes=0-175436

DBG|2020年03月04日 16:50:39|HAL_TLS_mbedtls.c|_mbedtls_client_init(134): psk/pskid is empty!|psk=(null)|psd_id=(null)
DBG|2020年03月04日 16:50:39|HAL_TLS_mbedtls.c|HAL_TLS_Connect(206): Setting up the SSL/TLS structure...
DBG|2020年03月04日 16:50:39|HAL_TLS_mbedtls.c|HAL_TLS_Connect(248): Performing the SSL/TLS handshake...
DBG|2020年03月04日 16:50:39|HAL_TLS_mbedtls.c|HAL_TLS_Connect(249): Connecting to /ota-1255858890.cos.ap-guangzhou.myqcloud.com/443...
INF|2020年03月04日 16:50:40|HAL_TLS_mbedtls.c|HAL_TLS_Connect(271): connected with /ota-1255858890.cos.ap-guangzhou.myqcloud.com/443...
DBG|2020年03月04日 16:50:40|utils_httpc.c|qcloud_http_client_connect(747): http client connect success
DBG|2020年03月04日 16:50:40|mqtt_client_publish.c|qcloud_iot_mqtt_publish(340): publish packetID=0|topicName=$ota/report/S3EUVBRJLB/test_device|payload={"type": "report_progress", "report": {"progress": {"state":"downloading", "percent":"0", "result_code":"0", "result_msg":""}, "version": "1.3.0"}}
DBG|2020年03月04日 16:50:41|mqtt_client_publish.c|qcloud_iot_mqtt_publish(340): publish packetID=0|topicName=$ota/report/S3EUVBRJLB/test_device|payload={"type": "report_progress", "report": {"progress": {"state":"downloading", "percent":"31", "result_code":"0", "result_msg":""}, "version": "1.3.0"}}
DBG|2020年03月04日 16:50:42|mqtt_client_publish.c|qcloud_iot_mqtt_publish(340): publish packetID=0|topicName=$ota/report/S3EUVBRJLB/test_device|payload={"type": "report_progress", "report": {"progress": {"state":"downloading", "percent":"59", "result_code":"0", "result_msg":""}, "version": "1.3.0"}}
DBG|2020年03月04日 16:50:43|mqtt_client_publish.c|qcloud_iot_mqtt_publish(340): publish packetID=0|topicName=$ota/report/S3EUVBRJLB/test_device|payload={"type": "report_progress", "report": {"progress": {"state":"downloading", "percent":"88", "result_code":"0", "result_msg":""}, "version": "1.3.0"}}
DBG|2020年03月04日 16:50:43|mqtt_client_publish.c|qcloud_iot_mqtt_publish(340): publish packetID=0|topicName=$ota/report/S3EUVBRJLB/test_device|payload={"type": "report_progress", "report": {"progress": {"state":"downloading", "percent":"100", "result_code":"0", "result_msg":""}, "version": "1.3.0"}}
INF|2020年03月04日 16:50:43|ota_client.c|IOT_OTA_Ioctl(638): FW MD5 check: origin=ad4615b866c13afb8b293a679bfa5dc4, now=ad4615b866c13afb8b293a679bfa5dc4
INF|2020年03月04日 16:50:43|ota_mqtt_sample.c|process_ota(456): The firmware is valid
DBG|2020年03月04日 16:50:43|mqtt_client_publish.c|qcloud_iot_mqtt_publish(334): publish topic seq=63335|topicName=$ota/report/S3EUVBRJLB/test_device|payload={"type": "report_progress", "report":{"progress":{"state":"done", "result_code":"0", "result_msg":""}, "version":"1.3.0"}}
INF|2020年03月04日 16:50:44|ota_mqtt_sample.c|_event_handler(89): publish success, packet-id=63335
INF|2020年03月04日 16:50:44|mqtt_client_connect.c|qcloud_iot_mqtt_disconnect(450): mqtt disconnect!
INF|2020年03月04日 16:50:44|ota_mqtt.c|_otamqtt_event_callback(135): mqtt client has been destroyed
INF|2020年03月04日 16:50:44|mqtt_client.c|IOT_MQTT_Destroy(171): mqtt release!
```

## 三. 代码使用说明

1. 固件升级,支持通过HTTP或者HTTPS来下载固件,可以通过编译选项FEATURE_OTA_USE_HTTPS来选择
2. SDK的固件升级,支持断点续传功能,即当固件下载过程因为网络或者其他原因中断了,则再次下载的时候,可以从上一次中断的位置继续下载。
3. 在ota_mqtt_sample.c中,process_ota函数为OTA的核心流程,包括了版本上报,等待升级命令,发起下载并保存,校验文件MD5以及回复升级结果的过程,同时为断点续传功能实时保存下载状态。该函数在各个平台适配的时候可以保持不变。而跟固件保存,断点续传状态保存相关的功能函数,则跟平台密切相关,示例中使用了文件操作,在支持标准文件操作的系统比如Linux/Windows上面可以直接使用,对于其他平台则需要进行适配。


17 changes: 17 additions & 0 deletions include/exports/qcloud_iot_export_gateway.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ int IOT_Gateway_Subscribe(void *client, char *topic_filter, SubscribeParams *par
*/
int IOT_Gateway_Unsubscribe(void *client, char *topic_filter);

/**
* @brief check if MQTT topic has been subscribed or not
*
* @param pClient handle to MQTT client
* @param topicFilter MQTT topic filter
*
* @return true when successfully subscribed, or false if not yet
*/
int IOT_Gateway_IsSubReady(void *client, char *topic_filter);

/**
* @brief Check connection and keep alive state, read/handle MQTT message in synchronized way
Expand All @@ -142,6 +151,14 @@ int IOT_Gateway_Unsubscribe(void *client, char *topic_filter);
*/
int IOT_Gateway_Yield(void *client, uint32_t timeout_ms);

/**
* @brief Return the MQTT client dedicated to this gateway handle
*
* @param pClient handle to gateway client
*
* @return a valid mqtt client handle when success, or NULL otherwise
*/
void *IOT_Gateway_Get_Mqtt_Client(void *handle);

#ifdef __cplusplus
}
Expand Down
10 changes: 10 additions & 0 deletions include/exports/qcloud_iot_export_mqtt.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ int IOT_MQTT_Subscribe(void *pClient, char *topicFilter, SubscribeParams *pParam
*/
int IOT_MQTT_Unsubscribe(void *pClient, char *topicFilter);

/**
* @brief check if MQTT topic has been subscribed or not
*
* @param pClient handle to MQTT client
* @param topicFilter MQTT topic filter
*
* @return true when successfully subscribed, or false if not yet
*/
bool IOT_MQTT_IsSubReady(void *pClient, char *topicFilter);

/**
* @brief Check if MQTT is connected
*
Expand Down
2 changes: 2 additions & 0 deletions include/exports/qcloud_iot_export_ota.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ int IOT_OTA_StartDownload(void *handle, uint32_t offset, uint32_t size);
*/
void IOT_OTA_UpdateClientMd5(void *handle, char * buff, uint32_t size);

int IOT_OTA_ResetClientMD5(void *handle);

/**
* @brief Report local firmware version to server
* NOTE: do this report before real download
Expand Down
10 changes: 10 additions & 0 deletions include/exports/qcloud_iot_export_shadow.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ typedef struct _JSONNode {
char *key; // Key of this JSON node
void *data; // Value of this JSON node
JsonDataType type; // Data type of this JSON node
bool delta_arrived;
} DeviceProperty;


Expand Down Expand Up @@ -173,6 +174,15 @@ typedef void (*OnPropRegCallback)(void *pClient, const char *pJsonValueBuffer, u
*/
void* IOT_Shadow_Construct(ShadowInitParams *pParams);

/**
* @brief Return the MQTT client dedicated to this shadow handle
*
* @param pClient handle to shadow client
*
* @return a valid mqtt client handle when success, or NULL otherwise
*/
void *IOT_Shadow_Get_Mqtt_Client(void *handle);

/**
* @brief Publish MQTT message
*
Expand Down
1 change: 1 addition & 0 deletions include/platform.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern "C" {

#ifdef WIN32
#include <Windows.h>
#include <process.h>
#include <direct.h>
#include <limits.h>
typedef unsigned long ssize_t;
Expand Down
2 changes: 1 addition & 1 deletion include/qcloud_iot_export.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern "C" {


/* IoT C-SDK version info */
#define QCLOUD_IOT_DEVICE_SDK_VERSION "3.1.2"
#define QCLOUD_IOT_DEVICE_SDK_VERSION "3.1.3"

/**************** QCloud IoT C-SDK constants begin ************************/

Expand Down
2 changes: 1 addition & 1 deletion make.settings
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FEATURE_MQTT_DEVICE_SHADOW = y
FEATURE_COAP_COMM_ENABLED = y

# 是否打开MQTT通道网关功能
FEATURE_GATEWAY_ENABLED = n
FEATURE_GATEWAY_ENABLED = y

# 是否打开OTA固件升级总开关
FEATURE_OTA_COMM_ENABLED = y
Expand Down
2 changes: 1 addition & 1 deletion platform/os/linux/HAL_AT_UART_linux.c
100755 → 100644
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ int HAL_AT_Uart_Send(void *data, uint32_t size)

if (sg_at_uart.state == eOPENED) {
while (leftlen > 0) {
ret = write(sg_at_uart.fd, data + size - leftlen, leftlen);
ret = write(sg_at_uart.fd, (char *)data + size - leftlen, leftlen);
if (ret == -1) {
Log_e("write uart fd failed on error: %d.\r\n", errno);
ret = QCLOUD_ERR_FAILURE;
Expand Down
2 changes: 1 addition & 1 deletion platform/os/nonos/HAL_Timer_nonos.c
100755 → 100644
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ char* HAL_Timer_current(void)

time_sec = HAL_Timer_current_sec();
memset(now_time_str, 0, 20);
snprintf(now_time_str, 20, "%d", time_sec);
snprintf(now_time_str, 20, "%ld", time_sec);

return now_time_str;
}
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /