From 0792fa6ee91373c208f363fb1af0c9dc32ff906c Mon Sep 17 00:00:00 2001 From: HonestQiao Date: Tue, 10 May 2022 16:45:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0iot=5Fmqtt=E7=9A=84APP=5FFEAT?= =?UTF-8?q?URE=5FINIT(=E5=85=A5=E5=8F=A3=EF=BC=8C=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=EF=BC=8C=E6=B7=BB=E5=8A=A0BUILD.gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rk2206/samples/d1_iot_mqtt/BUILD.gn | 34 +++++++++++++++++++ .../rk2206/samples/d1_iot_mqtt/README_zh.md | 8 ++++- .../rk2206/samples/d1_iot_mqtt/iot_mqtt.c | 6 ++-- 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100755 vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/BUILD.gn diff --git a/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/BUILD.gn b/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/BUILD.gn new file mode 100755 index 00000000..157f191a --- /dev/null +++ b/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2022 FuZhou Lockzhiner Electronic Co., Ltd. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +static_library("iot_mqtt") { + sources = [ + "iot_mqtt.c", + "src/oc_mqtt.c", + "src/oc_mqtt_profile_package.c", + ] + + include_dirs = [ + "//utils/native/lite/include", + "//device/lockzhiner/rk2206/adapter/include", + "//third_party/cJSON", + "//third_party/musl/porting/liteos_m/kernel/include", + "//third_party/paho_mqtt/MQTTPacket/src", + "//third_party/paho_mqtt/MQTTClient-C/src", + "include", + ] + + deps = [ + "//device/rockchip/hardware:hardware", + ] +} diff --git a/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/README_zh.md b/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/README_zh.md index 8c0abf94..aae3af58 100755 --- a/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/README_zh.md +++ b/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/README_zh.md @@ -259,7 +259,13 @@ void Iot_Mqtt_Example() 修改 `vendor\lockzhiner\rk2206\samples`路径下 BUILD.gn 文件,指定 `iot_mqtt` 参与编译。 ```r -"iot_mqtt", +"./d1_iot_mqtt:iot_mqtt", +``` + +修改 `device/lockzhiner/rk2206/sdk_liteos` 路径下 Makefile 文件,添加 `-liot_mqtt` 参与编译。 + +```r +hardware_LIBS = -lhal_iothardware -lhardware -liot_mqtt ``` ### 运行结果 diff --git a/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/iot_mqtt.c b/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/iot_mqtt.c index 795955aa..a0157447 100755 --- a/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/iot_mqtt.c +++ b/vendor/lockzhiner/rk2206/samples/d1_iot_mqtt/iot_mqtt.c @@ -125,10 +125,12 @@ void Iot_Mqtt_Example() task.uwStackSize = 10240; task.pcName = IOT_MQTT_EXAMPLE; task.usTaskPrio = 6; - ret = LOS_TaskCreate(threadID, &task); + ret = LOS_TaskCreate(&threadID, &task); if (LOS_OK != ret) { - printf("Falied to create %s\n", IOT_MQTT_EXAMPLE); + printf("Falied to create %s, ret:%d\n", IOT_MQTT_EXAMPLE, ret); return; } } + +APP_FEATURE_INIT(Iot_Mqtt_Example); \ No newline at end of file -- Gitee