building a bt 4.0 le hid device

18
London Bluetooth Hardware Developers Sponsored by Venue #LBTHD .IDEAL

Upload: nick-brook

Post on 16-Jul-2015

537 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: Building a BT 4.0 LE HID device

London Bluetooth Hardware Developers

Sponsored by

Venue

#LBTHD

.IDEAL

Page 2: Building a BT 4.0 LE HID device

“Apple iBeacon Technology Overview”Vladimir Petrov @VladPetroff

🍕🍩🍻💬 🍕🍩🍻💬 🍕🍩🍻💬

“Deploying beacons in a retail environment” Tim Woolford @tim_woolford

“Introduction to Avnet and Bluegiga BLE121LR” Alastair Worth @wirelessworthy

🍻 Blueberry Bar, across the road

#LBTHD

“Building a BT 4.0 LE HID device” Nick Brook @nrbrook

.IDEAL

Page 3: Building a BT 4.0 LE HID device

#LBTHD .IDEAL

“Building a BT 4.0 LE HID device”Nick Brook @nrbrook

Page 4: Building a BT 4.0 LE HID device

#LBTHD

• Bluetooth foot pedal

• Supports up to 4 pedals

• Used primarily with music display Apps, turning pages

.IDEAL

AirTurn BT-105

Page 5: Building a BT 4.0 LE HID device

#LBTHD

• Bluetooth 2.1

• HID device — Bluetooth keyboard

• iOS

• Doesn’t provide access to key events (directly, <7)

• Hides the virtual keyboard

• Requires hacks

.IDEAL

AirTurn BT-105

Page 6: Building a BT 4.0 LE HID device

#LBTHD

• Provides direct access to Bluetooth 4 LE devices

• Introduced iOS 5

• Good device support

.IDEAL

CoreBluetooth

Page 7: Building a BT 4.0 LE HID device

#LBTHD

• AKA “Bluetooth Smart”

• Entirely new protocol stack (vs Bluetooth “Classic”)

• Peripheral (Server) advertises services

• Central (Client) scans and connects to devices

.IDEAL

Bluetooth 4 LE

Page 8: Building a BT 4.0 LE HID device

#LBTHD .IDEAL

Bluetooth 4 LE

Page 9: Building a BT 4.0 LE HID device

#LBTHD

• 31 byte advertising packet + scan response

• GATT Database

• Services

• Characteristics (key -> value store)

• Up to 512 bytes

• Read, write, notify

.IDEAL

Bluetooth 4 LE

Page 10: Building a BT 4.0 LE HID device

#LBTHD

• Some services defined by Bluetooth SIG, e.g.

• Human Interface Device

• Device Information

• Battery

• You can define your own services

.IDEAL

Bluetooth 4 LE

Page 11: Building a BT 4.0 LE HID device

#LBTHD

• Simple

• Quick to learn

• Can achieve a lot

• Some oddities

.IDEAL

Bluetooth 4 LE

Protocol Requirements 30 June 2010

BLUETOOTH SPECIFICATION Version 4.0 [Vol 3] page 485 of 656

Attribute Protocol (ATT)

If an error code is received in the Error Response that is not understood by the client, for example an error code that was reserved for future use that is now being used in a future version of this specification, then the Error Response shall still be considered to state that the given request cannot be performed for an unknown reason.

3.4.2 MTU Exchange

3.4.2.1 Exchange MTU Request

The Exchange MTU Request is used by the client to inform the server of the client’s maximum receive MTU size and request the server to respond with its maximum receive MTU size.

The Client Rx MTU shall be greater than or equal to the default ATT_MTU.

This request shall only be sent once during a connection by the client. The Cli-ent Rx MTU parameter shall be set to the maximum size of the attribute proto-col PDU that the client can receive.

Unlikely Error 0x0E The attribute request that was requested has encountered an error that was unlikely, and therefore could not be completed as requested.

Insufficient Encryption 0x0F The attribute requires encryption before it can be read or written.

Unsupported Group Type 0x10 The attribute type is not a supported grouping attribute as defined by a higher layer specification.

Insufficient Resources 0x11 Insufficient Resources to complete the request

Reserved 0x012 – 0x7F Reserved for future use.

Application Error 0x80 – 0xFF Application error code defined by a higher layer specification.

Parameter Size (octets) Description

Attribute Opcode 1 0x02 = Exchange MTU Request

Client Rx MTU 2 Client receive MTU size

Table 3.4: Format of Exchange MTU Request

Name Error Code Description

Table 3.3: Error Codes

Page 12: Building a BT 4.0 LE HID device

#LBTHD

• Small

• Low cost (£8)

• Low power (CR2032)

• Complete integrated package (radio, antenna, microcontroller, flash, GPIO, UART, I2C, PWM, ADC)

• Easy, simple, quick to get started

• BGScript

.IDEAL

Bluegiga BLE113

Page 13: Building a BT 4.0 LE HID device

#LBTHD

• Don’t need much circuitry around the package

• Power supply

• Any sensors/IO

.IDEAL

Bluegiga BLE113

Page 14: Building a BT 4.0 LE HID device

#LBTHD .IDEAL

Profile Toolkit

Page 15: Building a BT 4.0 LE HID device

#LBTHD .IDEAL

BGScript

Page 16: Building a BT 4.0 LE HID device

#LBTHD

• Custom GATT service

• Provides pedal state change notifications

• Also supports HID for keyboard / mouse commands

.IDEAL

New AirTurn

Page 17: Building a BT 4.0 LE HID device

#LBTHD

• Scans for / connects to devices

• UI provided

• Sends out notifications on pedal events

• Works in background

• Different AirTurns connected to different Apps

• Simple to implement

• No Hacks!!

.IDEAL

New framework

Page 18: Building a BT 4.0 LE HID device

#LBTHD

• Growing number of freelance projects

• Get in touch

• @nrbrook

[email protected]

• Speak to me!

• Please give feedback! http://goo.gl/HgSrgu

.IDEAL

LE + mobile projects