查看: 954|回复: 0

[评测分享] 【飞凌RZG2L开发板测评】_forlinx_ok-g2lx_蓝牙功能测试

[复制链接]
  • TA的每日心情
    无聊
    2022-10-18 10:03
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    发表于 2022-10-26 15:29:28 | 显示全部楼层 |阅读模式
    分享到:
    forlinx_ok-g2lx
    蓝牙功能测试
    一、建立蓝牙连接
    1. 开发板作为客户端被扫描连接
    (1)
    root@okg2l:~# bluetoothctl                                                                 //打开蓝牙设备
    Agent registered
    [CHG] Controller 30:7B:C9:47:F8B Pairable: yes
    [bluetooth]# power on                                                                         //启动蓝牙设备
    [CHG] Controller 30:7B:C9:47:F8B Class: 0x00100000
    Changing power on succeeded
    [CHG] Controller 30:7B:C9:47:F8B Powered: yes
    [bluetooth]# pairable on                                                //设置为配对模式
    Changing pairable on succeeded
    [bluetooth]# discoverable on                                                                //设置为可发现模式
    Changing discoverable on succeeded
    [bluetooth]# agent on                                                                        //启动**
    Agent is already registered
    [bluetooth]# default-agent                                                                 //设置当前**为默认
    Default agent request successful
    (2) 可以在手机蓝牙搜索中发现okg2l的设备
    图1
    在手机端点击此蓝牙尝试配对
    图2
    (3) 开发板端会弹出
    [NEW] Device 940:0D:7E:8B:B6 Honor 8X Max
    Request confirmation
    [agent] Confirm passkey 223223 (yes/no): yes
    手机端配对成功,建立连接
    图3
    (4) 建立连接以后,可以在开发板端查看和移除连接设备
    [Honor 8X Max]# devices
    Device 940:0D:7E:8B:B6 Honor 8X Max
    [Honor 8X Max]# remove 940:0D:7E:8B:B6      
    Device has been removed
    2. 开发板作为主机主动开启扫描
    (1)
    [bluetooth]# scan on                                                                                //开始搜索
    [DEL] Device 31:30:08:FE:34:FF 31-30-08-FE-34-FF
    Discovery started
    [CHG] Device 940:0D:7E:8B:B6 LegacyPairing: no
    [CHG] Device 940:0D:7E:8B:B6 RSSI: -64
    [CHG] Device 30:07:96:61:11:E7 RSSI: -70
    [CHG] Device D8:32:E3:0F:4D:7D RSSI: -64
    [NEW] Device 6D:85:3C:F7:67:10 6D-85-3C-F7-67-10
    [CHG] Device 4A:6B:44:95:19:A9 RSSI: -80
    [CHG] Controller 30:7B:C9:47:F8B Class: 0x00000000
    [DEL] Device 57C:75:C0:57:54 57-DC-75-C0-57-54
    [DEL] Device 63:B0:E8:CC:AE:F2 63-B0-E8-CC-AE-F2
    [CHG] Device 94:D0:0D:7E:8B:B6 LegacyPairing: yes
    [CHG] Device 4A:CF:8C:E8:11:D8 RSSI: -66
    [CHG] Device 44:C8:6D:60:66:E2 RSSI: -68
    [CHG] Device 44:C8:6D:60:66:E2 TxPower: 12
    [CHG] Device 94:D0:0D:7E:8B:B6 LegacyPairing: no
    [CHG] Device 6A:8D:AF:E6:16:4D RSSI: -80
    [CHG] Device 4A:CF:8C:E8:11:D8 RSSI: -82
    [CHG] Device 40:1C:83:3A:EB:60 RSSI: -74
    [CHG] Device 78:43:2B:49:06:84 RSSI: -68
    停止扫描                                                                                                //停止搜索
    [bluetooth]# scan off
    [bluetooth]# pair 94:D0:0D:7E:8B:B6                                                        //配对蓝牙
    Attempting to pair with 94:D0:0D:7E:8B:B6
    [CHG] Device 94:D0:0D:7E:8B:B6 Connected: yes
    Request confirmation
    [agent] Confirm passkey 340274 (yes/no): yes
    [bluetooth]# devices                                                                                 //蓝牙配对成功
    Device 94:D0:0D:7E:8B:B6 Honor 8X Max
    (2) 手机端弹出蓝牙配对界面
    图4
    二、文件传输
    蓝牙连接成功以后,可以通过蓝牙进行文件传输
    1. 开发板发送文件给手机
    (1) 首先确认蓝牙已经连接
    [bluetooth]# paired-devices
    Device 94:D0:0D:7E:8B:B6 Honor 8X Max
    (2)
    root@okg2l:~# obexctl                                                                         //启动obecctl服务
    [NEW] Client /org/bluez/obex
    (3)
    [obex]# connect 94:D0:0D:7E:8B:B6                                                //建立连接
    Attempting to connect to 94:D0:0D:7E:8B:B6
    [NEW] Session /org/bluez/obex/client/session0 [default]
    [NEW] ObjectPush /org/bluez/obex/client/session0
    Connection successful
    (4)
    [94:D0:0D:7E:8B:B6]# send /home/forlinx/audio/test.mp3                //发送文件
    Attempting to send /home/forlinx/audio/test.mp3 to /org/bluez/obex/client/session0
    [NEW] Transfer /org/bluez/obex/client/session0/transfer0
    Transfer /org/bluez/obex/client/session0/transfer0
            Status: queued
            Name: test.mp3
            Size: 4818092
            Filename: /home/forlinx/audio/test.mp3
            Session: /org/bluez/obex/client/session0
    [CHG] Transfer /org/bluez/obex/client/session0/transfer0 Status: active
    [CHG] Transfer /org/bluez/obex/client/session0/transfer0 Transferred: 8046 (@8KB/s 09:57)
    [CHG] Transfer /org/bluez/obex/client/session0/transfer0 Transferred: 64599 (@56KB/s 01:24)
    [CHG] Transfer /org/bluez/obex/client/session0/transfer0 Transferred: 177705 (@113KB/s 00:41)
    [CHG] Transfer /org/bluez/obex/client/session0/transfer0 Transferred: 306969 (@129KB/s 00:34)
    [CHG] Transfer /org/bluez/obex/client/session0/transfer0 Transferred: 4411101 (@56KB/s 00:07)
    [CHG] Transfer /org/bluez/obex/client/session0/transfer0 Transferred: 4483812 (@72KB/s 00:04)
    [CHG] Transfer /org/bluez/obex/client/session0/transfer0 Transferred: 4548444 (@64KB/s 00:04)
    [CHG] Transfer /org/bluez/obex/client/session0/transfer0 Transferred: 4637313 (@88KB/s 00:02)
    [DEL] Client /org/bluez/obex
    [DEL] Session /org/bluez/obex/client/session0 [default]
    [DEL] ObjectPush /org/bluez/obex/client/session0
    [DEL] Transfer /org/bluez/obex/client/session0/transfer0
    [NEW] Client /org/bluez/obex
    [DEL] Client /org/bluez/obex
    [NEW] Client /org/bluez/obex                                                                 //发送完毕
    (5) 手机端弹出蓝牙接收信息
    图5
    2. 手机发送文件到开发板
    (1) 要确保在连接状态传输
    [obex]# connect 94:D0:0D:7E:8B:B6
    Attempting to connect to 94:D0:0D:7E:8B:B6
    [NEW] Session /org/bluez/obex/client/session0 [default]
    [NEW] ObjectPush /org/bluez/obex/client/session0
    Connection successful
    (2) 手机通过蓝牙发送文件
    图6
    (3) 开发板接收完成
    root@okg2l:~# ls -l /tmp/
    total 4708
    -rw------- 1 root root 4818092 Oct 26 11:49 test-1.mp3

    图片1.png
    图片3.png
    图片2.png
    图片4.png
    图片5.png
    图片6.png
    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /3 下一条

    手机版|小黑屋|与非网

    GMT+8, 2025-1-12 06:58 , Processed in 0.122381 second(s), 17 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.