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.
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
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:
send a connect package once per second
check broadcast configuration:
It is possible to add the CSRmesh interval to the broadcast interval by specifying the CSRmesh timing too.
add 80ms CSRmesh scanning to the broadcast interval
check broadcast configuration:
Change the name of the SmartBeacon
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
configure for a moderate high output power, index 5
|OK> @X5||configure for a moderate high output power, and reboot the device|
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”.
set password to the string "1234"
OK> w25 31 32 33 34
|… char=ffff hnd=25 attr=wp|
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
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|
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.
0x2A56, Digital IO
read: status of digital sensor input (PIO11)
writing: 2 outputs, PIO9 (LSB) and PIO6 (LED), each described with 2 bits:
|0x2A58||read: analog input level in mV (16 bits)|
|0x2A5E||read and write to serial port, UART|
|0x2A5F||UART 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
|0xFEE1||set the device UUID, 16 bytes|
|0xFEE2||set the iBeacon Major and Minor number, 4 bytes|
|0x2A60||dump 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.
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.
|write to serial port||use Characteristic 0x2A5E to write to|
|receive from serial||set Characteristic 0x2A5E to notify|
|Configure radio||Send 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 data||use Characteristic 0x2A5E, handle 0x10, set to notify|
Using the command line to scan remotely and send CSRmesh commands
Transparent data with SPP over GATT
About This Community
|Asked: 12/29/15, 11:40 PM|
|Seen: 1519 times|
|Last updated: 12/30/15, 12:04 AM|