Welcome!

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.


0
Avatar

Juergen Kienhoefer

--Juergen Kienhoefer--

2534
| 4 1 2
Santa Cruz, United States
--Juergen Kienhoefer--
Juergen Kienhoefer
On 12/29/15, 11:43 PM

SmartBeacon Peripheral

The AIRcable SmartBeacon implements a PERIPHERAL profile too. When configured, it allows incoming connections and provides services. A number of characteristics are available for configuration as well as control. For security the correct password has to be sent to a characteristic. Before that, no characteristic is writeable. The SmartBeacon will disconnect from the central if no password is provided within the timeout, which depends on the product, e.g. 30 seconds.

The SmartBeacon uses a complex advertisement scheme to allow connections and provide information about its status to other devices. The general part of the standard connect ad package contains its name with a maximum of 8 characters, its 128 bit UUID as a service UUID and its transmit power. If the SmartBeacon is transmitting an iBeacon, this part is Apple specification conform using its UUID as well as the configured Major and Minor numbers. The transmit power is hidden in the iBeacon package.

The status information about the SmartBeacon is configured into the scan response package. It contains 26 bytes configured as a SIGNED_DATA advertisement type. See also data logger description.

 

Header

AD_TYPE_SIGNED_DATA
CSRmesh device ID, 16 bit
CSRmesh short network key, 16 bit
CSRmesh status: level, power, red, green, blue, color temp, support, power: 9 bytes

Internal temperature, in C 8 bits, analog input status in 10mV 8 bits, battery in 100mV

time in 100ms steps since the last sensor storage, 16 bits
index of the next sensor storage location, 16 bits
tine until the next data log store event, 16 bits
last data log storage, 16 bits
data logger event configuration, 8 bits

Configuration

To configure the SmartBeacon as a Peripheral, you need to broadcast connection package advertisements. This command configures the timing of those packages in number of 100ms intervals. E.g. one second connection ad packages is:

OK> @bc10

send a connect package once per second

 

OK> @b

check broadcast configuration:
broadcast=1000ms, type=connect

It is possible to add the CSRmesh interval to the broadcast interval by specifying the CSRmesh timing too.

OK> #t8

add 80ms CSRmesh scanning to the broadcast interval

OK> @b

check broadcast configuration:
broadcast=1000ms, type=connect mesh at 80ms

Change the name of the SmartBeacon

OK> @nAIRcable

change the name to "AIRcable"

OK> @u1234 2345 3456 4567 5678 6789 7890 890a

UUID has 8 16 bit numbers, it is used in the advertisement package as well as for the CSRmesh as it's unique ID during the association

 

Configure the RF Output Power

The RF output power is configured with the ‘x’ command. The index ranges from 0-6 providing outptu power of -18dBm to +5dBm

OK> @x5

configure for a moderate high output power, index 5
tx=2dBm

OK> @X5configure for a moderate high output power, and reboot the device

Password

An extra security layer is implemented providing the protection for denial of service attacks as well as reconfiguring the SmartBeacon without authorization. We implemented a special characteristic, 0xFFFF that requires you to write the configured password to before it allows access to the configuration. Without writing to that characteristic first, the SmartBeacon will disconnect automatically. Password is set to default “0000”.

OK> v

print configuration
IRbeacon 3.0, name=AIRbeekn, tx=2, pw=0000
own addr=4d7bdac7fe46
UUID=00001c00-ffa2-11e2-8ebb-0025bfba50c

OK> @p1234

set password to the string "1234"

 

OK> w25 31 32 33 34

 

… char=ffff hnd=25 attr=wp
OK>

 

when connected write “1234” in hex to the characteristic after that you are authorized and stay connected.

List Of Services

These are the services provided by the SmartBeacon. Deending on the hardware some services may not be implemented.

srv start=0x1 end=0x3 uuid=1800
srv start=0x4 end=0x4 uuid=1801
srv start=0x5 end=0xffff uuid=1815

Generic Access
Generic Attribute
Automation IO

Characteristics

Depending on the hardware, not all characteristics may be present.

char=2a04 hnd=3 attr=r
char=fee1 hnd=7 attr=rp
char=fee2 hnd=9 attr=rp
char=2a56 hnd=b attr=rwpn
char=2a58 hnd=e attr=r
char=2a5e hnd=10 attr=wpn
char=2a5f hnd=13 attr=wp
char=2a60 hnd=15 attr=pn
char=ffff hnd=18 attr=wp
preferred connection parameters
iBeacon UUID
iBeacon MaMi
Digital IO
ANALOG IO
UART IO
Baudrate config
Datalogger
Password

 

In order to be able to write to any of those characteristics, you must provide the password first. A password is setup using the serial command line interface through a physical connection. See #password

Char: 

 

0x2A56, Digital IO

read: status of digital sensor input (PIO11)

writing: 2 outputs, PIO9 (LSB) and PIO6 (LED), each described with 2 bits:
00: set HIGH
01: set LOW
10: set INPUT
11: set OUTPUT

0x2A58read: analog input level in mV (16 bits)
0x2A5Eread and write to serial port, UART
0x2A5FUART baud rate config: 0 is unused, 1 is 2400 baud, 2 is 4800 baud, 3 is 9600 baud, 4 is 19200 baud,

// 5 is 38400 baud, 8 is 115200, and 12 is 1382400 baud. Set to 0xFF when using remote command line

0xFEE1set the device UUID, 16 bytes
0xFEE2set the iBeacon Major and Minor number, 4 bytes
0x2A60dump the data logger memory, when notified, it will send out 1400 bytes

 

 

SPP over GATT

The SmartBeacon implements a serial port profile over GATT characteristics. We created a characteristic you can write to and the data arrives on the physical serial port of the product, e.g. the USB serial port or the DB9 connection on the SmartMini. When enabling notifications on the same characteristics, data that comes from the physical serial port will be sent to the connected Central device. The connection is transparent and synchronized with the negotiated connection parameter, meaning at every radio interval you can receive up to 20 bytes at a time.

configure baudrate

Use Characteristic 0x2A5F, handle 0x20. Write following numbers to change the baud rate. The hardware is set to 8 bit, 1 stop bit, no parity.
1: 2K4, 3: 9K6, 4: 19K2;  5: 38K4; 6: 57K6; 8:115K2; 9: 230K4; 10: 460K8; 11: 921K6; 12: 1382K4; 

 
write to serial portuse Characteristic 0x2A5E to write to
receive from serialset Characteristic 0x2A5E to notify
Configure radioSend a "L2CAP Connection Parameter Update Request" from the Central and change the conneciton interval. Minimum timing accepted are 6 timing slots, or 7.5ms. See 'h' command in the Central code.

Remote Command Line

When a connection exists, the command line interface on the Peripheral is switched off. Even with a serial connection to a PC it is not longer accepting commands via serial line when connected to. It is possible to start the command line interpreter on the wireless side. This is like a SPP over GATT connection, only that the data is not coming from the physical serial port, but from the command line interpreter on the other end. To do that simply change the baud rate to 0xFF.

There are a few restrictions, such as initiating connections remotely. A SmartBeacon running as Peripheral will not be able to become a Central as well. But you can certainly scan for other devices remotely or even issue and receive CSRmesh commands.

configure baud rate

use Characteristic 0x2A5F, handle 0x13, set to 0xFF

receive datause Characteristic 0x2A5E, handle 0x10, set to notify

Using the command line to scan remotely and send CSRmesh commands

Transparent data with SPP over GATT



Keep Informed

About This Community

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/29/15, 11:40 PM
Seen: 4398 times
Last updated: 12/30/15, 12:04 AM