Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
418ba6e2
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
418ba6e2
编写于
7月 12, 2023
作者:
W
wangqingkaihong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
检视修改
Signed-off-by:
N
wangqingkaihong
<
wangqing@kaihong.com
>
上级
e99e57ee
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
7 addition
and
0 deletion
+7
-0
zh-cn/third-party-cases/how-to-connect-to-bluetooth.md
zh-cn/third-party-cases/how-to-connect-to-bluetooth.md
+7
-0
未找到文件。
zh-cn/third-party-cases/how-to-connect-to-bluetooth.md
浏览文件 @
418ba6e2
...
...
@@ -12,6 +12,9 @@
| !
[](
figures/bluetooth_list.png
)
| !
[](
figures/bluetooth_dialog.png
)
| !
[](
figures/bluetooth_delete.png
)
|
## 运行环境
本例基于以下环境开发,开发者也可以基于其他适配的版本进行开发。
-
IDE:DevEco Studio 3.1.1 Release
-
SDK:Ohos_sdk_full 4.0.8.5(API Version 10 Beta1)
...
...
@@ -87,6 +90,7 @@
}
]
```
2.
构建UI框架,整体的UI框架分为TitleBar(页面名称),PinDialog(配对蓝牙弹框),index(主页面)三个部分。
```ts
...
...
@@ -315,6 +319,7 @@
}
}
```
3.
蓝牙开关打开关闭操作,需要打开蓝牙开关才能进行后续操作:
```
ts
initBluetooth
()
{
...
...
@@ -341,6 +346,7 @@
bluetooth
.
enableBluetooth
()
}
```
4.
设置蓝牙扫描模式并开启扫描去发现设备,并订阅蓝牙设备发现上报时间获取设备列表
```
ts
foundDevices
()
{
...
...
@@ -402,5 +408,6 @@
## 参考
-
[
权限申请指导
](
../application-dev/security/accesstoken-guidelines.md
)
-
[
@ohos.bluetooth
](
../application-dev/reference/apis/js-apis-bluetooth.md
)
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录