提交 a5cb7012 编写于 作者: M mamingshuai

update openharmony 1.0.1

上级 e6289647
### 该问题是怎么引起的?
### 重现步骤
### 报错信息
### 相关的Issue
### 原因(目的、解决的问题等)
### 描述(做了什么,变更了什么)
### 测试用例(新增、改动、可能影响的功能)
# WIFI\_IOT\_APP<a name="EN-US_TOPIC_0000001132694217"></a>
- [Introduction](#section11660541593)
- [Directory Structure](#section1464106163817)
- [Repositories Involved](#section1718733212019)
## Introduction<a name="section11660541593"></a>
The WIFI\_IOT\_APP module provides sample code for iothardware, demolink, and samgr.
## Directory Structure<a name="section1464106163817"></a>
```
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<a name="section1718733212019"></a>
applications\_sample\_wifi-iot
# WIFI\_IOT\_APP组件<a name="ZH-CN_TOPIC_0000001132694217"></a>
- [简介](#section11660541593)
- [目录](#section1464106163817)
- [涉及仓](#section1718733212019)
## 简介<a name="section11660541593"></a>
WIFI\_IOT\_APP组件,提供了iothardware、demolink、samgr等示例代码。
## 目录<a name="section1464106163817"></a>
```
applications/sample/wifi-iot/ # sample模块目录
└── app
├── BUILD.gn # 模块构建脚本
├── demolink # demolink集成示例代码
├── iothardware # LED操作示例代码
├── samgr # 服务框架示例代码
└── startup
```
## 涉及仓<a name="section1718733212019"></a>
applications\_sample\_wifi-iot
# 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",
]
}
......@@ -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);
......@@ -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",
]
}
......@@ -19,7 +19,6 @@
#include <los_base.h>
#include <cmsis_os.h>
#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");
......@@ -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");
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册