MAP 定义交换消息的设备要使用的功能和过程 对象。
要执行蓝牙 MAP 功能,您必须首先完成以下步骤 程序。
为蓝牙 MAP 功能设置设备[
先决条件
- 启用 SSH 以访问您的主机设备。
- 将 DUT 与远程设备配对。
- 将 DUT 和远程设备放在蓝牙附近。
程序
-
使用以下命令在命令提示符中运行 SSH:
ssh root@<device_IP_address>
例
如果设备的 IP 地址为 ,则运行 以下命令:
10.92.160.222
ssh root@10.92.160.222
-
输入以下密码连接到 SSH:
oelinux123
-
通过运行以下命令打开 Bluetooth 测试应用程序:要查看 OBEX 函数,请运行以下命令:
obexctl
help
这 command 提供 obexctl 的主菜单。
示例输出
sh-5.1# obexctl
\[NEW\] Client /org/bluez/obex
\[obex\]# help
Menu main:
Available commands:
-------------------
connect <dev> \[uuid\] \[channel\] Connect session
disconnect \[session\] Disconnect session
list List available sessions
show \[session\] Session information
select <session> Select default session
info <object> Object information
cancel <transfer> Cancel transfer
suspend <transfer> Suspend transfer
resume <transfer> Resume transfer
send <file> Send file
pull <file> Pull Vobject & stores in file
cd <path> Change current folder
ls <options> List current folder
cp <source file> <destination file> Copy source file to destination file
mv <source file> <destination file> Move source file to destination file
rm <file> Delete file
mkdir <folder> Create folder
version Display version
quit Quit program
exit Quit program
help Display help about this program
export Print environment variables
\[obex\]#
您可以使用 obexctl 的主菜单。
拉取并阅读消息
在开始之前,请执行以下作:
-
将 DUT 与远程设备配对。
-
在服务器上创建 MAP 目录。
注意在 BlueZ 中 堆栈,MAP 服务器功能不能直接测试或验证为 您无法在设备上发送或接收蜂窝网络消息。因此,您 必须在 DUT 上创建 MAP 目录。
要从服务器提取并读取消息,请执行以下作:
- 启动从远程设备到 DUT 的连接。
- 接受 DUT 上的连接请求,如下所示:
-
在 DUT 上运行 SSH。
-
通过运行 以下命令:
bluetoothctl
bluetoothctl
-
对连接请求进行身份验证。
-
- 将预期的消息从服务器拉取到客户端。
- 在客户端上打开并验证检索到的消息。
MAP 目录示例
您可以创建一个示例 MAP 目录来验证 MAP 服务器功能 遵循:
-
运行 SSH。
-
通过以下方式创建消息目录 map-messages/telecom/msg 依次运行以下命令:
-
mkdir map-messages
-
cd map-messages
-
mkdir telecom
-
cd map-messages/telecom
-
mkdir msg
-
cd telecom/msg
-
-
在 msg 目录中,创建以下子文件夹:
- 收件箱
- 发件箱
- 送
- 删除
- 草案
要在 msg 中创建子文件夹,请运行以下命令 命令:
mkdir <subfolder>
<subfolder>
是子文件夹的名称。例如。inbox
-
在每个子文件夹中,创建消息文件。
下图显示了一个示例 MAP 目录。在 /map-messages/telecom/msg/ 目录中,有子文件夹 对于不同类型的消息。这些子文件夹包含消息。