diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md deleted file mode 100755 index f09d98dde9597de75ffcdb237c2b580b8fffa3f9..0000000000000000000000000000000000000000 --- a/.gitee/ISSUE_TEMPLATE.zh-CN.md +++ /dev/null @@ -1,13 +0,0 @@ -### 该问题是怎么引起的? - - - -### 重现步骤 - - - -### 报错信息 - - - - diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md deleted file mode 100755 index 33948fdcb51264545ce5ae797f5310a1c06f871d..0000000000000000000000000000000000000000 --- a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md +++ /dev/null @@ -1,15 +0,0 @@ -### 相关的Issue - - -### 原因(目的、解决的问题等) - - -### 描述(做了什么,变更了什么) - - -### 测试用例(新增、改动、可能影响的功能) - - - - - diff --git a/README.md b/README.md new file mode 100755 index 0000000000000000000000000000000000000000..b606fd49f9065afb62b610bea0ae13f3f240ed18 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# WIFI\_IOT\_APP + +- [Introduction](#section11660541593) +- [Directory Structure](#section1464106163817) +- [Repositories Involved](#section1718733212019) + +## Introduction + +The WIFI\_IOT\_APP module provides sample code for iothardware, demolink, and samgr. + +## Directory Structure + +``` +applications/sample/wifi-iot/ # Sample code +└── app + ├── BUILD.gn # Build script + ├── demolink # Sample code for integrating demolink + ├── iothardware # Sample code for LED operations + ├── samgr # Sample code for the service framework + └── startup +``` + +## Repositories Involved + +applications\_sample\_wifi-iot + diff --git a/README_zh.md b/README_zh.md new file mode 100755 index 0000000000000000000000000000000000000000..99e475590a27036f3225eaba3e38a6d3c44f4199 --- /dev/null +++ b/README_zh.md @@ -0,0 +1,26 @@ +# WIFI\_IOT\_APP组件 + +- [简介](#section11660541593) +- [目录](#section1464106163817) +- [涉及仓](#section1718733212019) + +## 简介 + +WIFI\_IOT\_APP组件,提供了iothardware、demolink、samgr等示例代码。 + +## 目录 + +``` +applications/sample/wifi-iot/ # sample模块目录 +└── app + ├── BUILD.gn # 模块构建脚本 + ├── demolink # demolink集成示例代码 + ├── iothardware # LED操作示例代码 + ├── samgr # 服务框架示例代码 + └── startup +``` + +## 涉及仓 + +applications\_sample\_wifi-iot + diff --git a/app/iothardware/BUILD.gn b/app/iothardware/BUILD.gn index 7c49e1a5840e0bc41cc2e2fe7fa84fff89cec4d0..9e4f53929f480f78714408347de30f22b6359ad5 100755 --- a/app/iothardware/BUILD.gn +++ b/app/iothardware/BUILD.gn @@ -1,22 +1,24 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# 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 +# Copyright (c) 2020 Huawei Device Co., Ltd. +# 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("led_example") { - sources = [ "led_example.c" ] - - include_dirs = [ - "//utils/native/lite/include", - "//kernel/liteos_m/kal", - "//base/iot_hardware/interfaces/kits/wifiiot_lite", - ] -} + +static_library("led_example") { + sources = [ + "led_example.c" + ] + + include_dirs = [ + "//utils/native/lite/include", + "//kernel/liteos_m/components/cmsis/2.0", + "//base/iot_hardware/interfaces/kits/wifiiot_lite", + ] +} diff --git a/app/iothardware/led_example.c b/app/iothardware/led_example.c index 7bc1f79112fea75439dd1d8f3e6aef03463531cf..73242242ef5e36fffc981c1b69e3e237f816600b 100755 --- a/app/iothardware/led_example.c +++ b/app/iothardware/led_example.c @@ -19,13 +19,12 @@ #include "ohos_init.h" #include "cmsis_os2.h" -#include "wifiiot_gpio.h" -#include "wifiiot_gpio_ex.h" +#include "iot_gpio.h" #define LED_INTERVAL_TIME_US 300000 #define LED_TASK_STACK_SIZE 512 #define LED_TASK_PRIO 25 - +#define LED_TEST_GPIO 9 // for hispark_pegasus enum LedState { LED_ON = 0, LED_OFF, @@ -40,17 +39,17 @@ static void *LedTask(const char *arg) while (1) { switch (g_ledState) { case LED_ON: - GpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_9, 1); + IoTGpioSetOutputVal(LED_TEST_GPIO, 1); usleep(LED_INTERVAL_TIME_US); break; case LED_OFF: - GpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_9, 0); + IoTGpioSetOutputVal(LED_TEST_GPIO, 0); usleep(LED_INTERVAL_TIME_US); break; case LED_SPARK: - GpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_9, 0); + IoTGpioSetOutputVal(LED_TEST_GPIO, 0); usleep(LED_INTERVAL_TIME_US); - GpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_9, 1); + IoTGpioSetOutputVal(LED_TEST_GPIO, 1); usleep(LED_INTERVAL_TIME_US); break; default: @@ -62,39 +61,12 @@ static void *LedTask(const char *arg) return NULL; } -static void OnButtonPressed(char *arg) -{ - (void) arg; - - enum LedState nextState = LED_SPARK; - switch (g_ledState) { - case LED_ON: - nextState = LED_OFF; - break; - case LED_OFF: - nextState = LED_ON; - break; - case LED_SPARK: - nextState = LED_OFF; - break; - default: - break; - } - - g_ledState = nextState; -} - static void LedExampleEntry(void) { osThreadAttr_t attr; - GpioInit(); - IoSetFunc(WIFI_IOT_IO_NAME_GPIO_9, WIFI_IOT_IO_FUNC_GPIO_9_GPIO); - GpioSetDir(WIFI_IOT_IO_NAME_GPIO_9, WIFI_IOT_GPIO_DIR_OUT); - - IoSetFunc(WIFI_IOT_IO_NAME_GPIO_5, WIFI_IOT_IO_FUNC_GPIO_5_GPIO); - GpioRegisterIsrFunc(WIFI_IOT_IO_NAME_GPIO_5, WIFI_IOT_INT_TYPE_EDGE, WIFI_IOT_GPIO_EDGE_FALL_LEVEL_LOW, - OnButtonPressed, NULL); + IoTGpioInit(LED_TEST_GPIO); + IoTGpioSetDir(LED_TEST_GPIO, IOT_GPIO_DIR_OUT); attr.name = "LedTask"; attr.attr_bits = 0U; @@ -109,4 +81,4 @@ static void LedExampleEntry(void) } } -SYS_RUN(LedExampleEntry); \ No newline at end of file +SYS_RUN(LedExampleEntry); diff --git a/app/samgr/BUILD.gn b/app/samgr/BUILD.gn index 3a776e5a6c5fce26dd4f75f5f3fd3fbf2fb555a4..d59ad960642534d6e21341423ad8ae5552beb330 100755 --- a/app/samgr/BUILD.gn +++ b/app/samgr/BUILD.gn @@ -13,6 +13,7 @@ static_library("example_samgr") { sources = [ + "//test/xts/acts/distributedschedule_lite/samgr_hal/utils/samgr_maintenance.c", "bootstrap_example.c", "broadcast_example.c", "feature_example.c", @@ -25,11 +26,11 @@ static_library("example_samgr") { include_dirs = [ "//utils/native/lite/include", - "//kernel/liteos_m/kal", - "//foundation/distributedschedule/interfaces/kits/samgr_lite/samgr", - "//foundation/distributedschedule/interfaces/kits/samgr_lite/communication/broadcast", - "//foundation/distributedschedule/services/samgr_lite/samgr/source", - "//foundation/distributedschedule/services/samgr_lite/samgr/adapter", - "//test/xts/tools/hctest/include", + "//kernel/liteos_m/components/cmsis", + "//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr", + "//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast", + "//foundation/distributedschedule/samgr_lite/samgr/adapter", + "//foundation/distributedschedule/samgr_lite/samgr/source", + "//test/xts/acts/distributedschedule_lite/samgr_hal/utils", ] } diff --git a/app/samgr/broadcast_example.c b/app/samgr/broadcast_example.c index 47080dc2f61298dea5bb0460445ddf05b41f1e3c..4f8e4a5f18102edc54fc6b75a42e5bd8fb6534af 100755 --- a/app/samgr/broadcast_example.c +++ b/app/samgr/broadcast_example.c @@ -19,7 +19,6 @@ #include #include #include "time_adapter.h" -#include "hctest.h" #define TEST_LEN 10 #define WAIT_PUB_PROC 1000 @@ -222,4 +221,4 @@ static void RunTestCase(void) CASE_ReUnsubscribeTopic(fapi); CASE_ReleaseIUnknown(fapi); } -TEST_INIT(RunTestCase); +LAYER_INITCALL_DEF(RunTestCase, test, "test"); diff --git a/app/samgr/feature_example.c b/app/samgr/feature_example.c index 39d73bb102178f756d5939960e75c7418f532f37..c45ef8af5fe443399cb4ce628a95f5579bc9349a 100755 --- a/app/samgr/feature_example.c +++ b/app/samgr/feature_example.c @@ -23,7 +23,6 @@ #include "service.h" #include "samgr_lite.h" #include "time_adapter.h" -#include "hctest.h" #define WAIT_FEATURE_PROC 1000 enum MessageId { @@ -109,11 +108,8 @@ static BOOL FEATURE_OnMessage(Feature *feature, Request *request) } else { if (request->msgId == MSG_TIME_PROC) { LOS_Msleep(WAIT_FEATURE_PROC * 11); // sleep 11 seconds - if (request->msgValue) { - SAMGR_PrintServices(); - } else { - SAMGR_PrintOperations(); - } + printf("[LPC Test][TaskID:%p][OnMessage: S:%s, F:%s] Time Message Get Value<%s>!", + osThreadGetId(), EXAMPLE_SERVICE, feature->GetName(feature), request->msgValue ? "TRUE" : "FALSE"); AsyncTimeCall(GET_IUNKNOWN(g_example)); return FALSE; } @@ -306,4 +302,4 @@ static void RunTestCase(void) CASE_AsyncTimeCall(demoApi); CASE_ReleaseIUnknown(demoApi); } -TEST_INIT(RunTestCase); +LAYER_INITCALL_DEF(RunTestCase, test, "test"); diff --git a/app/samgr/service_example.c b/app/samgr/service_example.c index 77027d72a0eba2790287224242988a07d75253b0..6021f87856820321fcc620bff61b4f5d9a22a4cd 100755 --- a/app/samgr/service_example.c +++ b/app/samgr/service_example.c @@ -22,7 +22,6 @@ #include "service.h" #include "samgr_lite.h" #include "time_adapter.h" -#include "hctest.h" typedef struct DefaultFeatureApi { INHERIT_IUNKNOWN; @@ -171,4 +170,4 @@ static void RunTestCase(void) CASE_SyncCall(defaultApi); CASE_ReleaseIUnknown(defaultApi); } -TEST_INIT(RunTestCase); \ No newline at end of file +LAYER_INITCALL_DEF(RunTestCase, test, "test"); \ No newline at end of file