This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:bluez_4 [2017/10/22 15:34] 1.241.172.144 [PAN] |
wiki:bluez_4 [2017/10/23 10:49] (current) 1.241.172.144 [BlueZ 4 D-Bus API] |
||
---|---|---|---|
Line 174: | Line 174: | ||
====Config Files==== | ====Config Files==== | ||
- | /etc/init/bluetooth.conf - bluetooth daemon init\\ | + | **/etc/init/bluetooth.conf** - bluetooth daemon init |
- | /etc/bluetooth/main.conf - main bluetooth daemon config\\ | + | |
- | *name of device (when discoverable)\\ | + | |
- | /etc/bluetooth/input.conf - configuration of the input service\\ | + | |
- | /etc/bluetooth/audio.conf - configuration of the audio service (SCO routing: PCM or HCI)\\ | + | |
- | /etc/bluetooth/network.conf - configuration of the network service (link encryption)\\ | + | |
- | /etc/bluetooth/rfcomm.conf - configuration of rfcomm layer\\ | + | |
- | /etc/bluetooth/serial.conf - configuration of serial (DUN tty, UID)\\ | + | |
+ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다.\\ | ||
+ | 폴더만 나중에 새로 생성한다 | ||
+ | |||
+ | **/etc/bluetooth/main.conf** - main bluetooth daemon config | ||
+ | *name of device (when discoverable) | ||
+ | 존재는 하지만 실제 사용되는지는 알 수 없다.\\ | ||
+ | 실제로 여기의 변수를 수정하여도 적용되는 것 같지 않다.\\ | ||
+ | 변화가 전혀 없다. | ||
+ | |||
+ | **/etc/bluetooth/input.conf** - configuration of the input service | ||
+ | |||
+ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
+ | |||
+ | **/etc/bluetooth/audio.conf** - configuration of the audio service (SCO routing: PCM or HCI) | ||
+ | |||
+ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
+ | |||
+ | **/etc/bluetooth/network.conf** - configuration of the network service (link encryption) | ||
+ | |||
+ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
+ | |||
+ | **/etc/bluetooth/rfcomm.conf** - configuration of rfcomm layer | ||
+ | |||
+ | 존재는 하지만 실제 사용되는지는 알 수 없다.\\ | ||
+ | 실제로 여기의 변수를 수정하여도 적용되는 것 같지 않다.\\ | ||
+ | 변화가 전혀 없다. | ||
+ | |||
+ | **/etc/bluetooth/serial.conf** - configuration of serial (DUN tty, UID) | ||
+ | |||
+ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
====Boot Script==== | ====Boot Script==== | ||
Line 249: | Line 272: | ||
* https://code.google.com/archive/p/bluez-tools/ | * https://code.google.com/archive/p/bluez-tools/ | ||
+ | =====D-Bus Message Bus System===== | ||
+ | The BlueZ stack uses the [[https://www.freedesktop.org/wiki/Software/dbus/|D-Bus message bus system]] which is a simple way for applications to talk to one another. | ||
+ | ====BlueZ 4 D-Bus API==== | ||
+ | The BlueZ 4 D-Bus API is defined in [[https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/network-api.txt?id=4.101|doc/network-api.txt]]. Some example usage using **dbus-send**: | ||
- | D-Bus Message Bus System | + | * First you need to get the path to the bluetooth controller you wish to use. We will assign it to a shell env variable and export it for future use: |
- | + | ||
- | The BlueZ stack uses the D-Bus message bus system which is a simple way for applications to talk to one another. | + | |
- | + | ||
- | BlueZ 4 D-Bus API | + | |
- | + | ||
- | The BlueZ 4 D-Bus API is defined in doc/network-api.txt. Some example usage using dbus-send: | + | |
- | + | ||
- | First you need to get the path to the bluetooth controller you wish to use. We will assign it to a shell env variable and export it for future use: | + | |
- | export BTADAPTER=`dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.DefaultAdapter | tail -1 | sed 's/^.*"\(.*\)".*$/\1/'` | + | |
- | To introspect with you can use something like: | + | |
- | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.freedesktop.DBus.Introspectable.Introspect | + | |
- | To make your controller discoverable: | + | |
- | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.SetProperty string:Discoverable variant:boolean:true | + | |
- | To disable discovery: | + | |
- | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.SetProperty string:Discoverable variant:boolean:false | + | |
- | To list paired devices: | + | |
- | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.ListDevices | + | |
- | To trust a device: | + | |
- | dbus-send --system --dest=org.bluez --print-reply $BTADAPTER/dev_54_46_6B_01_7B_2B org.bluez.Device.SetProperty string:Trusted variant:boolean:true | + | |
- | To connect to an HID device (must pair first and can see the path above): | + | |
- | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER/dev_54_46_6B_01_7B_2B org.bluez.Input.Connect | + | |
- | [ 2710.946655] Bluetooth: HIDP (Human Interface Emulation) ver 1.2 | + | |
- | [ 2710.952642] Bluetooth: HIDP socket layer initialized | + | |
- | method return sender=:1.3 -> dest=:1.13 reply_serial=2 | + | |
- | root@ventana:~# [ 2711.352289] hid-generic 0005:0A5C:8502.0001: unknown main item tag 0x0 | + | |
- | [ 2711.359234] input: Bluetooth FAVI as /devices/soc0/soc.0/2100000.aips-bus/2184000.usb/ci_hdrc.0/usb1/1-1/1-1:1.0/bluetooth/hci0/hci0:42/0005:0A5C:8502.0001/input/input1 | + | |
- | [ 2711.374829] hid-generic 0005:0A5C:8502.0001: input: BLUETOOTH HID v1.1b Keyboard [Bluetooth FAVI] on 00:15:83:3d:0a:57 | + | |
- | evtest /dev/input/event1 | + | |
- | + | ||
- | ===== PAN ===== | + | |
- | + | ||
- | ==Purpose== | + | |
- | + | ||
- | This document describes the Bluetooth PAN Profile API, which supports standard IP-based network services deployed over the Bluetooth transport layer. | + | |
- | + | ||
- | ==Required background== | + | |
- | + | ||
- | Familiarity with PAN Profile specification by the Bluetooth SIG is assumed. | + | |
- | + | ||
- | ==Introduction== | + | |
- | + | ||
- | The Personal Area Network (PAN) profile is designed to make a Bluetooth network simulate an ethernet, from an application's perspective.\\ | + | |
- | Each remote device that connects to the PAN device for networking purposes will be merged into the same active PAN. | + | |
- | \\ | + | |
- | + | ||
- | *Key Concepts\\ | + | |
- | *Architectural Relationships\\ | + | |
- | *PAN Roles\\ | + | |
- | + | ||
- | ==Key concepts== | + | |
- | + | ||
- | Personal Area Network (PAN) | + | |
- | A PAN is an ad-hoc network of devices communicating on a standard network configuration, over a Bluetooth radio connection. A PAN may have anywhere from 2 to 8 participating member devices. | + | |
- | + | ||
- | A PAN is not the same as a piconet. Where a piconet is any ad-hoc networking of devices over a Bluetooth connection for the purposes of sharing data or services, like when you pair your phone to your Bluetooth hands-free kit, a PAN deals specifically with networking resources. | + | |
- | + | ||
- | PAN Profile | + | |
- | The Bluetooth specification identifies several profiles including the Bluetooth Personal Area Networking (PAN) profile. The PAN profile simplifies the now deprecated Bluetooth LAN Access and Dial-up Networking profiles by reducing the number of layers in a network Bluetooth connection. | + | |
- | + | ||
- | The PAN profile identifies certain configuration and setup details of a participant of the network, including the PAN host. If a device wants to join a PAN it must support and be able to be configured according to the requirements of the profile in use. For more general information about Bluetooth profiles see Introduction to Bluetooth Profiles. | + | |
- | + | ||
- | PAN profile roles | + | |
- | Typical PAN profile roles include the following: | + | |
- | + | ||
- | PANU | + | |
- | + | ||
- | PAN-GN | + | |
- | + | ||
- | PAN-NAP | + | |
- | + | ||
- | PANU (User) acts as a client member of a PAN-GN (Group ad hoc Network) or a PAN-NAP (Network Access Point). Any device in either the PAN-GN or the PAN-NAP role acts as a server. | + | |
- | + | ||
- | [Top] | + | |
- | + | ||
- | PAN Roles | + | |
- | + | ||
- | The PAN Profile roles are described below: | + | |
- | + | ||
- | PANU | + | |
- | + | ||
- | A Bluetooth enabled device seeking entry into a network or participating in a peer-to-peer (one on one) connection assumes the PANU role, thus becoming a client member of the piconet. | + | |
- | + | ||
- | PANU to PANU connection | + | |
- | + | ||
- | + | ||
- | PANU to PANU connection | + | |
- | + | ||
- | PAN-GN | + | |
- | + | ||
- | A PAN-GN device assumes the role of a forwarding node or host and the attached PANU devices act as clients, networking up to a maximum of seven PANUs. The wireless network is formed without the need of additional hardware like a hub or router as in the case of a conventional cabled network. | + | |
- | + | ||
- | Group Ad-hoc Network (GN) is a temporary, ad hoc network of devices in proximity for sharing information and services. It is called ad hoc because of its on-the-fly or transient nature and can include up to eight (including the host) available Bluetooth-enabled devices in the immediate vicinity, that are willing to participate. | + | |
- | + | ||
- | The device that initiates the network - in this case the PAN-GN - becomes the host or controller. Correspondence in a PAN between the clients is routed through the PAN-GN device (host) in both one-to-one and one-to-many cases. | + | |
- | + | ||
- | Piconet - PAN-GN to PANU relationship | + | |
- | + | ||
- | + | ||
- | Piconet - PAN-GN to PANU relationship | + | |
- | + | ||
- | PAN-NAP | + | |
- | + | ||
- | A PAN-NAP device plays the role of a proxy, bridge, or a router between an existing network say a LAN or the Internet and Bluetooth-enabled devices. The PAN-NAP device takes up to seven active wireless clients. The NAP device acts as a bridge between PANU devices or bluetooth networks and other networks for routing ethernet packets. The Symbian OS PAN-NAP role allows only a single PANU client access to the uplink for the external network. | + | |
- | + | ||
- | PAN-NAP, bridging networks | + | |
- | + | ||
- | + | ||
- | PAN-NAP, bridging networks | + | |
- | + | ||
- | The following image shows a Bluetooth-enabled laptop accessing the Internet through a mobile handset that is acting as a PAN-NAP device. The Bluetooth handset may provide the uplink via GPRS, WIFI, dial-up, or in some other way. | + | |
- | + | ||
- | Dial-up networking | + | |
- | Dial-up networking | + | export BTADAPTER=`dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.DefaultAdapter | tail -1 | sed 's/^.*"\(.*\)".*$/\1/'` |
- | For more information about please see the PAN NAP Role Guide. | + | * To introspect with you can use something like: |
- | [Top] | + | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.freedesktop.DBus.Introspectable.Introspect |
- | Architectural relationships | + | * To make your controller discoverable: |
- | The PAN Profile specification fits in between the application and the hardware abstraction layers. It is connected to and accessed through the Comms-Infras socket by the application. | + | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.SetProperty string:Discoverable variant:boolean:true |
- | Initially, the connection preferences are set in CommDB through the code. The Bluetooth stack is then initialized. An RConnection and RSocketServ instance are created as part of initiating an ESock session and the RConnection object opens the connection through the RSocketServ instance. RConnection::Control() allows configuration of certain aspects of the PAN, for instance adding and deleting devices to/from the PAN. | + | * To disable discovery: |
- | Intact ethernet payloads are transported with the BNEP (Bluetooth Network Encapsulation Protocol) underneath. The PAN profile interacts with the Bluetooth BB (baseband) and conveys the various roles that PAN network nodes would play. | + | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.SetProperty string:Discoverable variant:boolean:false |
- | [Top] | + | * To list paired devices: |
- | PAN Profile Tutorial Series | + | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.ListDevices |
- | The following tutorials have been provided to help give licensee developers guidance when writing applications that make use of the PAN profile. | + | * To trust a device: |
+ | dbus-send --system --dest=org.bluez --print-reply $BTADAPTER/dev_54_46_6B_01_7B_2B org.bluez.Device.SetProperty string:Trusted variant:boolean:true | ||
- | Creating a Personal Area Network | + | * To connect to an HID device (must pair first and can see the path above): |
- | Adding a device to the PAN | + | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER/dev_54_46_6B_01_7B_2B org.bluez.Input.Connect |
+ | [ 2710.946655] Bluetooth: HIDP (Human Interface Emulation) ver 1.2 | ||
+ | [ 2710.952642] Bluetooth: HIDP socket layer initialized | ||
+ | method return sender=:1.3 -> dest=:1.13 reply_serial=2 | ||
+ | root@ventana:~# [ 2711.352289] hid-generic 0005:0A5C:8502.0001: unknown main item tag 0x0 | ||
+ | [ 2711.359234] input: Bluetooth FAVI as /devices/soc0/soc.0/2100000.aips-bus/2184000.usb/ci_hdrc.0/usb1/1-1/1- | ||
+ | 1:1.0/bluetooth/hci0/hci0:42/0005:0A5C:8502.0001/input/input1 | ||
+ | [ 2711.374829] hid-generic 0005:0A5C:8502.0001: input: BLUETOOTH HID v1.1b Keyboard [Bluetooth FAVI] on | ||
+ | 00:15:83:3d:0a:57 | ||
+ | evtest /dev/input/event1 | ||
- | Removing a device from the PAN | + | =====Bluetooth Profiles===== |
- | Closing the PAN | + | In order to use Bluetooth a device must be compatible with a subset of Bluetooth profiles for specific services. These profiles sit on top of the Bluetooth Core specification and protocols. |
- | PAN Example | + | The way a device uses Bluetooth technology depends on its profile capabilities. The profiles provide standards which manufacturers follow to allow devices to be compatible. |
- | PAN Profile Example Guide | + | A full list of profiles can be found [[https://en.wikipedia.org/wiki/List_of_Bluetooth_profiles|here]] however here are some common ones are described in detail in the sections below |
+ | [[PAN]] | ||