Skip to content

Latest commit

 

History

History
230 lines (165 loc) · 11.8 KB

ConfigService.md

File metadata and controls

230 lines (165 loc) · 11.8 KB

UriBeacon Configuration Service

Revision v2r1

The material contained on this page is informative only and subject to change.

1 Introduction

The UriBeacon Configuration Service should only be available during Configuration Mode (i.e. connectable) and not be available during regular URI Advertising Mode (i.e. not connectable). The UriBeacon Configuration Service allows setting UriBeacon fields and transmission characteristics. This information includes the following:

  • Lock code
  • Uri
  • Flags
  • Transmit Power
  • Duty Cycle

This document is formatted according to the Bluetooth service and profile formatting styles.

1.1 Configuration Mode

A Configuration Mode is necessary because having a continuously connectable UriBeacon would allow any passerby to connect to the device and stop the UriBeacon from broadcasting. As a consequence a third party could launch a Denial of Service (DoS) attack by permanently connecting to the beacon. For this reason a UriBeacon should not be connectable during regular URI Advertising mode.

A beacon can be placed in Configuration Mode in order to be configurable. Configuration Mode should only be used by an administrator, and we recommend the following options to make it difficult for a random third-party to reconfigure proprietary beacons:

  • A button that when pressed puts the beacon in Configuration Mode for a short period of time. The button could be placed inside the battery compartment or outside of the beacon if the beacon is placed out of reach for typical clients/users of the UriBeacon system
  • A beacon could be placed in Configuration Mode automatically during a short period after power on (say 30 seconds) e.g. batteries are installed, or the beacon is connected to the mains supply (e.g. a USB wall power supply, etc).

When in Configuration mode the beacon would advertise a different ADV packet indicating that mode using the ADV long name parameter string, and the ADV Service 128-bit UUID of the UriBeacon configuration service, and an ADV TxPower parameter to allow nearness of the beacon to be determined by the signal path-loss. Its recommend that the radio TxPower should also be increased to a Medium transmit power (typ. -2dBm) and this should also be reflected in the ADV TxPower parameter(typ. -6dBm, with a loss of 4dBm in the beacon antenna). Note: including all these parameters might result in the packet exceeding 31 bytes, in which case a larger configuration packet size of 62 bytes can be achieved using the scan/response mechanism.

1.2 Service Dependencies

This service is not dependent upon any other services.

1.3 Transport Dependencies

Transport Supported
Classic false
Low Energy true

1.4 Return Codes

Code Description
0x00 Success
0x03 Write Not Permitted
0x08 Insufficient Authorization
0x0d Invalid Attribute Length

2 Service Declaration

The assigned number for <<UriBeacon Configuration Service>> is

    ee0c2080-8786-40ba-ab96-99b91ac981d8

3 Service Characteristics

Characteristic Ref. Requirement
Lock State 3.1 Mandatory
Lock 3.2 Optional
Unlock 3.3 Optional
Uri Data 3.4 Mandatory
Uri Flags 3.5 Mandatory
Advertised Tx Power Levels 3.6 Mandatory
Tx Power Mode 3.7 Mandatory
Beacon Period 3.8 Mandatory
Reset 3.9 Mandatory
Broadcast Read Write
without
Response
Write Notify Indicate Signed Write Reliable Write Writable Auxiliaries
Lock State X M X X X X X X X
Lock X X X O* X X X X X
Unlock X X X O X X X X X
Uri Data X M X M* X X X X X
Uri Flags X M X M* X X X X X
Advertised Tx Power Levels X M X M* X X X X X
Tx Power Mode X M X M* X X X X X
Beacon Period X M X M* X X X X X
Reset X X X M* X X X X X

* Must be in unlock state.

3.1 Lock State

Name Lock State
UUID ee0c2081-8786-40ba-ab96-99b91ac981d8
Description Reads the lock state.
Type boolean
Lock State Either locked or unlocked.

Read returns true if the device is locked.

3.2 Lock

Name Lock
UUID ee0c2082-8786-40ba-ab96-99b91ac981d8
Description Locks the beacon and sets the single-use lock-code.
Type uint128
Lock State Must be unlocked. Will be locked after successful write.

