Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Applications Sample Wifi Iot
提交
a5cb7012
A
Applications Sample Wifi Iot
项目概览
OpenHarmony
/
Applications Sample Wifi Iot
8 个月 前同步成功
通知
3
Star
24
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
Applications Sample Wifi Iot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a5cb7012
编写于
3月 11, 2021
作者:
M
mamingshuai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update openharmony 1.0.1
上级
e6289647
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
96 addition
and
103 deletion
+96
-103
.gitee/ISSUE_TEMPLATE.zh-CN.md
.gitee/ISSUE_TEMPLATE.zh-CN.md
+0
-13
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
+0
-15
README.md
README.md
+26
-0
README_zh.md
README_zh.md
+26
-0
app/iothardware/BUILD.gn
app/iothardware/BUILD.gn
+23
-21
app/iothardware/led_example.c
app/iothardware/led_example.c
+9
-37
app/samgr/BUILD.gn
app/samgr/BUILD.gn
+7
-6
app/samgr/broadcast_example.c
app/samgr/broadcast_example.c
+1
-2
app/samgr/feature_example.c
app/samgr/feature_example.c
+3
-7
app/samgr/service_example.c
app/samgr/service_example.c
+1
-2
未找到文件。
.gitee/ISSUE_TEMPLATE.zh-CN.md
已删除
100755 → 0
浏览文件 @
e6289647
### 该问题是怎么引起的?
### 重现步骤
### 报错信息
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
已删除
100755 → 0
浏览文件 @
e6289647
### 相关的Issue
### 原因(目的、解决的问题等)
### 描述(做了什么,变更了什么)
### 测试用例(新增、改动、可能影响的功能)
README.md
0 → 100755
浏览文件 @
a5cb7012
# 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
README_zh.md
0 → 100755
浏览文件 @
a5cb7012
# 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
app/iothardware/BUILD.gn
浏览文件 @
a5cb7012
# 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",
]
}
app/iothardware/led_example.c
浏览文件 @
a5cb7012
...
...
@@ -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
);
app/samgr/BUILD.gn
浏览文件 @
a5cb7012
...
...
@@ -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/s
ervices/samgr_lite/samgr/source
",
"//foundation/distributedschedule/s
ervices/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/s
amgr_lite/samgr/adapter
",
"//foundation/distributedschedule/s
amgr_lite/samgr/source
",
"//test/xts/
acts/distributedschedule_lite/samgr_hal/utils
",
]
}
app/samgr/broadcast_example.c
浏览文件 @
a5cb7012
...
...
@@ -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"
);
app/samgr/feature_example.c
浏览文件 @
a5cb7012
...
...
@@ -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"
);
app/samgr/service_example.c
浏览文件 @
a5cb7012
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录