1. Ubuntu12.04查看BlueZ版本:
#dpkg --status bluez | grep '^Version:'
Version: 4.98-2ubuntu7
2.查看蓝牙适配器:
root@wv-ThinkPad-SL:/home/wv# hciconfig
hci1: Type: BR/EDR Bus: USB
BD Address: 00:23:4D:FD:01:9C ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:856 acl:0 sco:0 events:36 errors:0
TX bytes:886 acl:0 sco:0 commands:36 errors:0
root@wv-ThinkPad-SL:/home/wv# hciconfig
hci0: Type: BR/EDR Bus: USB
BD Address: 00:1A:7D:DA:71:13 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:822 acl:0 sco:0 events:33 errors:0
TX bytes:877 acl:0 sco:0 commands:33 errors:0
hci1: Type: BR/EDR Bus: USB
BD Address: 00:23:4D:FD:01:9C ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:856 acl:0 sco:0 events:36 errors:0
TX bytes:886 acl:0 sco:0 commands:36 errors:0
3. 扫描LE设备:
root@wv-ThinkPad-SL:/home/wv# hcitool lescan
LE Scan ...
90:59:AF:27:B6:C9 (unknown)
90:59:AF:27:B6:C9 Keyfobdemo
4. 配置Advertise:
其中: HELLO WORLD" would use: 48 45 4c 4c 4f 57 4f 52 4c 44
sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 00 00 00 00 00 00 00 00 00 00 00 00 00
5. 激活Advertising:
开始广播并可连接:
sudo hciconfig hci0 leadv 0
只开始广播不可连接:
sudo hciconfig hci0 leadv 3
6. 停止Advertising:
sudo hciconfig hci0 noleadv
7. 升级BlueZ:
sudo apt-get install build-essential libdbus-1-dev check
./configure --prefix=/home/wv/source/bluez/bin/bluez --mandir=/home/wv/source/bluez/bin/man --sysconfdir=/home/wv/source/bluez/bin/etc --localstatedir=/home/wv/source/bluez/bin/var --enable-library --enable-test --with-dbusconfdir=/home/wv/source/bluez/bin/dbus/etc/dbus-1 --with-dbussystembusdir=/home/wv/source/bluez/bin/dbus/etc/dbus-1 --with-dbussessionbusdir=/home/wv/source/bluez/bin/dbus/etc/dbus-1 这个路径有问题,还没有成功
make && make install
报错:configure: error: D-Bus >= 1.6 is required
wv@wv-ThinkPad-SL:~/source/bluez/bluez-5.15$ dbus-daemon --version
D-Bus Message Bus Daemon 1.4.18
需要升级DBus:
下载DBus:
./configure --prefix=/home/wv/source/bluez/bin/dbus
make
su make install
configure: WARNING: unrecognized options: --enable-library, --enable-test
D-Bus 1.6.12
==============
prefix: /home/wv/source/bluez/bin/bluez
exec_prefix: ${prefix}
libdir: /home/wv/source/bluez/bin/bluez/lib
libexecdir: /home/wv/source/bluez/bin/bluez/libexec
bindir: /home/wv/source/bluez/bin/bluez/bin
sysconfdir: /home/wv/source/bluez/bin/etc
localstatedir: /home/wv/source/bluez/bin/var
datadir: /home/wv/source/bluez/bin/bluez/share
source code location: .
compiler: gcc
cflags: -Wall -Wextra -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wno-address -Wfloat-equal -Wdeclaration-after-statement -Wno-unused-label -Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare -Wno-pointer-sign -Wno-type-limits -fno-common -fno-strict-aliasing -g -O2
cppflags:
cxxflags: -g -O2
64-bit int: long
32-bit int: int
16-bit int: short
Doxygen: no
xmlto: no
man2html: not found
Rebuilding generated files: yes
gcc coverage profiling:
Building embedded tests: no
Building modular tests: auto
- with GLib: no
Building verbose mode: no
Building assertions: no
Building checks: yes
Building bus stats API: no
Building SELinux support: no
Building inotify support: yes
Building dnotify support: no
Building kqueue support: no
Building systemd support: no
Building X11 code:
Building Doxygen docs: no
Building XML docs: no
Building cache support: yes
Building launchd support: no
Using XML parser:
Init scripts style: none
Abstract socket names: yes
System bus socket: /home/wv/source/bluez/bin/var/run/dbus/system_bus_socket
System bus address: unix:path=/home/wv/source/bluez/bin/var/run/dbus/system_bus_socket
System bus PID file: /home/wv/source/bluez/bin/var/run/dbus/pid
Session bus address: unix:tmpdir=/tmp
Console auth dir: /var/run/console/
Console owner file: no
Console owner file path:
System bus user: messagebus
Session bus services dir: /home/wv/source/bluez/bin/bluez/share/dbus-1/services
'make check' socket dir: /tmp
阅读(3636) | 评论(0) | 转发(0) |