Return Codes

3.3 Unlock

Name Unlock
UUID ee0c2083-8786-40ba-ab96-99b91ac981d8
Description Unlocks the beacon and clears the single-use lock-code.
Type uint128
Lock State Will be unlocked after successful write.

Return Codes

  • Insufficient Authorization for an unlock attempt with an valid length incorrect key when the beacon is locked.
  • Invalid length for an unlock attempt with an invalid length whether the beacon is locked or not.
  • Success for an unlock attempt with a valid length key when the beacon is unlocked

3.4 Uri Data

Name Uri Data
UUID ee0c2084-8786-40ba-ab96-99b91ac981d8
Description Reads/writes the Uri.
Type uint8[]
Lock State For write, must be unlocked.

The Uri Data characteristic is a variable length structure. The first byte contains the Uri Scheme Prefix. The remaining bytes contain either urn:uuid encoding or HTTP URL encoding.

Note: Uri Data must be between 0 and 18 bytes in length.

3.5 Flags

Name Flags
UUID ee0c2085-8786-40ba-ab96-99b91ac981d8
Description Reads/writes the flags.
Type uint8
Lock State For write, must be unlocked.

The Flags characteristic is a single unsigned byte value containing the UriBeacon Flags.

3.6 Advertised TX Power Levels

Name Advertised TX Power Levels
UUID ee0c2086-8786-40ba-ab96-99b91ac981d8
Description Reads/writes the Advertised Power Levels array.
Type int8[4]
Lock State For write, must be unlocked.

This characteristic is a fixed length array of values, in dBm, to be included in the UriBeacon TX Power Level field of the advertisement when that mode is active. The index into the array is TX Power Mode.

Note to developers: The Advertised TX Power Levels is not the same as values set internally into the radio tx power. You need to implement an internal array indexed by TX Power Mode that is used for the internal facing radio setting.

The Advertised TX Power Levels is also indexed by TX Power Mode but is outward facing, and is the value that is put into the adv packet. These are related but distinct because numbers used by radio function may not be the same as those exposed in adv packets.

The best way to determine the precise value for these output values is to measure the actual RSSI from your beacon from 1 meter away and then add 41dBm to that. 41dBm is the signal loss that occurs over 1 meter.

3.7 TX Power Mode

Name TX Power Mode
UUID ee0c2087-8786-40ba-ab96-99b91ac981d8
Description Reads/writes the TX Power Mode.
Type uint8
Lock State For write, must be unlocked.

Sets the transmission power mode to one of:

Power Level Value
TX_POWER_MODE_HIGH 3
TX_POWER_MODE_MEDIUM 2
TX_POWER_MODE_LOW 1
TX_POWER_MODE_LOWEST 0

Return Codes

3.8 Beacon Period

Name Beacon Period
UUID ee0c2088-8786-40ba-ab96-99b91ac981d8
Description The period in milliseconds that a UriBeacon packet is transmitted.
Type uint16
Lock State For write, must be unlocked.

The period in milliseconds that a UriBeacon packet is transmitted. A value of zero disables UriBeacon transmissions. Setting a period value that the hardware doesn't support should default to minimum value the hardware supports. For example if the user tries to set the period to 1 millisecond and the lowest value the hardware supports is 100 milliseconds, the value for the characteristic should be set to 100 milliseconds and the UriBeacon should broadcast at a 100 milliseconds.

3.9 Reset

Name Reset
UUID ee0c2089-8786-40ba-ab96-99b91ac981d8
Description Reset to default values.
Type boolean
Lock State Must be unlocked.

Writing a non-zero value to this characteristic will set all characteristics to their initial values:

Characteristic Default Value
Uri Data vendor specified
Uri Flags 0
TX Power Mode TX_POWER_MODE_LOW
Beacon Period 1000 (1 second)
Lock 00000000-00000-0000-0000-000000000000

4 Reserved Characteristics

The following Characteristic UUIDs are are reserved for future use:

UUID
ee0c2090-8786-40ba-ab96-99b91ac981d8