wiki:HardwareInfo/Bluetooth

Bluetooth

L2cap under
network/protocols/l2cap :
Provides socket interface to have l2cap channels. L2CAP offers connection oriented and connectionless sockets. But bluetooth stack as this point has no interchangeability with TCP/IP, A Higher level Bluetooth profile must be implemented

HCI under
src/add-ons/kernel/bluetooth :
Here we have 2 modules, one for handling global bluetooth data structures such as connection handles and L2cap channels, and frames

H2generic under
src/add-ons/kernel/drivers/bluetooth
The USB driver, implementing the H2 transport Bluetooth kit under src/kit/bluetooth C++ implementation based on JSR82 api

Bluetooth Server under
src/servers/bluetooth
Basically handling opened devices (local connected fisically in our system) and forwaring kit calls to them

Bluetooth Preferences under
src/preferences/bluetooth
Configuration using the kit

Test applications under
src/tests/kits/bluetooth

There is a small prototype component which is not here documented below src/add-ons/bluetooth/ResetLocalDevice. Its intention was to be an add-on of bluetooth preferences, So that new HCI commands could be customized by users or external developers. I did not like at the end the idea, I did not find the flexibility I wanted.

Links:
Haiku Bluetooth blog
Bluetooth resorce
Bluetooth on wikipedia
Bluetooth docs
FreeBSD Bluetooth
Document approach

The Haiku implementation of Bluetooth

Overview:

Bluetooth is wireless low-power network stack. The target is implement Bluetooth 2.0, although the major differences between 2.0 and 1.1 are in the HW specs. The Project has been divided in 3 phases. The specifications document for Bluetooth, depending its version, very between 1200 and 1500 pages which covers phase 1 and 2 plus hardware device specifications.

The development of the stack will be done keeping an eye to another operating systems, such as Linux and FreeBSD bluetooth kernel land implementations. And MacOS for the user land integration, and SymbianOS or JSR-82 for the possible bluetooth kit.

The reading specs process can be mostly skipped, although is being using as well as other OS source code as consulting material. All non started parts are still to be designed before implementation

Troubleshooting:

  1. Strong dependency with Haiku network stack, which is making hard to keep the development in R5. With the self compiling problem that it implies.
  2. Hardware availability(2 dongle(1damaged), 1 telephone, 2 PCMCIA)

As many of you know from my blog, the project started from scratch with some success.

Technical Info:

Phase 1: Base Stack:

In this phase the intention would be give a a base for further development, user feedback of the technology and real communication.

In an overview provide:

  • Physical layer of the architecture
  • User interaction for managing with devices local & remote(discovery, pairing, properties)
  • Connection oriented / Connectionless services through L2CAP

H2: USB Transport driver (Commands/Events/ACL) 90%

HCI:

  • Core layer 80%
  • Userland interface(ioctls/rawsocket) 70%
  • Managing tools(bluetoot_server, bluetooth kit) 70%

L2CAP:

  • (core protocol/sockets) 65%

Milestones:

  1. Real comunication with the driver (27/09/07)
  2. Stack allowing devices to discover the Haiku node (17/03/08)
  3. Stack allowing discover remote devices through an inquiry process (19/04/08)
  4. Stack handling correctily a pairing process between 2 devices (23/07/08)
  5. L2CAP connection-oriented channels (23/11/08)
  6. L2CAP connection-less channels (23/11/08) (no device available for testing)

Phase 2: Basic Stack:

The intention of this phase would be complete the stack, and let all prepared for the 3rd phase.

H2: USB Transport driver (SCO)

HCI:

  • SCO interface
  • Managing tools(SDP server & client)

RFCOMM: (core protocol/sockets)

Phase 3: Upper Protocols, Profiles and Applications:

Bluetooth profiles define how the bluetooth technology functionality is used, while the protocols is the implementation of the technology. An overview of all these functionalities: http://bluetooth.com/Bluetooth/Technology/Works/Profiles_Overview.htm

Approximately, the specifications for each of these profiles do not go beyond the 100 pages. So Individuals could implement easily one of those functionalities.

Bluetooth Identified tasks:

Haiku Bluetooth Stack implements basic functionality on lower and middle layers, this functionality needs to be completed and all Bluetooth 2.X possibilities explored.

Requirement: Bluetooth enabled Haiku system

Skill set: C++ kernel development, userland development, overview bluetooth stack knowledge(optional)

  • New Tasks:
    • RemoteDevices Database
      • Implement RemoteDevice Archivability (Code-In)
    • Manage server existence depending of LocalDevices (Code-In)
  • Fixes:
    • Fix monitoring of incoming LocalDevices(USB)
    • LocalDevices allocation/leaking LocalDevice::GetLocalDevice
    • Wrong Create Connection parameters(paging) for Bluetooth 2.X
  • Improvements
    • UI
      • Improve Deskbar Addon
      • Improve PinCode Window, move to kit? (Code-In)
      • Improve Incomming connection Window, move to kit? (Code-In)
      • Add Remaining Features in DeviceView
      • Put non relevant information under a ToolTip (Code-In)
    • Functionality
      • UserLand tools(Preferences)
      • Retrieve Discovery and DevClass (other settings?) in Startup (Code-In)
      • Store information
      • Window position
      • Default LocalDevice
      • Settings (Inquiry time, Policy)
      • WriteLocal name to devices
      • Pairing/Auth/Encryption use cases ...

Bluetooth UI Requirements
Server Classes:

PincodePanel (implemented)
ConnectionPanel (implemented)
Deskbar Applet (implemented)

User Classes:

LocalDeviceView: View that shows a LocalDevice (implemented)

  • Icon with the type of device (from device class)
  • BDADDR
  • FriendlyName
  • HCIDelegate Control Flow
  • l2cap make sched connection to use portListener
  • addtoExpected → protect

InquiryPanel: Window to perform a discovery of devices

Preferences:

  • Connections & Channels List

Table Of Devices (Archived RemoteDevices classes) (to be reviewed):

  • Known devices
  • Trusted devices
  • Blocked devices
  • Connected Devices

ExtendedLocalDeviceView

  • Set LocalName
  • View LinkKeys

General settings (implemented):

  • Connections acceptation policy
  • Identify current host as... (set localDeviceClass)
  • Start/Stop server
  • Show debug window
  • About

Device-specific settings:

  • Enable/disable device
  • Enable/disable services

Documentation
AFAIR in the software layers point of view there were not important changes from 1.2 until 4.0. Most of them were focused in the physical layers.

Currently on the Kernel area there is the L2CAP[1] and HCI[5] implementations and there is the HCI transport protocol H2[2] (hardware support for usb dongles). In the userland area we have the bluetooth_server[3] which interfaces with the kernel. Then there is a kit[4] which provides an API for applications development.
Currently the best example of an application using this API would be the bluetooth preferences[6].
[1]http://dev.haiku-os.org/browser/haiku/trunk/src/add-ons/kernel/network/protocols/l2cap[[BR]] [2]http://dev.haiku-os.org/browser/haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic[[BR]] [3]http://dev.haiku-os.org/browser/haiku/trunk/src/servers/bluetooth[[BR]] [4]http://dev.haiku-os.org/browser/haiku/trunk/src/kits/bluetooth[[BR]] [5]http://dev.haiku-os.org/browser/haiku/trunk/src/add-ons/kernel/bluetooth[[BR]] [6]http://dev.haiku-os.org/browser/haiku/trunk/src/preferences/bluetooth[[BR]]

Last modified 7 years ago Last modified on Mar 15, 2013, 9:52:00 AM

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.