Bluetooth Smart Ready Api Reference
Bluetooth Smart Ready Api Reference
This document contains the Silicon Labs Bluetooth Smart Ready Stack version unspecified API ref-
erence for the BGAPI serial protocol, BGLIB C API, and BGScript scripting language.
A short overview of the Silicon Labs Bluetooth Smart Ready Stack and SDK, and included tools, is
also presented here.
2. Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3. API Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1 Connection management for Bluetooth Classic (bt_connection) . . . . . . . . . . . . .13
3.1.1 bt_connection commands . . . . . . . . . . . . . . . . . . . . . . . . .13
3.1.1.1 cmd_bt_connection_get_rssi . . . . . . . . . . . . . . . . . . . . . . .14
3.1.1.2 cmd_bt_connection_list . . . . . . . . . . . . . . . . . . . . . . . . .15
3.1.1.3 cmd_bt_connection_read_clock . . . . . . . . . . . . . . . . . . . . . .16
3.1.1.4 cmd_bt_connection_set_active . . . . . . . . . . . . . . . . . . . . . . .17
3.1.1.5 cmd_bt_connection_set_role . . . . . . . . . . . . . . . . . . . . . . .18
3.1.1.6 cmd_bt_connection_set_sniff . . . . . . . . . . . . . . . . . . . . . . .19
3.1.1.7 cmd_bt_connection_set_supervision_timeout . . . . . . . . . . . . . . . . . .21
3.1.2 bt_connection events . . . . . . . . . . . . . . . . . . . . . . . . . . .21
3.1.2.1 evt_bt_connection_clock_value. . . . . . . . . . . . . . . . . . . . . . .22
3.1.2.2 evt_bt_connection_closed . . . . . . . . . . . . . . . . . . . . . . . .23
3.1.2.3 evt_bt_connection_list_complete . . . . . . . . . . . . . . . . . . . . . .24
3.1.2.4 evt_bt_connection_opened . . . . . . . . . . . . . . . . . . . . . . . .25
3.1.2.5 evt_bt_connection_parameters . . . . . . . . . . . . . . . . . . . . . . .26
3.1.2.6 evt_bt_connection_rssi_value . . . . . . . . . . . . . . . . . . . . . . .27
3.1.3 bt_connection enumerations . . . . . . . . . . . . . . . . . . . . . . . .27
3.1.3.1 enum_bt_connection_direction . . . . . . . . . . . . . . . . . . . . . . .27
3.1.3.2 enum_bt_connection_encryption . . . . . . . . . . . . . . . . . . . . . .28
3.1.3.3 enum_bt_connection_powermode . . . . . . . . . . . . . . . . . . . . . .28
3.1.3.4 enum_bt_connection_role . . . . . . . . . . . . . . . . . . . . . . . .28
3.2 Generic Access Profile, Bluetooth Classic (bt_gap) . . . . . . . . . . . . . . . . .29
3.2.1 bt_gap commands. . . . . . . . . . . . . . . . . . . . . . . . . . . .29
3.2.1.1 cmd_bt_gap_cancel_discovery . . . . . . . . . . . . . . . . . . . . . . .30
3.2.1.2 cmd_bt_gap_discover . . . . . . . . . . . . . . . . . . . . . . . . . .31
3.2.1.3 cmd_bt_gap_get_mode . . . . . . . . . . . . . . . . . . . . . . . . .33
3.2.1.4 cmd_bt_gap_get_remote_name . . . . . . . . . . . . . . . . . . . . . .34
3.2.1.5 cmd_bt_gap_open . . . . . . . . . . . . . . . . . . . . . . . . . . .35
3.2.1.6 cmd_bt_gap_set_auto_sniff . . . . . . . . . . . . . . . . . . . . . . . .36
3.2.1.7 cmd_bt_gap_set_discovery_mode . . . . . . . . . . . . . . . . . . . . .38
3.2.1.8 cmd_bt_gap_set_host_channel_classification . . . . . . . . . . . . . . . . . .39
This section contains a short description of the Silicon Labs Bluetooth Smart Ready software, the components, APIs, and tools it in-
cludes.
The main components of the Silicon Labs Bluetooth Smart Ready and stack are shown in the figure below. The figure shows the layers
the Bluetooth Smart Ready stack as well also shows the APIs that can be used to interface to the Silicon Labs Bluetooth Smart Ready
Stack.
Key features of the Silicon Labs Bluetooth Smart Ready stack include:
• Bluetooth 4.2 Smart Ready compatible
• Bluetooth GAP and Security Manager
• Bluetooth SPP and Apple iAP profiles
• GATT over BR profile
• Any GATT based Bluetooth Smart profile
• High performance features
• 6 simultaneous BR/EDR connections
• 7 simultaneous LE connections
• 1 x BR/EDR and 7x LE connections simultaneously
• Up to 1 Mbps throughput over SPP
• Up to 200 kbps throughput over iAP2
The Silicon Labs Bluetooth Smart Ready SDK is a software development kit, which enables the device and software vendors to develop
applications on top of the Silicon Labs's Bluetooth Smart Ready hardware and stack software.
The Bluetooth Smart Ready SDK supports multiple development models and the application developers can decide whether the appli-
cation software runs on a separate host (a low power MCU) or whether they want to make fully standalone devices and execute their
code on the MCU embedded in the Silicon Labs Bluetooth Smart Ready modules.
The SDK also contains documentation, tools for compiling the firmware, installing it into the hardware and lot of example applications
speeding up the development process.
The Silicon Labs Bluetooth Smart Ready SDK includes the following APIs, components and tools:
• The Bluetooth Smart Ready stack as described in the previous chapter.
• BGAPI™ is a binary serial protocol API to the Silicon Labs Bluetooth Smart Ready stack over UART or SPI interfaces. BGAPI is
target for users, who want to use both Bluetooth BR/EDR and LE functionality and use all the features in the Bluetooth Smart Ready
stack form an external host such as a low power MCU.
• BGLIB™ is a host library for external MCUs and implements a reference parser for the BGAPI serial protocol. BGLIB is delivered in
C source code as part of the Bluetooth Smart Ready SDK and it can be easily ported to various processor architectures.
• BGScript™ interpreter and scripting language allow applications to be developed into the Bluetooth Smart Ready modules built-in
MCU. It allows simple end user applications or enhanced functionality to be developed directly into the Bluetooth Smart Ready mod-
ule which means no external host MCU is necessarily needed. BGScript applications can be executed at the same time as the BGA-
PI is used, allowing the possibility to implement some functionality on the Bluetooth module and some on the host.
• Profile Toolkit™ is a simple XML based description language which can be used to easily and quickly develop GATT based service
and characteristic databases for the Bluetooth Smart module.
• BGBuild compiler is a free-of-charge compiler that compiles the Bluetooth Smart Ready Stack, the BGScript application and the
Bluetooth GATT services into the firmware binary that can be installed to the Bluetooth Smart Ready modules.
• BGTool is a graphical user interface application and a developer tool, which allows the Bluetooth smart module to be controller over
the host interface using the BGAPI serial protocol. BGTool is a useful tool for testing the Bluetooth Smart module and evaluating it's
functionality and APIs.
• DFU Tools are also included as part of the SDK allowing the firmware to be updated over the UART and SPI interfaces.
The BGAPI serial protocol allows external hosts to interface to the Bluetooth Smart Ready modules over UART or SPI interfaces. The
BGAPI serial protocol is a lightweight and well defined binary protocol which allows command and data to be sent to the Bluetooth
Smart Ready module and it also provides a way to receive responses and events and data from the module.
The BGAPI provides access to the following layers in the Bluetooth Smart Stack:
• BT GAP - BT GAP provides access to basic Bluetooth BR/EDR features, like device discovery and connection establishment.
• LE GAP - LE GAP provides access to basic Bluetooth LE features, like device advertisement, discovery and connection establish-
ment.
• Security manager - Security manager is used to configure the local devices security features and establish secure connections
• RFCOMM - RFCOMM provides basic serial data transmission over Bluetooth RD/EDR.
• iAP - iAP provides basic serial data transmission to Apple iOS devices using Bluetooth BR/EDR. iAP is only available to Apple MFI
licenses and not included in the standard SDK.
• Hardware - Access to local hardware features and interfaces like SPI, I2C, GPIO and ADC
• Persistent Store - A data storage that allows data to be stored to and read from the internal flash
• System - Local device's status and management functions
The BGLIB host library is a reference implementation of the BGAPI serial protocol parser and it's provided in an ANSI C source code in
the Bluetooth Smart Ready SDK. It abstracts the complexity of the BGAPI serial protocol and instead provides high level C functions
and call-back handlers to the application developer, which makes the application development easier and faster.
The BGLIB library can be ported to various host systems ranging from low cost MCUs to devices running Linux, Windows or OSX.
BGScript is a simple BASIC-style programming language that allows end-user applications to be embedded to the Silicon Labs Blue-
tooth Smart Ready modules. Although being a simple and easy-to-learn programming language BGScript does provide features and
functions to create fairly complex and powerful applications and it provides access to all the same APIs as the BGAPI serial protocol.
BGScript is fully event based programming language and code execution is started when events such as system start-up, Bluetooth
connection, I/O interrupt etc. occur.
BGScript applications are developed with Silicon Labs's free-of-charge Bluetooth Smart Ready SDK and the BGScript applications are
executed in the BGScript Virtual Machine (VM) that is part of the Silicon Labs Bluetooth Smart Ready software. The Bluetooth Smart
Ready SDK comes with all the necessary tools for code editing and compilation and also the needed tools for installing the complied
firmware binary to the Silicon Labs Bluetooth Smart Ready modules.
BGScript applications can also be used at the same time as BGAPI and they can be for example used to automate some simple ac-
tions.
This section describes the differences between using BGAPI and BGScript. In brief the difference is:
• BGScript is our custom scripting language used for on-module applications. BGScript applications only run on Silicon Labs modules
and dongles.
• BGAPI is a custom serial protocol used to externally control the modules over the host interface and BGLIB is an ANSI C reference
implementation of the BGAPI serial protocol and only runs outside of our modules and dongles.
So the main difference between BGScript and BGLIB is that BGScript allows you to run an application right on the Bluetooth module,
whereas BGLIB uses the BGAPI serial protocol API to send commands and receive events from an external device - typically a micro-
controller. Note however that BGScript and BGLIB implement the exact same functionality. Every BGScript command, response, and
event has a counterpart in the BGAPI serial protocol and BGLIB host library.
One other thing to keep in mind is that BGScript has some performance penalties compared to external API control due to the fact that
BGScript is an interpreted scripting language and requires extra overhead in order to use. It makes the Bluetooth module do the work
that could otherwise be done elsewhere. If you are trying to achieve maximum performance or you have an application which is fairly
complex (lots of fast timers, interrupts, or communicating with many external sensors over I2C or SPI for example), it is often a good
idea to use a small external microcontroller and BGLIB/BGAPI instead.
Peripheral interface APIs and support Host dependent (* APIs for UART, SPI, I2C, GPIO, ADC and PS store
Custom peripheral interface drivers Can be developed to the host Peripheral drivers are part of the Silicon Labs Blue-
tooth Smart Ready stack
Application development SDK Host dependent + BGAPI and BGLIB Silicon Labs Bluetooth Smart Ready SDK
Bluetooth firmware / application updates DFU over UART or SPI** DFU over UART or SPI**
*) The Bluetooth Smart modules peripheral interfaces are still available via BGAPI commands and can be used to extend the host
MCUs I/Os.
The Bluetooth Smart profile toolkit is a simple set of tools, which can used to describe GATT based service and characteristic databa-
ses used with Bluetooth Smart and GATT over BR profiles. The profile toolkit consists of a simple XML based description language and
templates, which can be used to describe the services and characteristics and their properties in a devices GATT database.
The GATT database developed with the Profile Toolkit is included as part of the device's firmware when the firmware is compiled.
The BGBuild compiler is a simple compiler that is used to build firmware images for the Bluetooth Smart Ready modules. The BGBuild
compiler compiles the Bluetooth Smart Ready stack, the GATT database and optionally also a BGScript application into a single firm-
ware binary image that can be installed into a Bluetooth Smart module.
The Device Firmware Update (DFU) protocol is an open serial protocol that can be used to perform field updates to the Bluetooth Smart
Ready modules. DFU protocol allows any firmware image generated with the BGBuild compiler to be installed into a Bluetooth Smart
Module.
The Bluetooth Smart Ready SDK contains command line binaries versions and source code for the DFU protocol and tools.
DFU protocol and available commands are described in the API reference document.
1.10 BGTool
The BGTool application can be used to test and evaluate the Bluetooth Smart Ready module and issue BGAPI commands to it over the
UART host interface.
2. Data types
Data types used in the documentation are shown in the table below. Unless otherwise noted, all multi-byte fields are in little endian
format.
uint8array 1 - 256 bytes Array Variable length byte array. First byte is the length of the array.
service 1 byte Number GATT service handle. This value is normally received from the gatt_service
event.
characteristic 1 byte Number GATT characteristic handle. This value is normally received from the
gatt_characteristic event
uuid 1 byte Number Characteristic UUID, first byte is the length of UUID and rest is UUID in lit-
tle-endian format
att_opcode 1 byte Number Attribute opcode which informs the procedure from which attribute the value
was received
(*) The script's internal number type is a signed 32-bit integer. This means large unsigned 32-bit integers in the BGAPI will be represen-
ted with negative numbers in the script. This is a known limitation.
3. API Reference
These commands and events are related to Bluetooth Classic connection management and provide the means to open, close and mon-
itor Bluetooth Classic connections.
3.1.1.1 cmd_bt_connection_get_rssi
BGScript command
call bt_connection_get_rssi(connection)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_connection_get_rssi(uint8 connection);
/* Response id */
dumo_rsp_bt_connection_get_rssi_id
/* Response structure */
struct dumo_msg_bt_connection_get_rssi_rsp_t
{
uint16 result
}
Event Description
3.1.1.2 cmd_bt_connection_list
This command can be used to list all RFCOMM connections and check their parameters.
BGScript command
call bt_connection_list()(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_connection_list();
/* Response id */
dumo_rsp_bt_connection_list_id
/* Response structure */
struct dumo_msg_bt_connection_list_rsp_t
{
uint16 result
}
Event Description
bt_connection_parameters This event indicates the details of a single RFCOMM connection. This event can be trig-
gered when needed with bt_connection_list.
bt_connection_list_complete This event indicates that all connections have been listed.
3.1.1.3 cmd_bt_connection_read_clock
Read Bluetooth Clock of a connection/piconet. For detailed information, see Bluetooth Specification 4.1, vol. 2, part E, section 7.5.6
(Read Clock Command).
4 uint8 connection Connection endpoint handle or rfcomm handle. Zero to read local
Bluetooth Clock.
BGScript command
call bt_connection_read_clock(connection)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_connection_read_clock(uint8 connection);
/* Response id */
dumo_rsp_bt_connection_read_clock_id
/* Response structure */
struct dumo_msg_bt_connection_read_clock_rsp_t
{
uint16 result
}
Event Description
3.1.1.4 cmd_bt_connection_set_active
BGScript command
call bt_connection_set_active(endpoint)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_connection_set_active(uint8 endpoint);
/* Response id */
dumo_rsp_bt_connection_set_active_id
/* Response structure */
struct dumo_msg_bt_connection_set_active_rsp_t
{
uint16 result
}
Event Description
bt_connection_parameters This event indicates the details of a single RFCOMM connection. This event can be trig-
gered when needed with bt_connection_list.
3.1.1.5 cmd_bt_connection_set_role
This command can be used to set the Bluetooth connection local role. Note that this may not be possible if the remote device is the
master and does not allow role changes.
BGScript command
call bt_connection_set_role(endpoint,role)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_connection_set_role(uint8 endpoint, uint8 role);
/* Response id */
dumo_rsp_bt_connection_set_role_id
/* Response structure */
struct dumo_msg_bt_connection_set_role_rsp_t
{
uint16 result
}
Event Description
bt_connection_parameters This event indicates the details of a single RFCOMM connection. This event can be trig-
gered when needed with bt_connection_list.
3.1.1.6 cmd_bt_connection_set_sniff
This command can be used to set the sniff parameters for a connection. Please see BLUETOOTH SPECIFICATION Version 4.1 [Vol 2]
Part E chapter 7.2.2 for more information regarding the use of the related parameters.
9-10 uint16 attempt Number of baseband receive slots for sniff attempt.
• Range: 0x0001 to 0x7fff
• Time range 0.625 ms to 40959 ms
11-12 uint16 timeout Number of baseband receive slots for sniff timeout.
• Range: 0x0000 to 0x7fff
• Time range 0.0 ms to 40959 ms
BGScript command
call bt_connection_set_sniff(endpoint,max,min,attempt,timeout)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_connection_set_sniff(uint8 endpoint, uint16 max, uint16 min, uint16 attempt, uint16 timeout);
/* Response id */
dumo_rsp_bt_connection_set_sniff_id
/* Response structure */
struct dumo_msg_bt_connection_set_sniff_rsp_t
{
uint16 result
}
Event Description
bt_connection_parameters This event indicates the details of a single RFCOMM connection. This event can be trig-
gered when needed with bt_connection_list.
3.1.1.7 cmd_bt_connection_set_supervision_timeout
5-6 uint16 supervisiontimeout Supervision timeout defines how long, in multiples of 0.625 ms,
the connection can be without any activity before being discon-
nected. Note that this command has no effect if the local device is
not the Master of the connection. Range: 0x0001 - 0xffff. Default
value: 0x7D00 (20 seconds)
BGScript command
call bt_connection_set_supervision_timeout(endpoint,supervisiontimeout)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_connection_set_supervision_timeout(uint8 endpoint, uint16 supervisiontimeout);
/* Response id */
dumo_rsp_bt_connection_set_supervision_timeout_id
/* Response structure */
struct dumo_msg_bt_connection_set_supervision_timeout_rsp_t
{
uint16 result
}
3.1.2.1 evt_bt_connection_clock_value
4 uint8 connection Connection endpoint handle or zero when reading local clock.
NOTE: this is always a connection handle regardless whether
clock was requested by RFCOMM or connection handle.
9-10 uint16 accuracy Maximum Bluetooth Clock error in +- 0.3125 ms units. 0xFFFF
means unknown.
BGScript event
event bt_connection_clock_value(connection,clock,accuracy)
C Functions
/* Event id */
dumo_evt_bt_connection_clock_value_id
/* Event structure */
struct dumo_msg_bt_connection_clock_value_evt_t
{
uint8 connection,
uint32 clock,
uint16 accuracy
}
3.1.2.2 evt_bt_connection_closed
Note: This event corresponds to the Bluetooth connection (not the endpoint) between two devices closing. Once all open endpoints
have closed, either side may close the connection. Thus the reason parameter may be either remote_user_terminated or connec-
tion_terminated_by_local_host independent of which side closed the last endpoint.
BGScript event
event bt_connection_closed(reason,connection)
C Functions
/* Event id */
dumo_evt_bt_connection_closed_id
/* Event structure */
struct dumo_msg_bt_connection_closed_evt_t
{
uint16 reason,
uint8 connection
}
3.1.2.3 evt_bt_connection_list_complete
BGScript event
event bt_connection_list_complete()
C Functions
/* Event id */
dumo_evt_bt_connection_list_complete_id
/* Event structure */
struct dumo_msg_bt_connection_list_complete_evt_t
{
}
3.1.2.4 evt_bt_connection_opened
4-9 bd_addr address Bluetooth address of the remote device in little endian formats
BGScript event
event bt_connection_opened(address,master,connection,bonding)
C Functions
/* Event id */
dumo_evt_bt_connection_opened_id
/* Event structure */
struct dumo_msg_bt_connection_opened_evt_t
{
bd_addr *address,
uint8 master,
uint8 connection,
uint8 bonding
}
3.1.2.5 evt_bt_connection_parameters
This event indicates the details of a single RFCOMM connection. This event can be triggered when needed with bt_connection_list.
10-15 bd_addr address Bluetooth address of the remote device in little endian format
19 uint8 encryption
BGScript event
event bt_connection_parameters(endpoint,block_size,msc,address,direction,powermode,role,encryption,input_buffer
,port)
C Functions
/* Event id */
dumo_evt_bt_connection_parameters_id
/* Event structure */
struct dumo_msg_bt_connection_parameters_evt_t
{
uint8 endpoint,
uint32 block_size,
uint8 msc,
bd_addr *address,
uint8 direction,
uint8 powermode,
uint8 role,
uint8 encryption,
uint32 input_buffer,
uint8 port
}
3.1.2.6 evt_bt_connection_rssi_value
4 uint8 connection Connection handle. NOTE: this is allways connetion handle re-
gardless whether RSSI was requested by RFCOMM or connec-
tion handle
BGScript event
event bt_connection_rssi_value(connection,rssi)
C Functions
/* Event id */
dumo_evt_bt_connection_rssi_value_id
/* Event structure */
struct dumo_msg_bt_connection_rssi_value_evt_t
{
uint8 connection,
int8 rssi
}
3.1.3.1 enum_bt_connection_direction
0 bt_connection_outgoing Outgoing
1 bt_connection_incoming Incoming
3.1.3.2 enum_bt_connection_encryption
0 bt_connection_plain Unencrypted
1 bt_connection_encrypted Encrypted
3.1.3.3 enum_bt_connection_powermode
0 bt_connection_active Active
1 bt_connection_hold Reserved
2 bt_connection_sniff Sniff
3 bt_connection_park Reserved
3.1.3.4 enum_bt_connection_role
0 bt_connection_master Master
1 bt_connection_slave Slave
These commands and events are related to Generic Access Profile, Bluetooth Classic.
3.2.1.1 cmd_bt_gap_cancel_discovery
This command can be used to cancel the ongoing Bluetooth Classic device discovery (inquiry) procedure.
BGScript command
call bt_gap_cancel_discovery()(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_cancel_discovery();
/* Response id */
dumo_rsp_bt_gap_cancel_discovery_id
/* Response structure */
struct dumo_msg_bt_gap_cancel_discovery_rsp_t
{
uint16 result
}
Event Description
3.2.1.2 cmd_bt_gap_discover
This command can be used to discover other Bluetooth Classic devices with Bluetooth Classic inquiry. Command set_discovery_mode
can be used to select how much information is delivered in discovery results
4 uint8 timeout The maximum amount of time (in units of 1.28 seconds) before
the inquiry process is halted. Range: 1 to 48.
• Example: Value 5 corresponds to 5 x 1.28 seconds = 6.4 sec-
onds.
5-8 int32 lap Flag which selects whether to seek only devices that are in gener-
al discovery mode or in limited discovery mode.
BGScript command
call bt_gap_discover(timeout,lap)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_discover(uint8 timeout, int32 lap);
/* Response id */
dumo_rsp_bt_gap_discover_id
/* Response structure */
struct dumo_msg_bt_gap_discover_rsp_t
{
uint16 result
}
Event Description
bt_gap_discovery_result This event returns the discovery result for a single remote device. The name parameter
is present only when using extended discovery mode. The RSSI value is valid only when
using RSSI or extended discovery (inquiry) mode. The discovery mode is set by set_dis-
covery_mode command.
3.2.1.3 cmd_bt_gap_get_mode
This command can be used to read the device's Bluetooth Classic visibility and connectability settings.
6 uint8 connectable Informs whether the device accepts incoming connections or not.
Values:
• 0: Not connectable
• 1: Connectable
7 uint8 discoverable Informs whether the device is visible for inquiry. Values:
• 0: Not discoverable
• 1: Discoverable
8 uint8 limited Informs whether the device is visible only in limited mode inquiry
or in general mode inquiry
BGScript command
call bt_gap_get_mode()(result,connectable,discoverable,limited)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_get_mode();
/* Response id */
dumo_rsp_bt_gap_get_mode_id
/* Response structure */
struct dumo_msg_bt_gap_get_mode_rsp_t
{
uint16 result,
uint8 connectable,
uint8 discoverable,
uint8 limited
}
3.2.1.4 cmd_bt_gap_get_remote_name
This command can be used to read the name of the remote Bluetooth Classic device.
4-9 bd_addr address Bluetooth address of the remote Bluetooth Classic device in little
endian format
BGScript command
call bt_gap_get_remote_name(address)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_get_remote_name(bd_addr *address);
/* Response id */
dumo_rsp_bt_gap_get_remote_name_id
/* Response structure */
struct dumo_msg_bt_gap_get_remote_name_rsp_t
{
uint16 result
}
Event Description
3.2.1.5 cmd_bt_gap_open
This command can be used to open a Bluetooth Classic connection to a remote device. The connection can be closed with the end-
point_close command. Command can be used for example when there is an need to bond the devices without opening a RFCOMM
connection. After connection has been opened bonding can be done with the sm_increase_security command.
BGScript command
call bt_gap_open(address)(result,connection)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_open(bd_addr *address);
/* Response id */
dumo_rsp_bt_gap_open_id
/* Response structure */
struct dumo_msg_bt_gap_open_rsp_t
{
uint16 result,
uint8 connection
}
Event Description
bt_connection_opened
3.2.1.6 cmd_bt_gap_set_auto_sniff
Set automatic sniff parameters for all connections. Please see the BLUETOOTH SPECIFICATION Version 4.1 [Vol 2] Part E chapter
7.2.2 for more information regarding the use of the related parameters.
5-6 uint16 idle The time (in seconds) a link has to be idle before it will be set to
sniff mode. Range: 1 - 250
11-12 uint16 attempt Number of baseband receive slots for sniff attempt.
• Range: 0x0001-0x7fff
• Time range 0.625 ms to 40959 ms
Recommended default: 1
13-14 uint16 timeout Number of baseband receive slots for sniff timeout.
• Range: 0x0000-0x7fff
• Time range 0.0 ms to 40959 ms
Recommended default: 8
BGScript command
call bt_gap_set_auto_sniff(mode,idle,max,min,attempt,timeout)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_set_auto_sniff(uint8 mode, uint16 idle, uint16 max, uint16 min, uint16 attempt, uint16 tim
eout);
/* Response id */
dumo_rsp_bt_gap_set_auto_sniff_id
/* Response structure */
struct dumo_msg_bt_gap_set_auto_sniff_rsp_t
{
uint16 result
}
3.2.1.7 cmd_bt_gap_set_discovery_mode
This command can be used to set the discovery mode. This determines the information given in discovery_result events.
BGScript command
call bt_gap_set_discovery_mode(mode)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_set_discovery_mode(uint8 mode);
/* Response id */
dumo_rsp_bt_gap_set_discovery_mode_id
/* Response structure */
struct dumo_msg_bt_gap_set_discovery_mode_rsp_t
{
uint16 result
}
3.2.1.8 cmd_bt_gap_set_host_channel_classification
4 uint8array channel_map Channel bitmap for 79 channels. Mark known bad channels with a
zero bit, other channels with a one bit. The parameter must be
given as exactly 10 bytes; the highest bit is ignored.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_set_host_channel_classification(uint8array channel_map);
/* Response id */
dumo_rsp_bt_gap_set_host_channel_classification_id
/* Response structure */
struct dumo_msg_bt_gap_set_host_channel_classification_rsp_t
{
uint16 result
}
3.2.1.9 cmd_bt_gap_set_max_power
This command can be used to set the maximum TX power for Bluetooth Classic.
BGScript command
call bt_gap_set_max_power(max_power)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_set_max_power(int8 max_power);
/* Response id */
dumo_rsp_bt_gap_set_max_power_id
/* Response structure */
struct dumo_msg_bt_gap_set_max_power_rsp_t
{
uint16 result
}
3.2.1.10 cmd_bt_gap_set_mode
This command can be used to set Bluetooth Classic visibility and connectability.
5 uint8 discoverable Determines whether the device is visible in Bluetooth Classic in-
quiry. Values:
• 0: Not discoverable
• 1: Discoverable
Default value: 0
6 uint8 limited Determines whether the device is visible in limited mode inquiry or
in general mode inquiry. Default value: general mode
BGScript command
call bt_gap_set_mode(connectable,discoverable,limited)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_set_mode(uint8 connectable, uint8 discoverable, uint8 limited);
/* Response id */
dumo_rsp_bt_gap_set_mode_id
/* Response structure */
struct dumo_msg_bt_gap_set_mode_rsp_t
{
uint16 result
}
3.2.1.11 cmd_bt_gap_set_parameters
This command can be used to set the default page timeout and scan mode.
4-5 uint16 pagetimeout Page timeout defines how long the connection establishment can
take before an error occurs, in multiples of 0.625 milliseconds.
Range: 0x0001 - 0xffff. Default value: 0x2000 (5.12 seconds)
6-7 uint16 scan_interval Page scan interval in multiples of 0.625ms, values from 0x12 to
0x1000, only even numbers are allowed, see BT Core spec Vol. 2
part D chapter 7.3. Default value: 0x800
8-9 uint16 scan_window Page scan window in multiples of 0.625ms, values from 0x11 to
0x1000, must be less than or equal to page scan interval. See BT
Core spec Vol. 2 part D chapter 7.3. Default value: 0x12
BGScript command
call bt_gap_set_parameters(pagetimeout,scan_interval,scan_window)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_set_parameters(uint16 pagetimeout, uint16 scan_interval, uint16 scan_window);
/* Response id */
dumo_rsp_bt_gap_set_parameters_id
/* Response structure */
struct dumo_msg_bt_gap_set_parameters_rsp_t
{
uint16 result
}
3.2.1.12 cmd_bt_gap_set_policy
This command can be used to set default policies for connections. For more information on the use of policies please see BLUETOOTH
SPECIFICATION Version 4.1 [Vol 2] Part E chapter 7.2.10.
4 uint8 allow_role_change Defines if the the local device accepts role change requests or
not. Values:
• 0: Do not allow role change
• 1: Allow role change
Default value: 0
5 uint8 allow_sniff This flag defines whether sniff mode is allowed or not. Values:
• 0: Do not allow sniff mode
• 1: Allow sniff mode
Default value: 0
BGScript command
call bt_gap_set_policy(allow_role_change,allow_sniff)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_gap_set_policy(uint8 allow_role_change, uint8 allow_sniff);
/* Response id */
dumo_rsp_bt_gap_set_policy_id
/* Response structure */
struct dumo_msg_bt_gap_set_policy_rsp_t
{
uint16 result
}
3.2.2.1 evt_bt_gap_discovery_complete
BGScript event
event bt_gap_discovery_complete(status)
C Functions
/* Event id */
dumo_evt_bt_gap_discovery_complete_id
/* Event structure */
struct dumo_msg_bt_gap_discovery_complete_evt_t
{
uint16 status
}
3.2.2.2 evt_bt_gap_discovery_result
This event returns the discovery result for a single remote device. The name parameter is present only when using extended discovery
mode. The RSSI value is valid only when using RSSI or extended discovery (inquiry) mode. The discovery mode is set by set_discov-
ery_mode command.
4-9 bd_addr bd_addr Bluetooth address of the discovered Bluetooth Classic device in
little endian format
17 uint8array name Remote device's Bluetooth Classic friendly name parsed from the
Extended Inquiry Response (EIR) data
BGScript event
C Functions
/* Event id */
dumo_evt_bt_gap_discovery_result_id
/* Event structure */
struct dumo_msg_bt_gap_discovery_result_evt_t
{
bd_addr *bd_addr,
uint8 page_scan_repetition_mode,
uint32 class_of_device,
int8 rssi,
uint8 bonding,
uint8array name
}
3.2.2.3 evt_bt_gap_host_channel_classification_complete
BGScript event
event bt_gap_host_channel_classification_complete(status)
C Functions
/* Event id */
dumo_evt_bt_gap_host_channel_classification_complete_id
/* Event structure */
struct dumo_msg_bt_gap_host_channel_classification_complete_evt_t
{
uint16 status
}
3.2.2.4 evt_bt_gap_remote_name
6-11 bd_addr address Bluetooth address of the remote Bluetooth Classic device in little
endian format
BGScript event
C Functions
/* Event id */
dumo_evt_bt_gap_remote_name_id
/* Event structure */
struct dumo_msg_bt_gap_remote_name_evt_t
{
uint16 status,
bd_addr *address,
uint8array remote_name
}
3.2.3.1 enum_bt_gap_discover_mode
HID connections Please note that HID commands are available only in images compiled with HID sdk
3.3.1.1 cmd_bt_hid_get_report_response
This command is used to respond to evt_bt_hid_get_report requests. The parameters endpoint, parameters_used, report_type, and re-
port_id should match those received in the request. The report_data should contain the current instantaneous state of the fields speci-
fied in the request.
4 uint8 endpoint Endpoint handle of the HID Host that sent the request.
5 uint8 parameters_used
6 uint8 report_type
7 uint8 report_id ID of the report requested. Must match both report_type and ID,
as the same ID can be used for different report types.
8 uint8array report_data The payload of the Report requested. Note that if the Report is
larger than the max_bytes specified in the request, the report data
must be truncated to max_bytes, if no report ID was requested; or
max_bytes - 1 if an ID was requested.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_bt_hid_get_report_response(uint8 endpoint, uint8 parameters_used, uint8 report_type, uint8 report
_id, uint8array report_data);
/* Response id */
dumo_rsp_bt_hid_get_report_response_id
/* Response structure */
struct dumo_msg_bt_hid_get_report_response_rsp_t
{
uint16 result
}
3.3.1.2 cmd_bt_hid_get_set_report_reject
4 uint8 endpoint Endpoint handle of the HID Host that sent the request.
5 uint8 reason Reason for rejecting. 0 = invalid Report ID, 1 = invalid Report
Type or size mismatch.
BGScript command
call bt_hid_get_set_report_reject(endpoint,reason)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_hid_get_set_report_reject(uint8 endpoint, uint8 reason);
/* Response id */
dumo_rsp_bt_hid_get_set_report_reject_id
/* Response structure */
struct dumo_msg_bt_hid_get_set_report_reject_rsp_t
{
uint16 result
}
3.3.1.3 cmd_bt_hid_open
Open HID connection to remote HID Host. Note that the HID Host must have initiated a previous connection and stored our HID SDP
entry, and our SDP entry must indicate support for HID Device -initiated connections; otherwise the HID Host will reject our connection
attempt.
4-9 bd_addr address Bluetooth device address of the remote device in little endian for-
mat
BGScript command
call bt_hid_open(address,streaming_destination)(result,endpoint)
BGLIB C API
/* Function */
void dumo_cmd_bt_hid_open(bd_addr *address, uint8 streaming_destination);
/* Response id */
dumo_rsp_bt_hid_open_id
/* Response structure */
struct dumo_msg_bt_hid_open_rsp_t
{
uint16 result,
uint8 endpoint
}
Event Description
bt_hid_output_report This event indicates an HID Output Report was received from the HID Host.
3.3.1.4 cmd_bt_hid_send_input_report
This command can be used to send HID Input Reports to the HID Host.
6 uint8array report_data The data payload of the Input Report (prefixed with length byte)
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_bt_hid_send_input_report(uint8 endpoint, uint8 report_id, uint8array report_data);
/* Response id */
dumo_rsp_bt_hid_send_input_report_id
/* Response structure */
struct dumo_msg_bt_hid_send_input_report_rsp_t
{
uint16 result
}
3.3.1.5 cmd_bt_hid_set_report_response
This command is used to acknowledge an evt_bt_hid_set_report request. If the parameters are invalid, use cmd_bt_hid_get_set_re-
port_reject to reject it.
4 uint8 endpoint Endpoint handle of the HID Host that sent the request.
BGScript command
call bt_hid_set_report_response(endpoint)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_hid_set_report_response(uint8 endpoint);
/* Response id */
dumo_rsp_bt_hid_set_report_response_id
/* Response structure */
struct dumo_msg_bt_hid_set_report_response_rsp_t
{
uint16 result
}
3.3.1.6 cmd_bt_hid_start_server
BGScript command
call bt_hid_start_server(sdp_id,streaming_destination)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_hid_start_server(uint8 sdp_id, uint8 streaming_destination);
/* Response id */
dumo_rsp_bt_hid_start_server_id
/* Response structure */
struct dumo_msg_bt_hid_start_server_rsp_t
{
uint16 result
}
Event Description
Event Description
bt_hid_output_report This event indicates an HID Output Report was received from the HID Host.
3.3.1.7 cmd_bt_hid_stop_server
4 uint8 sdp_id ID of the SDP entry defined in the project configuration file.
BGScript command
call bt_hid_stop_server(sdp_id)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_hid_stop_server(uint8 sdp_id);
/* Response id */
dumo_rsp_bt_hid_stop_server_id
/* Response structure */
struct dumo_msg_bt_hid_stop_server_rsp_t
{
uint16 result
}
3.3.1.8 cmd_bt_hid_virtual_cable_unplug
This command can be used to disassociate the device from the HID Host. Bonding information will be deleted and the connection dis-
connected automatically.
BGScript command
call bt_hid_virtual_cable_unplug(endpoint)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_hid_virtual_cable_unplug(uint8 endpoint);
/* Response id */
dumo_rsp_bt_hid_virtual_cable_unplug_id
/* Response structure */
struct dumo_msg_bt_hid_virtual_cable_unplug_rsp_t
{
uint16 result
}
3.3.2.1 evt_bt_hid_failed
5-10 bd_addr address Bluetooth device address of the remote device in little endian for-
mat.
BGScript event
event bt_hid_failed(endpoint,address,reason)
C Functions
/* Event id */
dumo_evt_bt_hid_failed_id
/* Event structure */
struct dumo_msg_bt_hid_failed_evt_t
{
uint8 endpoint,
bd_addr *address,
uint16 reason
}
3.3.2.2 evt_bt_hid_get_report
This event indicates the HID Host has requested the current state of a report. This is usually done to determine the initial state of the
Device. A response must be sent with cmd_bt_hid_get_report_response. The parameter parameters_used defines which of the param-
eters were used by the Host to specify the report. The response should be sent with the same parameters_used value.
4 uint8 endpoint Endpoint handle of the HID Host that sent the notification.
5 uint8 parameters_used
6 uint8 report_type
7 uint8 report_id ID of the report requested. Must match both report_type and ID,
as the same ID can be used for different report types.
8-9 uint16 max_bytes Maximum number of bytes to send, if the report size exceeds the
current MTU; the remaining bytes are discarded and not sent in
another packet. If a Report ID is sent, it takes up one byte.
BGScript event
event bt_hid_get_report(endpoint,parameters_used,report_type,report_id,max_bytes)
C Functions
/* Event id */
dumo_evt_bt_hid_get_report_id
/* Event structure */
struct dumo_msg_bt_hid_get_report_evt_t
{
uint8 endpoint,
uint8 parameters_used,
uint8 report_type,
uint8 report_id,
uint16 max_bytes
}
3.3.2.3 evt_bt_hid_opened
5-10 bd_addr address Bluetooth device address of the remote device in little endian for-
mat.
BGScript event
event bt_hid_opened(endpoint,address)
C Functions
/* Event id */
dumo_evt_bt_hid_opened_id
/* Event structure */
struct dumo_msg_bt_hid_opened_evt_t
{
uint8 endpoint,
bd_addr *address
}
3.3.2.4 evt_bt_hid_output_report
This event indicates an HID Output Report was received from the HID Host.
4 uint8 endpoint Endpoint handle of the HID Host that sent the report.
6 uint8array report_data Payload of the HID Output Report (prefixed by length byte).
BGScript event
C Functions
/* Event id */
dumo_evt_bt_hid_output_report_id
/* Event structure */
struct dumo_msg_bt_hid_output_report_evt_t
{
uint8 endpoint,
uint8 report_id,
uint8array report_data
}
3.3.2.5 evt_bt_hid_set_report
This event indicates an HID report was received from the HID Host.
4 uint8 endpoint Endpoint handle of the HID Host that sent the report.
5 uint8 report_type
BGScript event
C Functions
/* Event id */
dumo_evt_bt_hid_set_report_id
/* Event structure */
struct dumo_msg_bt_hid_set_report_evt_t
{
uint8 endpoint,
uint8 report_type,
uint8 report_id,
uint8array report_data
}
3.3.2.6 evt_bt_hid_state_changed
This event indicates the HID Host has notified the Device about a state change. No response is required.
4 uint8 endpoint Endpoint handle of the HID Host that sent the notification.
5 uint8 state
BGScript event
event bt_hid_state_changed(endpoint,state)
C Functions
/* Event id */
dumo_evt_bt_hid_state_changed_id
/* Event structure */
struct dumo_msg_bt_hid_state_changed_evt_t
{
uint8 endpoint,
uint8 state
}
3.3.3.1 enum_bt_hid_get_report_params
These values indicate which parameters should be ignored in the bt_hid_get_report events. The response should be sent with the
same value.
0 bt_hid_params_no_id_no_max_size The Host has requested the current state for the report
unambiguously specified by Report Type, with no maxi-
mum data size constraints. Report ID and Max Bytes
should be ignored.
1 bt_hid_params_with_id_no_max_size The Host has requested the current state for the report
identified by Report Type and Report ID, with no maxi-
mum data size constraints. Max Bytes should be ignor-
ed.
2 bt_hid_params_no_id_with_max_size The Host has requested the current state for the report
unambiguously specified by Report Type. Report ID
should be ignored. Only the first N bytes of the report,
as specified by Max Bytes, shall be sent.
3 bt_hid_params_with_id_with_max_size The Host has requested the current state for the report
identified by Report Type and Report ID. Only the first
N-1 bytes of the report, as specified by Max Bytes, shall
be sent. (Report ID will take up 1 byte.)
3.3.3.2 enum_bt_hid_report_type
3.3.3.3 enum_bt_hid_state
0 bt_hid_state_boot_mode The Host has set the Device to use only Boot Reports.
The send_input_report command should not be used in
this state.
1 bt_hid_state_report_mode The Host has set the Device to use Report Mode. The
send_boot_report command should not be used in this
state. This is the default state a HID connection is in.
4 bt_hid_state_exit_suspend The Host has resumed normal operation and the Device
should exit any power saving mode it may have been in.
These commands and events are related to the establishment of Bluetooth Classic RFCOMM connections as specified in the Serial
Port Profile SPP).
3.4.1.1 cmd_bt_rfcomm_modem_status
This command sets modem control status bits for RFCOMM connection. This is a legacy support feature and SHOULD NOT BE USED
FOR FLOW CONTROL. For description and meaning of bits in this field see the ETSI TS 07.10 specification.
BGScript command
call bt_rfcomm_modem_status(endpoint,modem,mask)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_rfcomm_modem_status(uint8 endpoint, uint8 modem, uint8 mask);
/* Response id */
dumo_rsp_bt_rfcomm_modem_status_id
/* Response structure */
struct dumo_msg_bt_rfcomm_modem_status_rsp_t
{
uint16 result
}
3.4.1.2 cmd_bt_rfcomm_open
Open an RFCOMM channel to remote device. An existing connection, or a connection attempt before the page timeout expires, can be
closed with the endpoint_close command. NOTE: Controller does not allow starting a Classic BR/EDR connection while a classic dis-
covery process in in progress. Please terminate any classic discovery with bt_gap_cancel_discovery command prior to starting the
RFCOMM connection.
4-9 bd_addr address Bluetooth address of the remote device in little endian format
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_bt_rfcomm_open(bd_addr *address, uint8 streaming_destination, uint8array uuid);
/* Response id */
dumo_rsp_bt_rfcomm_open_id
/* Response structure */
struct dumo_msg_bt_rfcomm_open_rsp_t
{
uint16 result,
uint8 endpoint
}
Event Description
3.4.1.3 cmd_bt_rfcomm_open_port
This command can be used to open an RFCOMM channel to a remote device using a fixed RFCOMM port number. This bypasses the
Service Discovery Protocol procedure for retrieving the RFCOMM port from the remote device's Serial Port Profile SDP entry, thus
speeding up connection establishment.
4-9 bd_addr address Bluetooth address of the remote device in little endian format
BGScript command
call bt_rfcomm_open_port(address,streaming_destination,port)(result,endpoint)
BGLIB C API
/* Function */
void dumo_cmd_bt_rfcomm_open_port(bd_addr *address, uint8 streaming_destination, uint8 port);
/* Response id */
dumo_rsp_bt_rfcomm_open_port_id
/* Response structure */
struct dumo_msg_bt_rfcomm_open_port_rsp_t
{
uint16 result,
uint8 endpoint
}
Event Description
3.4.1.4 cmd_bt_rfcomm_set_modem_status_default
This command sets starting value modem control status bits for new outogoing RFCOMM connections.
BGScript command
call bt_rfcomm_set_modem_status_default(modem)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_rfcomm_set_modem_status_default(uint8 modem);
/* Response id */
dumo_rsp_bt_rfcomm_set_modem_status_default_id
/* Response structure */
struct dumo_msg_bt_rfcomm_set_modem_status_default_rsp_t
{
uint16 result
}
3.4.1.5 cmd_bt_rfcomm_start_server
This command can be used to start a RFCOMM server as defined in the referenced SDP-entry.
5 uint8 streaming_destina- Streaming destination endpoint for the connection. This should be
tion one of the fixed endpoints. While a dynamic connection endpoint
will work for proxying data coming from an RFCOMM connection
to another connection endpoint, there is no guarantee that the
destination endpoint will be there when an incoming RFCOMM
connection is established. Endpoint 'SCRIPT' is a special case in
the BGAPI mode for RFCOMM. Data events are sent to script and
in addition also to UART. Please note that if size event exeeds
size of 256 (inclusive of headers) it will be rejected by the script
intepreter.
BGScript command
call bt_rfcomm_start_server(sdp_id,streaming_destination)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_rfcomm_start_server(uint8 sdp_id, uint8 streaming_destination);
/* Response id */
dumo_rsp_bt_rfcomm_start_server_id
/* Response structure */
struct dumo_msg_bt_rfcomm_start_server_rsp_t
{
uint16 result
}
3.4.1.6 cmd_bt_rfcomm_start_server_port
5 uint8 streaming_destina- Streaming destination endpoint for the connection. This should be
tion one of the fixed endpoints. While a dynamic connection endpoint
will work for proxying data coming from an RFCOMM connection
to another connection endpoint, there is no guarantee that the
destination endpoint will be there when an incoming RFCOMM
connection is established.
BGScript command
call bt_rfcomm_start_server_port(port,streaming_destination)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_rfcomm_start_server_port(uint8 port, uint8 streaming_destination);
/* Response id */
dumo_rsp_bt_rfcomm_start_server_port_id
/* Response structure */
struct dumo_msg_bt_rfcomm_start_server_port_rsp_t
{
uint16 result
}
3.4.1.7 cmd_bt_rfcomm_stop_server
4 uint8 sdp_id ID of the SDP entry defined in the project configuration file.
BGScript command
call bt_rfcomm_stop_server(sdp_id)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_rfcomm_stop_server(uint8 sdp_id);
/* Response id */
dumo_rsp_bt_rfcomm_stop_server_id
/* Response structure */
struct dumo_msg_bt_rfcomm_stop_server_rsp_t
{
uint16 result
}
3.4.1.8 cmd_bt_rfcomm_stop_server_port
This command can be used to stop an RFCOMM server that has been started ona port.
BGScript command
call bt_rfcomm_stop_server_port(port)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_rfcomm_stop_server_port(uint8 port);
/* Response id */
dumo_rsp_bt_rfcomm_stop_server_port_id
/* Response structure */
struct dumo_msg_bt_rfcomm_stop_server_port_rsp_t
{
uint16 result
}
3.4.2.1 evt_bt_rfcomm_credit_starvation
This event indicates that outgoing data traffic has possibly been stuck. If there is no valid reason why the other end has not sent us flow
control credits then the connection should be closed.
BGScript event
event bt_rfcomm_credit_starvation(endpoint)
C Functions
/* Event id */
dumo_evt_bt_rfcomm_credit_starvation_id
/* Event structure */
struct dumo_msg_bt_rfcomm_credit_starvation_evt_t
{
uint8 endpoint
}
3.4.2.2 evt_bt_rfcomm_incoming_rejected
This event indicates that incoming rfcomm connection was rejected due being low in memory.
4-9 bd_addr address Bluetooth address of the remote device in little endian format
BGScript event
event bt_rfcomm_incoming_rejected(address)
C Functions
/* Event id */
dumo_evt_bt_rfcomm_incoming_rejected_id
/* Event structure */
struct dumo_msg_bt_rfcomm_incoming_rejected_evt_t
{
bd_addr *address
}
3.4.2.3 evt_bt_rfcomm_modem_status
5 uint8 modem Value of the modem status. For description and meaning of bits in
this field see ETSI TS 07.10.
BGScript event
event bt_rfcomm_modem_status(endpoint,modem)
C Functions
/* Event id */
dumo_evt_bt_rfcomm_modem_status_id
/* Event structure */
struct dumo_msg_bt_rfcomm_modem_status_evt_t
{
uint8 endpoint,
uint8 modem
}
3.4.2.4 evt_bt_rfcomm_opened
5-10 bd_addr address Bluetooth address of the remote Bluetooth Classic device in little
endian format.
BGScript event
event bt_rfcomm_opened(endpoint,address)
C Functions
/* Event id */
dumo_evt_bt_rfcomm_opened_id
/* Event structure */
struct dumo_msg_bt_rfcomm_opened_evt_t
{
uint8 endpoint,
bd_addr *address
}
The commands and events in this are related to the Service Discovery Profile (SDP).
3.5.1.1 cmd_bt_sdp_add_entry
This function load custom defined SDP record into the SDP server. Note that this funtion does not verify the correctness of the record at
all.
4-7 uint32 sdp_id ID of the SDP entry to be loaded. Range from 1000 to 2000
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_bt_sdp_add_entry(uint32 sdp_id, uint8array record);
/* Response id */
dumo_rsp_bt_sdp_add_entry_id
/* Response structure */
struct dumo_msg_bt_sdp_add_entry_rsp_t
{
uint16 result
}
3.5.1.2 cmd_bt_sdp_delete_entry
This function removes custom defined SDP record from the SDP server.
4-7 uint32 sdp_id ID of the SDP entry to be loaded. Range from 1000 to 2000
BGScript command
call bt_sdp_delete_entry(sdp_id)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_sdp_delete_entry(uint32 sdp_id);
/* Response id */
dumo_rsp_bt_sdp_delete_entry_id
/* Response structure */
struct dumo_msg_bt_sdp_delete_entry_rsp_t
{
uint16 result
}
3.5.1.3 cmd_bt_sdp_load_entry
This command can be used to load an SDP entry from the internal filesystem to the SDP server. NOTE: command only loads SDP
record. It does not do anything else. Like start RFCOMM server
4-7 uint32 sdp_id ID of the SDP entry defined in the project configuration file. See
the Bluetooth Smart Ready Serial Port Profile Application Notes
for details
BGScript command
call bt_sdp_load_entry(sdp_id)(result)
BGLIB C API
/* Function */
void dumo_cmd_bt_sdp_load_entry(uint32 sdp_id);
/* Response id */
dumo_rsp_bt_sdp_load_entry_id
/* Response structure */
struct dumo_msg_bt_sdp_load_entry_rsp_t
{
uint16 result
}
3.5.1.4 cmd_bt_sdp_search_rfcomm_port
This command can be used to search for Serial Port Profile (SPP) services in a Bluetooth Classic device. The reply is an event specify-
ing the RFCOMM port found.
4-9 bd_addr address Bluetooth device address of the remote device in little endian for-
mat
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_bt_sdp_search_rfcomm_port(bd_addr *address, uint8array uuid);
/* Response id */
dumo_rsp_bt_sdp_search_rfcomm_port_id
/* Response structure */
struct dumo_msg_bt_sdp_search_rfcomm_port_rsp_t
{
uint16 result
}
Event Description
3.5.2.1 evt_bt_sdp_search_rfcomm_port
BGScript event
C Functions
/* Event id */
dumo_evt_bt_sdp_search_rfcomm_port_id
/* Event structure */
struct dumo_msg_bt_sdp_search_rfcomm_port_evt_t
{
uint32 request_handle,
uint16 status,
uint8 port,
uint8array service_name
}
These commands and events are related to controlling firmware update over the configured host interface and are available only when
the module has been booted into DFU mode. The DFU process:
1. Boot device to DFU mode with DFU reset command
2. Wait for DFU boot event
3. Send command Flash Set Address to start the firmware update
4. Upload the firmware with Flash Upload commands until all the data has been uploaded
5. Send when all the data has been uploaded
6. Finalize the DFU firmware update with Reset command.
Bootloader checks the CRC checksum from the uploaded image and the module will remain in DFU mode if it does not match. DFU
mode is using UART baudrate from the hardware configuration of the firmware. Default baudrate 115200 is used if firmware is missing
or firmware content does not match with CRC checksum.
3.6.1.1 cmd_dfu_flash_set_address
After re-booting the local device into DFU mode, this command can be used to define the starting address on the flash to where the
new firmware will be written in.
4-7 uint32 address The offset in the flash where the new firmware is uploaded to. Al-
ways use the value 0x00000000.
BGScript command
call dfu_flash_set_address(address)(result)
BGLIB C API
/* Function */
void dumo_cmd_dfu_flash_set_address(uint32 address);
/* Response id */
dumo_rsp_dfu_flash_set_address_id
/* Response structure */
struct dumo_msg_dfu_flash_set_address_rsp_t
{
uint16 result
}
3.6.1.2 cmd_dfu_flash_upload
This command can be used to upload the whole firmware image file in to the Bluetooth module. The recommended payload size of the
command is 128 bytes, so multiple commands need to be issued one after the other until the whole .bin firmware image file is uploaded
to the module. The next address of the flash sector in memory to write to is automatically updated by the bootloader after each individu-
al command.
4 uint8array data An array of data which will be written onto the flash.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_dfu_flash_upload(uint8array data);
/* Response id */
dumo_rsp_dfu_flash_upload_id
/* Response structure */
struct dumo_msg_dfu_flash_upload_rsp_t
{
uint16 result
}
3.6.1.3 cmd_dfu_flash_upload_finish
This command can be used to tell to the device that the DFU file has been fully uploaded. To return the device back to normal mode the
command DFU Reset must be issued next.
BGScript command
call dfu_flash_upload_finish()(result)
BGLIB C API
/* Function */
void dumo_cmd_dfu_flash_upload_finish();
/* Response id */
dumo_rsp_dfu_flash_upload_finish_id
/* Response structure */
struct dumo_msg_dfu_flash_upload_finish_rsp_t
{
uint16 result
}
3.6.1.4 cmd_dfu_reset
This command can be used to reset the system. This command does not have a response, but it triggers one of the boot events (nor-
mal reset or boot to DFU mode) after re-boot.
BGScript command
call dfu_reset(dfu)
BGLIB C API
/* Function */
void dumo_cmd_dfu_reset(uint8 dfu);
Event Description
system_boot Sent after the device has booted into normal mode
dfu_boot Sent after the device has booted into DFU mode
3.6.2.1 evt_dfu_boot
This event indicates that the module booted into DFU mode, and is now ready to receive commands related to device firmware upgade
(DFU).
BGScript event
event dfu_boot(version)
C Functions
/* Event id */
dumo_evt_dfu_boot_id
/* Event structure */
struct dumo_msg_dfu_boot_evt_t
{
uint32 version
}
These commands and events are related to the control of endpoints. They allow the creation and deletion of endpoints as well as con-
figuration of data routing. Predefined endpoints ID's are:
• 0: UART
• 1: SCRIPT
• 3: SPI1 (only if defined in hardware configuration)
• 4: SPI2 (only if defined in hardware configuration)
• 31: DROP
Note the difference between these endpoint ID's and the endpoint types is that endpoint types describe different categories. Each end-
point has an endpoint type which describes what kind of endpoint it is. There may be multiple endpoints which have the same type.
Each endpoint has exactly one ID, and each ID points to exactly one endpoint.
3.7.1.1 cmd_endpoint_close
This command can be used to close an RFCOMM endpoint , LE cable replacement endpoint, or a BLE connection. This command
must always be used to close an endpoint with WAIT_CLOSE status when the remote side has closed the RFCOMM or LE cable re-
placement connection. This is to free the memory allocated by the endpoint for future reuse in the case when the remote side closes
the connection. Note : this command may not be issued inside endpoint_data event handler in BgScript.
BGScript command
call endpoint_close(endpoint)(result,endpoint)
BGLIB C API
/* Function */
void dumo_cmd_endpoint_close(uint8 endpoint);
/* Response id */
dumo_rsp_endpoint_close_id
/* Response structure */
struct dumo_msg_endpoint_close_rsp_t
{
uint16 result,
uint8 endpoint
}
Event Description
3.7.1.2 cmd_endpoint_read_counters
This command can be used to read the data performance counters (data sent counter and data received counter) of an endpoint.
6 uint8 endpoint
BGScript command
call endpoint_read_counters(endpoint)(result,endpoint,tx,rx)
BGLIB C API
/* Function */
void dumo_cmd_endpoint_read_counters(uint8 endpoint);
/* Response id */
dumo_rsp_endpoint_read_counters_id
/* Response structure */
struct dumo_msg_endpoint_read_counters_rsp_t
{
uint16 result,
uint8 endpoint,
uint32 tx,
uint32 rx
}
3.7.1.3 cmd_endpoint_send
This command can be used to send data to the defined endpoint. When this command is issued data to be sent is placed to send
queue for sending, except for SPI endpoints. In case of SPI endpoints data is immediately sent over the interface and transfer is com-
plete once the response to this command has been received.
4 uint8 endpoint The index of the endpoint to which the data will be sent.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_endpoint_send(uint8 endpoint, uint8array data);
/* Response id */
dumo_rsp_endpoint_send_id
/* Response structure */
struct dumo_msg_endpoint_send_rsp_t
{
uint16 result,
uint8 endpoint
}
3.7.1.4 cmd_endpoint_set_active
This command can be used to set the endpoint active or inactive. When the endpoint is inactive, any incoming data will be paused, and
no data may be sent out. Not all endpoint types can set changed inactive. Currently only rfcomm endpoints can be set inactive.
BGScript command
call endpoint_set_active(endpoint,active)(result)
BGLIB C API
/* Function */
void dumo_cmd_endpoint_set_active(uint8 endpoint, uint8 active);
/* Response id */
dumo_rsp_endpoint_set_active_id
/* Response structure */
struct dumo_msg_endpoint_set_active_rsp_t
{
uint16 result
}
Event Description
3.7.1.5 cmd_endpoint_set_streaming_destination
This command can be used to set the destination into which data from an endpoint will be routed to.
BGScript command
call endpoint_set_streaming_destination(endpoint,destination_endpoint)(result)
BGLIB C API
/* Function */
void dumo_cmd_endpoint_set_streaming_destination(uint8 endpoint, uint8 destination_endpoint);
/* Response id */
dumo_rsp_endpoint_set_streaming_destination_id
/* Response structure */
struct dumo_msg_endpoint_set_streaming_destination_rsp_t
{
uint16 result
}
Event Description
3.7.2.1 evt_endpoint_closed
This event indicates that an RFCOMM endpoint has been closed by the safety timer. After endpoint_closing event user should close the
endpoint to release the resources taken by the enpoint. If user fails to do so in about 5 seconds then module SW will release resources
and dispatch this event.
BGScript event
event endpoint_closed(endpoint)
C Functions
/* Event id */
dumo_evt_endpoint_closed_id
/* Event structure */
struct dumo_msg_endpoint_closed_evt_t
{
uint8 endpoint
}
3.7.2.2 evt_endpoint_closing
This event indicates that an endpoint is closing or that the remote end has terminated the connection. This event should be acknowl-
edged by calling the endpoint_close command or otherwise the firmware will not re-use the endpoint index.
BGScript event
event endpoint_closing(reason,endpoint)
C Functions
/* Event id */
dumo_evt_endpoint_closing_id
/* Event structure */
struct dumo_msg_endpoint_closing_evt_t
{
uint16 reason,
uint8 endpoint
}
3.7.2.3 evt_endpoint_data
This event indicates incoming data from an endpoint. Note : endpoint_close command must not be used in BgScript handler for this
event.
4 uint8 endpoint The endpoint which received this data, i.e. to which it was sent.
BGScript event
C Functions
/* Event id */
dumo_evt_endpoint_data_id
/* Event structure */
struct dumo_msg_endpoint_data_evt_t
{
uint8 endpoint,
uint8array data
}
3.7.2.4 evt_endpoint_status
4 uint8 endpoint The index of the endpoint whose status this event describes
9 int8 destination_endpoint The index of the endpoint to which the incoming data goes.
BGScript event
event endpoint_status(endpoint,type,destination_endpoint,flags)
C Functions
/* Event id */
dumo_evt_endpoint_status_id
/* Event structure */
struct dumo_msg_endpoint_status_evt_t
{
uint8 endpoint,
uint32 type,
int8 destination_endpoint,
uint8 flags
}
3.7.2.5 evt_endpoint_syntax_error
This event indicates that a protocol error was detected in BGAPI command parser. This event is triggered if a BGAPI command from
the host contains syntax error(s), or if a command is only partially sent, in which case the BGAPI parser has a 1 second command
timeout by default. In practice, the latter case happens if a byte belonging to a command is sent not before a timeout of 1 second since
the previous byte. The default timeout can be changed from 1ms to 4s via the "timeout" parameter of the attribute <uart> in the hard-
ware.xml firmware project file. Any partial or wrongly formatted command will be discarded.
BGScript event
event endpoint_syntax_error(result,endpoint)
C Functions
/* Event id */
dumo_evt_endpoint_syntax_error_id
/* Event structure */
struct dumo_msg_endpoint_syntax_error_evt_t
{
uint16 result,
uint8 endpoint
}
3.7.3.1 enum_endpoint_types
These values define the endpoint types. Please note that there may be multiple endpoints with type
1 endpoint_uart UART
2 endpoint_script Scripting
64 endpoint_spi SPI
3.7.4.1 define_endpoint_endpoint_flags
32 ENDPOINT_FLAG_CLOSING Endpoint is closed from the host side and is waiting for
the device to acknowledge closing of the endpoint
64 ENDPOINT_FLAG_FULL Endpoint buffers are full and no data from host can be
sent to it.
Thse commands and events can be used to manage the user data in the flash memory of the Bluetooth module. User data stored in PS
keys within the flash memory is persistent across reset and power cycling of the module.
3.8.1.1 cmd_flash_ps_dump
This command can be used to retrieve all PS keys and their current values. For each existing PS key a flash_pskey event will be gener-
ated which includes the corresponding PS key value.
BGScript command
call flash_ps_dump()(result)
BGLIB C API
/* Function */
void dumo_cmd_flash_ps_dump();
/* Response id */
dumo_rsp_flash_ps_dump_id
/* Response structure */
struct dumo_msg_flash_ps_dump_rsp_t
{
uint16 result
}
Event Description
3.8.1.2 cmd_flash_ps_erase
This command can be used to erase a single PS key and its value from the Persistent Store.
BGScript command
call flash_ps_erase(key)(result)
BGLIB C API
/* Function */
void dumo_cmd_flash_ps_erase(uint16 key);
/* Response id */
dumo_rsp_flash_ps_erase_id
/* Response structure */
struct dumo_msg_flash_ps_erase_rsp_t
{
uint16 result
}
3.8.1.3 cmd_flash_ps_erase_all
This command can be used to erase all PS keys and their corresponding value.
BGScript command
call flash_ps_erase_all()(result)
BGLIB C API
/* Function */
void dumo_cmd_flash_ps_erase_all();
/* Response id */
dumo_rsp_flash_ps_erase_all_id
/* Response structure */
struct dumo_msg_flash_ps_erase_all_rsp_t
{
uint16 result
}
3.8.1.4 cmd_flash_ps_load
This command can be used for retrieving the value of the specified PS key.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_flash_ps_load(uint16 key);
/* Response id */
dumo_rsp_flash_ps_load_id
/* Response structure */
struct dumo_msg_flash_ps_load_rsp_t
{
uint16 result,
uint8array value
}
3.8.1.5 cmd_flash_ps_save
This command can be used to store a value into the specified PS key. The allowed PS key range is from 0x4000 to 0x407F. Maximum
length of value is 250 bytes. Maximum storage space is 4 KB and this is shared with system internal keys. Available storage space
depends on how much storage space the application will use. In addition 20 bytes of metadata is stored for each PS item.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_flash_ps_save(uint16 key, uint8array value);
/* Response id */
dumo_rsp_flash_ps_save_id
/* Response structure */
struct dumo_msg_flash_ps_save_rsp_t
{
uint16 result
}
3.8.2.1 evt_flash_ps_key
This event indicates that the flash_ps_dump command was given. It returns a single PS key and its value. There can be multiple events
if multiple PS keys exist.
BGScript event
C Functions
/* Event id */
dumo_evt_flash_ps_key_id
/* Event structure */
struct dumo_msg_flash_ps_key_evt_t
{
uint16 key,
uint8array value
}
The commands and events in this class can be used to browse and manage attributes in a remote GATT server.
3.9.1.1 cmd_gatt_discover_characteristics
This command can be used to discover all characteristics of the defined GATT service from a remote GATT database. This command
generates a unique gatt_characteristic event for every discovered characteristic. Received gatt_procedure_completed event indicates
that this GATT procedure has succesfully completed or failed with error.
5-8 uint32 service GATT service handle. This value is normally received from the
gatt_service event.
BGScript command
call gatt_discover_characteristics(connection,service)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_discover_characteristics(uint8 connection, uint32 service);
/* Response id */
dumo_rsp_gatt_discover_characteristics_id
/* Response structure */
struct dumo_msg_gatt_discover_characteristics_rsp_t
{
uint16 result
}
Event Description
Event Description
3.9.1.2 cmd_gatt_discover_characteristics_by_uuid
This command can be used to discover all the characteristics of the specified GATT service in a remote GATT database having the
specified UUID. This command generates a unique gatt_characteristic event for every discovered characteristic having the specified
UUID. Received gatt_procedure_completed event indicates that this GATT procedure has successfully completed or failed with error.
5-8 uint32 service GATT service handle. This value is normally received from the
gatt_service event.
9 uint8array uuid Characteristic UUID, first byte is the length of UUID and rest is
UUID in little-endian format
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_discover_characteristics_by_uuid(uint8 connection, uint32 service, uint8array uuid);
/* Response id */
dumo_rsp_gatt_discover_characteristics_by_uuid_id
/* Response structure */
struct dumo_msg_gatt_discover_characteristics_by_uuid_rsp_t
{
uint16 result
}
Event Description
3.9.1.3 cmd_gatt_discover_descriptors
This command can be used to discover all the descriptors of the specified remote GATT characteristics in a remote GATT database.
This command generates a unique gatt_descriptor event for every discovered descriptor. Received gatt_procedure_completed event
indicates that this GATT procedure has succesfully completed or failed with error.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
BGScript command
call gatt_discover_descriptors(connection,characteristic)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_discover_descriptors(uint8 connection, uint16 characteristic);
/* Response id */
dumo_rsp_gatt_discover_descriptors_id
/* Response structure */
struct dumo_msg_gatt_discover_descriptors_rsp_t
{
uint16 result
}
Event Description
Event Description
3.9.1.4 cmd_gatt_discover_primary_services
This command can be used to discover all the primary services of a remote GATT database. This command generates a unique
gatt_service event for every discovered primary service. Received gatt_procedure_completed event indicates that this GATT procedure
has successfully completed or failed with error.
BGScript command
call gatt_discover_primary_services(connection)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_discover_primary_services(uint8 connection);
/* Response id */
dumo_rsp_gatt_discover_primary_services_id
/* Response structure */
struct dumo_msg_gatt_discover_primary_services_rsp_t
{
uint16 result
}
Event Description
3.9.1.5 cmd_gatt_discover_primary_services_by_uuid
This command can be used to discover primary services with the specified UUID in a remote GATT database. This command gener-
ates unique gatt_service event for every discovered primary service. Received gatt_procedure_completed event indicates that this
GATT procedure has succesfully completed or failed with error.
5 uint8array uuid Characteristic UUID, first byte is the length of UUID and rest is
UUID in little-endian format
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_discover_primary_services_by_uuid(uint8 connection, uint8array uuid);
/* Response id */
dumo_rsp_gatt_discover_primary_services_by_uuid_id
/* Response structure */
struct dumo_msg_gatt_discover_primary_services_by_uuid_rsp_t
{
uint16 result
}
Event Description
Event Description
3.9.1.6 cmd_gatt_execute_characteristic_value_write
This command can be used to commit or cancel previously queued writes to a long characteristic of a remote GATT server. Writes are
sent to queue with prepare_characteristic_value_write command. Content, offset and length of queued values are validated by this pro-
cedure. A received gatt_procedure_completed event indicates that all data has been written successfully or that an error response has
been received.
BGScript command
call gatt_execute_characteristic_value_write(connection,flags)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_execute_characteristic_value_write(uint8 connection, uint8 flags);
/* Response id */
dumo_rsp_gatt_execute_characteristic_value_write_id
/* Response structure */
struct dumo_msg_gatt_execute_characteristic_value_write_rsp_t
{
uint16 result
}
Event Description
3.9.1.7 cmd_gatt_find_included_services
This command can be used to find out if a service of a remote GATT database includes one or more other services. This command
generates a unique gatt_service_completed event for each included service. This command generates a unique gatt_service event for
every discovered service. Received gatt_procedure_completed event indicates that this GATT procedure has successfully completed or
failed with error.
5-8 uint32 service GATT service handle. This value is normally received from the
gatt_service event.
BGScript command
call gatt_find_included_services(connection,service)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_find_included_services(uint8 connection, uint32 service);
/* Response id */
dumo_rsp_gatt_find_included_services_id
/* Response structure */
struct dumo_msg_gatt_find_included_services_rsp_t
{
uint16 result
}
Event Description
3.9.1.8 cmd_gatt_prepare_characteristic_value_write
This command can be used to add a characteristic value to the write queue of a remote GATT server. This command can be used in
cases where very long attributes need to be written, or a set of values needs to be written atomically. In all cases where the amount of
data to transfer fits into the BGAPI payload the command gatt_write_characteristic_value is recommended for writing long values since
it transparently performs the prepare_write and execute_write commands. A received evt_gatt_characteristic_value event can be used
to verify that the data has been transmitted. Writes are executed or cancelled with the execute_characteristic_value_write command.
Whether the writes succeeded or not are indicated in the response of the execute_characteristic_value_write command.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
9 uint8array value Value to write into the specified characteristic of the remote GATT
database
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_prepare_characteristic_value_write(uint8 connection, uint16 characteristic, uint16 offset, u
int8array value);
/* Response id */
dumo_rsp_gatt_prepare_characteristic_value_write_id
/* Response structure */
struct dumo_msg_gatt_prepare_characteristic_value_write_rsp_t
{
uint16 result
}
Event Description
3.9.1.9 cmd_gatt_read_characteristic_value
This command can be used to read the value of a characteristic from a remote GATT database. A single gatt_characteristic_value
event is generated if the length of the characteristic value returned by the remote GATT server is less than or equal to the size of the
GATT MTU. If the length of the value exceeds the size of the GATT MTU more than one gatt_characteristic_value event is generated
because the firmware will automatically use the "read long" GATT procedure. A received gatt_procedure_completed event indicates
that all data has been read successfully or that an error response has been received.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
BGScript command
call gatt_read_characteristic_value(connection,characteristic)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_read_characteristic_value(uint8 connection, uint16 characteristic);
/* Response id */
dumo_rsp_gatt_read_characteristic_value_id
/* Response structure */
struct dumo_msg_gatt_read_characteristic_value_rsp_t
{
uint16 result
}
Event Description
gatt_characteristic_value This event contains the data belonging to a characteristic sent by the GATT Server.
3.9.1.10 cmd_gatt_read_characteristic_value_by_uuid
This command can be used to read the characteristic value of a service from a remote GATT database by giving the UUID of the char-
acteristic and the handle of the service containing this characteristic. A single gatt_characteristic_value event is generated if the length
of the characteristic value returned by the remote GATT server is less than or equal to the size of the GATT MTU. If the length of the
value exceeds the size of the GATT MTU more than one gatt_characteristic_value event is generated because the firmware will auto-
matically use the "read long" GATT procedure. A received gatt_procedure_completed event indicates that all data has been read suc-
cessfully or that an error response has been received.
5-8 uint32 service GATT service handle. This value is normally received from the
gatt_service event.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_read_characteristic_value_by_uuid(uint8 connection, uint32 service, uint8array uuid);
/* Response id */
dumo_rsp_gatt_read_characteristic_value_by_uuid_id
/* Response structure */
struct dumo_msg_gatt_read_characteristic_value_by_uuid_rsp_t
{
uint16 result
}
Event Description
gatt_characteristic_value This event contains the data belonging to a characteristic sent by the GATT Server.
3.9.1.11 cmd_gatt_read_descriptor_value
This command can be used to read the descriptor value of a characteristic in a remote GATT database. A single gatt_descriptor_value
event is generated if the length of the descriptor value returned by the remote GATT server is less than or equal to the size of the GATT
MTU. If the length of the value exceeds the size of the GATT MTU more than one gatt_descriptor_value event is generated because
the firmware will automatically use the "read long" GATT procedure. A received gatt_procedure_completed event indicates that all data
has been read successfully or that an error response has been received.
BGScript command
call gatt_read_descriptor_value(connection,descriptor)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_read_descriptor_value(uint8 connection, uint16 descriptor);
/* Response id */
dumo_rsp_gatt_read_descriptor_value_id
/* Response structure */
struct dumo_msg_gatt_read_descriptor_value_rsp_t
{
uint16 result
}
Event Description
3.9.1.12 cmd_gatt_read_multiple_characteristic_values
This command can be used to read the values of multiple characteristics from a remote GATT database at once. gatt_characteris-
tic_value events are generated as the values are returned by the remote GATT server. A received gatt_procedure_completed event
indicates that either all data has been read successfully or that an error response has been received.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_read_multiple_characteristic_values(uint8 connection, uint8array characteristic_list);
/* Response id */
dumo_rsp_gatt_read_multiple_characteristic_values_id
/* Response structure */
struct dumo_msg_gatt_read_multiple_characteristic_values_rsp_t
{
uint16 result
}
Event Description
gatt_characteristic_value This event contains the data belonging to a characteristic sent by the GATT Server.
Event Description
3.9.1.13 cmd_gatt_send_characteristic_confirmation
This command must be used to send a characteristic confirmation to a remote GATT server after receiving an indication. The gatt_char-
acteristic_value_event carries the att_opcode containing handle_value_indication (0x1e) which reveals that an indication has been re-
ceived and this must be confirmed with this command. Confirmation needs to be sent within 30 seconds, otherwise the GATT transac-
tions between the client and the server are discontinued.
BGScript command
call gatt_send_characteristic_confirmation(connection)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_send_characteristic_confirmation(uint8 connection);
/* Response id */
dumo_rsp_gatt_send_characteristic_confirmation_id
/* Response structure */
struct dumo_msg_gatt_send_characteristic_confirmation_rsp_t
{
uint16 result
}
3.9.1.14 cmd_gatt_set_characteristic_notification
This command can be used to enable or disable the notifications and indications being sent from a remote GATT server. This proce-
dure discovers a characteristic client configuration descriptor and writes the related configuration flags to a remote GATT database. A
received gatt_procedure_completed event indicates that this GATT procedure has successfully completed or that is has failed with an
error.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
BGScript command
call gatt_set_characteristic_notification(connection,characteristic,flags)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_set_characteristic_notification(uint8 connection, uint16 characteristic, uint8 flags);
/* Response id */
dumo_rsp_gatt_set_characteristic_notification_id
/* Response structure */
struct dumo_msg_gatt_set_characteristic_notification_rsp_t
{
uint16 result
}
Event Description
gatt_characteristic_value If an indication or notification has been enabled for a characteristic, this event is trig-
gered whenever an indication or notification is sent by the remote GATT server. The trig-
gering conditions on the GATT server side are defined by an upper level, for example by
a profile; so it is possible that no values are ever received, or that it may take time,
depending on how the server is configured.
3.9.1.15 cmd_gatt_set_max_mtu
This command can be used to set the maximum number of GATT Message Transfer Units (MTU). If max_mtu is non-default, MTU is
exchanged automatically after Bluetooth LE connection has been established.
4-5 uint16 max_mtu Maximum number of Message Transfer Units (MTU) allowed
• Range: 23 to 158
Default: 23
BGScript command
call gatt_set_max_mtu(max_mtu)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_set_max_mtu(uint16 max_mtu);
/* Response id */
dumo_rsp_gatt_set_max_mtu_id
/* Response structure */
struct dumo_msg_gatt_set_max_mtu_rsp_t
{
uint16 result
}
3.9.1.16 cmd_gatt_write_characteristic_value
This command can be used to write the value of a characteristic in a remote GATT database. If the length of the given value is greater
than the exchanged GATT MTU (Message Transfer Unit), "write long" GATT procedure is used automatically. Received gatt_proce-
dure_completed event indicates that all data has been written successfully or that an error response has been received.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_write_characteristic_value(uint8 connection, uint16 characteristic, uint8array value);
/* Response id */
dumo_rsp_gatt_write_characteristic_value_id
/* Response structure */
struct dumo_msg_gatt_write_characteristic_value_rsp_t
{
uint16 result
}
Event Description
3.9.1.17 cmd_gatt_write_characteristic_value_without_response
This command can be used to write the value of a characteristic in a remote GATT database. This command does not generate any
event. All failures on the server are ignored silently. For example, if an error is generated in the remote GATT server and the given
value is not written into database no error message will be reported to the local GATT client. Note that this command cannot be used to
write long values.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_write_characteristic_value_without_response(uint8 connection, uint16 characteristic, uint8ar
ray value);
/* Response id */
dumo_rsp_gatt_write_characteristic_value_without_response_id
/* Response structure */
struct dumo_msg_gatt_write_characteristic_value_without_response_rsp_t
{
uint16 result
}
3.9.1.18 cmd_gatt_write_descriptor_value
This command can be used to write the value of a characteristic descriptor in a remote GATT database. If the length of the given value
is greater than the exchanged GATT MTU size, "write long" GATT procedure is used automatically. Received gatt_procedure_comple-
ted event indicates that all data has been written succesfully or that an error response has been received.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_write_descriptor_value(uint8 connection, uint16 descriptor, uint8array value);
/* Response id */
dumo_rsp_gatt_write_descriptor_value_id
/* Response structure */
struct dumo_msg_gatt_write_descriptor_value_rsp_t
{
uint16 result
}
Event Description
3.9.2.1 evt_gatt_characteristic
This event indicates that a GATT characteristic in the remote GATT database was discovered. This event is generated after issuing
either the gatt_discover_characteristics or command.
8 uint8array uuid Characteristic UUID, first byte is the length of UUID and rest is
UUID in little-endian format
BGScript event
C Functions
/* Event id */
dumo_evt_gatt_characteristic_id
/* Event structure */
struct dumo_msg_gatt_characteristic_evt_t
{
uint8 connection,
uint16 characteristic,
uint8 properties,
uint8array uuid
}
3.9.2.2 evt_gatt_characteristic_value
This event indicates that the value of a characteristic in the remote GATT server was received. This event is triggered as a result of
several commands: gatt_read_characteristic_value, , gatt_read_multiple_characteristic_values, gatt_prepare_characteristic_val-
ue_write; and when the remote GATT server sends indications or notifications after enabling notifications with gatt_set_characteris-
tic_notification. The parameter att_opcode reveals which type of GATT transaction triggered this event. In particular, if the att_opcode
type is handle_value_indication (0x1d), the application needs to confirm the indication with gatt_send_characteristic_confirmation.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
7 uint8 att_opcode Attribute opcode which informs the GATT transaction used
BGScript event
C Functions
/* Event id */
dumo_evt_gatt_characteristic_value_id
/* Event structure */
struct dumo_msg_gatt_characteristic_value_evt_t
{
uint8 connection,
uint16 characteristic,
uint8 att_opcode,
uint16 offset,
uint8array value
}
3.9.2.3 evt_gatt_descriptor
This event indicates that a GATT characteristic descriptor in the remote GATT database was discovered. This event is generated after
issuing the gatt_discover_descriptors command.
7 uint8array uuid Characteristic UUID, first byte is the length of UUID and rest is
UUID in little-endian format
BGScript event
C Functions
/* Event id */
dumo_evt_gatt_descriptor_id
/* Event structure */
struct dumo_msg_gatt_descriptor_evt_t
{
uint8 connection,
uint16 descriptor,
uint8array uuid
}
3.9.2.4 evt_gatt_descriptor_value
This event indicates that the value of a descriptor in the remote GATT server was received. This event is generated by the
gatt_read_descriptor_value command.
BGScript event
C Functions
/* Event id */
dumo_evt_gatt_descriptor_value_id
/* Event structure */
struct dumo_msg_gatt_descriptor_value_evt_t
{
uint8 connection,
uint16 descriptor,
uint16 offset,
uint8array value
}
3.9.2.5 evt_gatt_procedure_completed
This event indicates that the current GATT procedure has been completed successfully or that is has failed with an error. All GATT
commands excluding gatt_write_characteristic_value_without_response and gatt_send_characteristic_confirmation will trigger this
event, so the application must wait for this event before issuing another GATT command (excluding the two aforementioned excep-
tions).
BGScript event
event gatt_procedure_completed(connection,result)
C Functions
/* Event id */
dumo_evt_gatt_procedure_completed_id
/* Event structure */
struct dumo_msg_gatt_procedure_completed_evt_t
{
uint8 connection,
uint16 result
}
3.9.2.6 evt_gatt_service
This event indicates that a GATT service in the remote GATT database was discovered. This event is generated after issuing either the
gatt_discover_primary_services or command.
9 uint8array uuid Characteristic UUID, first byte is the length of UUID and rest is
UUID in little-endian format
BGScript event
C Functions
/* Event id */
dumo_evt_gatt_service_id
/* Event structure */
struct dumo_msg_gatt_service_evt_t
{
uint8 connection,
uint32 service,
uint8array uuid
}
3.9.3.1 enum_gatt_att_opcode
These values indicate which attribute request or response has caused the event.
27 gatt_handle_value_notification Notification
29 gatt_handle_value_indication Indication
3.9.3.2 enum_gatt_client_config_flag
These values define whether the client is to receive notifications or indications from a remote GATT server.
1 gatt_notification Notification
2 gatt_indication Indication
3.9.3.3 enum_gatt_execute_write_flag
These values define whether the GATT server is to cancel all queued writes or commit all queued writes to a remote database.
These commands and events are used by the local GATT server to manage the local GATT database.
3.10.1.1 cmd_gatt_server_read_attribute_type
This command can be used to read the type of an attribute from a local GATT database. The type is a UUID, usually 16 or 128 bits
long.
6 uint8array type Variable length byte array. First byte is the length of the array.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_server_read_attribute_type(uint16 attribute);
/* Response id */
dumo_rsp_gatt_server_read_attribute_type_id
/* Response structure */
struct dumo_msg_gatt_server_read_attribute_type_rsp_t
{
uint16 result,
uint8array type
}
3.10.1.2 cmd_gatt_server_read_attribute_value
This command can be used to read the value of an attribute from a local GATT database.
6 uint8array value Variable length byte array. First byte is the length of the array.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_server_read_attribute_value(uint16 attribute, uint16 offset);
/* Response id */
dumo_rsp_gatt_server_read_attribute_value_id
/* Response structure */
struct dumo_msg_gatt_server_read_attribute_value_rsp_t
{
uint16 result,
uint8array value
}
3.10.1.3 cmd_gatt_server_send_characteristic_notification
This command can be used to send notifications or indications to a remote GATT client. Notification or indication is sent only if the client
has enabled them by setting the corresponding flag to the Client Characteristic Configuration descriptor. A new indication cannot be
sent before a confirmation from the GATT client is first received. The confirmation is indicated by gatt_server_characteristic_status
event.
4 uint8 connection Handle of the connection over which the notification or indication
is sent. Values:
• 0xff: Sends notification or indication to all connected devices.
• Other: Connection handle
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_server_send_characteristic_notification(uint8 connection, uint16 characteristic, uint8array
value);
/* Response id */
dumo_rsp_gatt_server_send_characteristic_notification_id
/* Response structure */
struct dumo_msg_gatt_server_send_characteristic_notification_rsp_t
{
uint16 result
}
3.10.1.4 cmd_gatt_server_send_user_read_response
This command must be used to send a response to a user_read_request event. The response needs to be sent within 30 second, oth-
erwise no more GATT transactions are allowed by the remote side. If attr_errorcode is set to 0 the characteristic value is sent to the
remote GATT client in the normal way. Other attr_errorcode values will cause the local GATT server to send an attribute protocol error
response instead of the actual data.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
8 uint8array value Characteristic value to send to the GATT client. Ignored if att_er-
rorcode is not 0.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_server_send_user_read_response(uint8 connection, uint16 characteristic, uint8 att_errorcode
, uint8array value);
/* Response id */
dumo_rsp_gatt_server_send_user_read_response_id
/* Response structure */
struct dumo_msg_gatt_server_send_user_read_response_rsp_t
{
uint16 result
}
3.10.1.5 cmd_gatt_server_send_user_write_response
This command must be used to send a response to a gatt_server_user_write_request event. The response needs to be sent within 30
seconds, otherwise no more GATT transactions are allowed by the remote side. If attr_errorcode is set to 0 the ATT protocol's write
response is sent to indicate to the remote GATT client that the write operation was processed successfully. Other values will cause the
local GATT server to send an ATT protocol error response.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
BGScript command
call gatt_server_send_user_write_response(connection,characteristic,att_errorcode)(result)
BGLIB C API
/* Function */
void dumo_cmd_gatt_server_send_user_write_response(uint8 connection, uint16 characteristic, uint8 att_errorcode
);
/* Response id */
dumo_rsp_gatt_server_send_user_write_response_id
/* Response structure */
struct dumo_msg_gatt_server_send_user_write_response_rsp_t
{
uint16 result
}
3.10.1.6 cmd_gatt_server_write_attribute_value
This command can be used to write the value of an attribute in the local GATT database. Writing the value of a characteristic of the
local GATT database will not trigger notifications or indications to the remote GATT client in case such characteristic has property of
indicate or notify and the client has enabled notification or indication. Notifications and indications are sent to the remote GATT client
using gatt_server_send_characteristic_notification command.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_gatt_server_write_attribute_value(uint16 attribute, uint16 offset, uint8array value);
/* Response id */
dumo_rsp_gatt_server_write_attribute_value_id
/* Response structure */
struct dumo_msg_gatt_server_write_attribute_value_rsp_t
{
uint16 result
}
3.10.2.1 evt_gatt_server_attribute_value
This event indicates that the value of an attribute in the local GATT database has been changed by a remote GATT client. Parameter
att_opcode describes which GATT procedure was used to change the value.
7 uint8 att_opcode Attribute opcode which informs the procedure from which attribute
the value was received
BGScript event
C Functions
/* Event id */
dumo_evt_gatt_server_attribute_value_id
/* Event structure */
struct dumo_msg_gatt_server_attribute_value_evt_t
{
uint8 connection,
uint16 attribute,
uint8 att_opcode,
uint16 offset,
uint8array value
}
3.10.2.2 evt_gatt_server_characteristic_status
This event indicates either that a local Client Characteristic Configuration descriptor has been changed by the remote GATT client, or
that a confirmation from the remote GATT client was received upon a successful reception of the indication. Confirmation by the remote
GATT client should be received within 30 seconds after an indication has been sent with the gatt_server_send_characteristic_notifica-
tion command, otherwise further GATT transactions over this connection are disabled by the stack.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
8-9 uint16 client_config_flags This field carries the new value of the Client Characteristic Config-
uration. If the status_flags is 0x2 (confirmation received), the val-
ue of this field can be ignored.
BGScript event
event gatt_server_characteristic_status(connection,characteristic,status_flags,client_config_flags)
C Functions
/* Event id */
dumo_evt_gatt_server_characteristic_status_id
/* Event structure */
struct dumo_msg_gatt_server_characteristic_status_evt_t
{
uint8 connection,
uint16 characteristic,
uint8 status_flags,
uint16 client_config_flags
}
3.10.2.3 evt_gatt_server_user_read_request
This event indicates that a remote GATT client is attempting to read a value of an attribute from the local GATT database, where the
attribute was defined in the GATT XML firmware configuration file to have type="user". Parameter att_opcode informs which GATT pro-
cedure was used to read the value. The application needs to respond to this request by using the gatt_server_send_user_read_re-
sponse command within 30 seconds, otherwise this GATT connection is dropped by remote side.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
7 uint8 att_opcode Attribute opcode which informs the procedure from which attribute
the value was received
BGScript event
event gatt_server_user_read_request(connection,characteristic,att_opcode,offset)
C Functions
/* Event id */
dumo_evt_gatt_server_user_read_request_id
/* Event structure */
struct dumo_msg_gatt_server_user_read_request_evt_t
{
uint8 connection,
uint16 characteristic,
uint8 att_opcode,
uint16 offset
}
3.10.2.4 evt_gatt_server_user_write_request
This event indicates that a remote GATT client is attempting to write a value of an attribute in to the local GATT database, where the
attribute was defined in the GATT XML firmware configuration file to have type="user". Parameter att_opcode informs which attribute
procedure was used to write the value. The application needs to respond to this request by using the gatt_server_send_user_write_re-
sponse command within 30 seconds, otherwise this GATT connection is dropped by the remote side.
5-6 uint16 characteristic GATT characteristic handle. This value is normally received from
the gatt_characteristic event
7 uint8 att_opcode Attribute opcode which informs the procedure from which attribute
the value was received
BGScript event
C Functions
/* Event id */
dumo_evt_gatt_server_user_write_request_id
/* Event structure */
struct dumo_msg_gatt_server_user_write_request_evt_t
{
uint8 connection,
uint16 characteristic,
uint8 att_opcode,
uint16 offset,
uint8array value
}
3.10.3.1 enum_gatt_server_characteristic_status_flag
These values describe whether characteristic client configuration was changed or whether a characteristic confirmation was received.
The commands and events in this class can be used to access and configure the system hardware and peripherals.
3.11.1.1 cmd_hardware_configure_gpio
This command can be used to configure the mode of an I/O port. After a boot, the module uses the default settings defined in hard-
ware.xml, and this command can used to override the default settings. Note that GPIO configurations set with this command do not
persist over a reset.
5-6 uint16 gpio Index of the GPIO pin on the port which this command affects.
BGScript command
call hardware_configure_gpio(port,gpio,mode,pullup)(result)
BGLIB C API
/* Function */
void dumo_cmd_hardware_configure_gpio(uint8 port, uint16 gpio, uint8 mode, uint8 pullup);
/* Response id */
dumo_rsp_hardware_configure_gpio_id
/* Response structure */
struct dumo_msg_hardware_configure_gpio_rsp_t
{
uint16 result
}
3.11.1.2 cmd_hardware_read_adc
This command can be used to read the specified channel of the A/D converter in the module. Note that the ADC channels must be
configured in the hardware.xml file, as described in the module Configuration Guide. Note that only channels 4 through 7 are
connected, Data read from channels 0 to 3 will be undefined. ADC value of 4095 corresponds to the input being at Vdd, value of which
can be obtained with read vdd command
BGScript command
call hardware_read_adc(input)(result,input,value)
BGLIB C API
/* Function */
void dumo_cmd_hardware_read_adc(uint8 input);
/* Response id */
dumo_rsp_hardware_read_adc_id
/* Response structure */
struct dumo_msg_hardware_read_adc_rsp_t
{
uint16 result,
uint8 input,
uint16 value
}
3.11.1.3 cmd_hardware_read_gpio
This command can be used to read the pins of the specified I/O-port of the module.
5-6 uint16 mask Bitmask of which pins on the port should be read
BGScript command
call hardware_read_gpio(port,mask)(result,data)
BGLIB C API
/* Function */
void dumo_cmd_hardware_read_gpio(uint8 port, uint16 mask);
/* Response id */
dumo_rsp_hardware_read_gpio_id
/* Response structure */
struct dumo_msg_hardware_read_gpio_rsp_t
{
uint16 result,
uint16 data
}
3.11.1.4 cmd_hardware_read_i2c
This command can be used to read from the specified I2C interface. The I2C interfaces must be configured in the hardware.xml file, as
described in the module Configuration Guide.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_hardware_read_i2c(uint8 channel, uint16 slave_address, uint8 length);
/* Response id */
dumo_rsp_hardware_read_i2c_id
/* Response structure */
struct dumo_msg_hardware_read_i2c_rsp_t
{
uint16 result,
uint8array data
}
3.11.1.5 cmd_hardware_read_junction_temperature
This command can be used to read the junction temperature of the module's MCU. Command is active only if the ADC is active. For
more information, see the Hardware Configuration Guide.
BGScript command
call hardware_read_junction_temperature()(result,value)
BGLIB C API
/* Function */
void dumo_cmd_hardware_read_junction_temperature();
/* Response id */
dumo_rsp_hardware_read_junction_temperature_id
/* Response structure */
struct dumo_msg_hardware_read_junction_temperature_rsp_t
{
uint16 result,
uint16 value
}
3.11.1.6 cmd_hardware_read_vdd
This command can be used to read the voltage level of the Vdd pin. This command is active only if the ADC is active. For more infor-
mation see the Hardware Configuration Guide.
BGScript command
call hardware_read_vdd()(result,value)
BGLIB C API
/* Function */
void dumo_cmd_hardware_read_vdd();
/* Response id */
dumo_rsp_hardware_read_vdd_id
/* Response structure */
struct dumo_msg_hardware_read_vdd_rsp_t
{
uint16 result,
uint16 value
}
3.11.1.7 cmd_hardware_read_write_spi
This command can be used to read from and write to the specified SPI interface. The SPI interfaces must be configured in the hard-
ware.xml file, as described in the module Configuration Guide.
5 uint8 cs_port Chip select pin port. Value range: 0 (A) or 1 (B)
8 uint8 read_length Amount of data to read and write. Note: SPI read and write are
synchronous and you will receive at least as many bytes as you
have written. If you reading more than writing then the writing will
be zero padded to match the length of the data to read.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_hardware_read_write_spi(uint8 channel, uint8 cs_port, uint8 cs_pin, uint8 cs_polarity, uint8 read
_length, uint8array data);
/* Response id */
dumo_rsp_hardware_read_write_spi_id
/* Response structure */
struct dumo_msg_hardware_read_write_spi_rsp_t
{
uint16 result,
uint8array data
}
3.11.1.8 cmd_hardware_set_soft_timer
This command can be used to start a software timer. Multiple concurrent timers can be running simultaneously. There are 256 unique
timer ID's available, but in practice the amount of concurrent timers is limited by the amount of free memory.
4-7 uint32 time Interval between how often to send events, in milliseconds. If time
is 0, removes the scheduled timer. The maximum value is
4294967295, which corresponds to about 49.7 days.
BGScript command
call hardware_set_soft_timer(time,timer_id,single_shot)(result)
BGLIB C API
/* Function */
void dumo_cmd_hardware_set_soft_timer(uint32 time, uint8 timer_id, uint8 single_shot);
/* Response id */
dumo_rsp_hardware_set_soft_timer_id
/* Response structure */
struct dumo_msg_hardware_set_soft_timer_rsp_t
{
uint16 result
}
Event Description
3.11.1.9 cmd_hardware_set_uart_configuration
This command can be used to reconfigure the UART interface. The new configuration will become effective after a 100 ms delay from
issuing the command. The response to the command will be sent before the 100 ms delay has elapsed using the original UART param-
eters. Any new configuration parameter is lost after reset and the firmware default parameters will be used again.
BGScript command
call hardware_set_uart_configuration(endpoint,rate,data_bits,stop_bits,parity,flow_ctrl)(result)
BGLIB C API
/* Function */
void dumo_cmd_hardware_set_uart_configuration(uint8 endpoint, uint32 rate, uint8 data_bits, uint8 stop_bits, ui
nt8 parity, uint8 flow_ctrl);
/* Response id */
dumo_rsp_hardware_set_uart_configuration_id
/* Response structure */
struct dumo_msg_hardware_set_uart_configuration_rsp_t
{
uint16 result
}
3.11.1.10 cmd_hardware_stop_i2c
BGScript command
call hardware_stop_i2c(channel)(result)
BGLIB C API
/* Function */
void dumo_cmd_hardware_stop_i2c(uint8 channel);
/* Response id */
dumo_rsp_hardware_stop_i2c_id
/* Response structure */
struct dumo_msg_hardware_stop_i2c_rsp_t
{
uint16 result
}
3.11.1.11 cmd_hardware_write_gpio
This command can be used to set the logic states of pins of the specified I/O-port using a bitmask.
5-6 uint16 mask Bitmask which determines the pins this command is used to set
7-8 uint16 data Bitmask of which pins to set high and which pins to set low (1 is
high, 0 is low)
BGScript command
call hardware_write_gpio(port,mask,data)(result)
BGLIB C API
/* Function */
void dumo_cmd_hardware_write_gpio(uint8 port, uint16 mask, uint16 data);
/* Response id */
dumo_rsp_hardware_write_gpio_id
/* Response structure */
struct dumo_msg_hardware_write_gpio_rsp_t
{
uint16 result
}
3.11.1.12 cmd_hardware_write_i2c
This command can be used to write data into I2C interface. The I2C interfaces must be configured in the hardware.xml file, as descri-
bed in the module Configuration Guide.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_hardware_write_i2c(uint8 channel, uint16 slave_address, uint8array data);
/* Response id */
dumo_rsp_hardware_write_i2c_id
/* Response structure */
struct dumo_msg_hardware_write_i2c_rsp_t
{
uint16 result
}
3.11.2.1 evt_hardware_interrupt
This event indicates that an external interrupt has occurred and provides a timestamp and a mask which indicates all triggered interrupt
channels.
BGScript event
event hardware_interrupt(interrupts,timestamp)
C Functions
/* Event id */
dumo_evt_hardware_interrupt_id
/* Event structure */
struct dumo_msg_hardware_interrupt_evt_t
{
uint16 interrupts,
uint32 timestamp
}
3.11.2.2 evt_hardware_soft_timer
BGScript event
event hardware_soft_timer(timer_id)
C Functions
/* Event id */
dumo_evt_hardware_soft_timer_id
/* Event structure */
struct dumo_msg_hardware_soft_timer_evt_t
{
uint8 timer_id
}
3.11.3.1 enum_hardware_cspolarity
2 hardware_opendrain Open drain (active low). Use when using external pullup
resistor.
3.11.3.2 enum_hardware_gpio_configuration
These values define whether the pin is used in pull-up, pull-down or in no pull-up and no pull-down mode.
1 hardware_gpio_pullup Pull-up
2 hardware_gpio_pulldown Pull-down
3.11.3.3 enum_hardware_gpio_mode
These values define whether the pin is used as an input, an output, as a function pin or as an analog signal pin.
0 hardware_gpio_input Input
1 hardware_gpio_output Output
2 hardware_gpio_function Function
3 hardware_gpio_analog Analog
3.11.3.4 enum_hardware_uartparity
These values define the parity bit configuration of the related UART connection.
0 hardware_none None
The commands and events in this class are related to Bluetooth Classic Identity Profile operations.
3.12.1.1 cmd_identity_local_identity
This command can be used to read Identity Profile information from the local device.
6-7 uint16 source The authority who has issued the Vendor ID. Values:
• 1: Bluetooth SIG
• 0x0002: USB IF
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_identity_local_identity();
/* Response id */
dumo_rsp_identity_local_identity_id
/* Response structure */
struct dumo_msg_identity_local_identity_rsp_t
{
uint16 result,
uint16 source,
uint16 vendor,
uint16 product,
uint16 version,
uint8array description
}
3.12.1.2 cmd_identity_modify_local_identity
This command can be used to modify some fields in the local identity profile.
BGScript command
call identity_modify_local_identity(vendor,product,version)(result)
BGLIB C API
/* Function */
void dumo_cmd_identity_modify_local_identity(uint16 vendor, uint16 product, uint16 version);
/* Response id */
dumo_rsp_identity_modify_local_identity_id
/* Response structure */
struct dumo_msg_identity_modify_local_identity_rsp_t
{
uint16 result
}
3.12.1.3 cmd_identity_remote_identity
This command can be used to read Identity Profile information from a remote Bluetooth Classic device.
BGScript command
call identity_remote_identity(address)(result)
BGLIB C API
/* Function */
void dumo_cmd_identity_remote_identity(bd_addr *address);
/* Response id */
dumo_rsp_identity_remote_identity_id
/* Response structure */
struct dumo_msg_identity_remote_identity_rsp_t
{
uint16 result
}
Event Description
identity_remote_identity This event indicates the reception of Identity Profile information from a remote Bluetooth
Classic device.
3.12.2.1 evt_identity_remote_identity
This event indicates the reception of Identity Profile information from a remote Bluetooth Classic device.
6-11 bd_addr address Bluetooth address of remote device in little endian format
12-13 uint16 source The authority who has issued the Vendor ID. Values:
• 1: Bluetooth SIG
• 0x0002: USB IF
14-15 uint16 vendor Vendor ID. A comprehensive list of Bluetooth SIG -assigned ID's
is at https://www.bluetooth.org/en-us/specification/assigned-num-
bers/company-identifiers
BGScript event
C Functions
/* Event id */
dumo_evt_identity_remote_identity_id
/* Event structure */
struct dumo_msg_identity_remote_identity_evt_t
{
uint16 status,
bd_addr *address,
uint16 source,
uint16 vendor,
uint16 product,
uint16 version,
uint8array description
}
The commands and events in this class are related to managing connection establishment, parameter setting, and disconnection proce-
dures.
3.13.1.1 cmd_le_connection_list
This command can be used to list all LE connections and check their parameters.
2 0x08 class Message class: Connection management for Bluetooth Low Ener-
gy
2 0x08 class Message class: Connection management for Bluetooth Low Ener-
gy
BGScript command
call le_connection_list()(result)
BGLIB C API
/* Function */
void dumo_cmd_le_connection_list();
/* Response id */
dumo_rsp_le_connection_list_id
/* Response structure */
struct dumo_msg_le_connection_list_rsp_t
{
uint16 result
}
Event Description
le_connection_parameters This event is triggered whenever the connection parameters are changed and at any
time a connection is established. The event is also generated by LE connection listing.
le_connection_list_complete This event indicates that all connections have been listed.
3.13.1.2 cmd_le_connection_set_parameters
This command can be used to request a change in the connection parameters of a Bluetooth LE connection.
2 0x08 class Message class: Connection management for Bluetooth Low Ener-
gy
5-6 uint16 min_interval Minimum value for the connection event interval. This must be set
be less than or equal to max_interval.
• Time = Value x 1.25 ms
• Range: 0x0006 to 0x0c80
• Time Range: 7.5 ms to 4 s
7-8 uint16 max_interval Maximum value for the connection event interval. This must be
set greater than or equal to min_interval.
• Time = Value x 1.25 ms
• Range: 0x0006 to 0x0c80
• Time Range: 7.5 ms to 4 s
9-10 uint16 latency Slave latency. This parameter defines how many connection inter-
vals the slave can skip if it has no data to send
• Range: 0x0000 to 0x01f4
Use 0x0000 for default value
11-12 uint16 timeout Supervision timeout. The supervision timeout defines for how long
the connection is maintained despite the devices being unable to
communicate at the currently configured connection intervals.
• Range: 0x000a to 0x0c80
• Time = Value x 10 ms
• Time Range: 100 ms to 32 s
• The minimum value must be at least maximum interval in ms *
(latency + 1) * 2
It is recommended that the supervision timeout is set at a value
which allows communication attempts over at least a few connec-
tion intervals.
2 0x08 class Message class: Connection management for Bluetooth Low Ener-
gy
BGScript command
call le_connection_set_parameters(connection,min_interval,max_interval,latency,timeout)(result)
BGLIB C API
/* Function */
void dumo_cmd_le_connection_set_parameters(uint8 connection, uint16 min_interval, uint16 max_interval, uint16 l
atency, uint16 timeout);
/* Response id */
dumo_rsp_le_connection_set_parameters_id
/* Response structure */
struct dumo_msg_le_connection_set_parameters_rsp_t
{
uint16 result
}
3.13.2.1 evt_le_connection_closed
2 0x08 class Message class: Connection management for Bluetooth Low Ener-
gy
BGScript event
event le_connection_closed(reason,connection)
C Functions
/* Event id */
dumo_evt_le_connection_closed_id
/* Event structure */
struct dumo_msg_le_connection_closed_evt_t
{
uint16 reason,
uint8 connection
}
3.13.2.2 evt_le_connection_list_complete
2 0x08 class Message class: Connection management for Bluetooth Low Ener-
gy
BGScript event
event le_connection_list_complete()
C Functions
/* Event id */
dumo_evt_le_connection_list_complete_id
/* Event structure */
struct dumo_msg_le_connection_list_complete_evt_t
{
}
3.13.2.3 evt_le_connection_opened
This event indicates that a new connection was opened, whether the devices are already bonded, and what is the role of the Bluetooth
module (Slave or Master). An open connection can be closed with the command endpoint_close by giving the connection handle ID
obtained from this event.
2 0x08 class Message class: Connection management for Bluetooth Low Ener-
gy
BGScript event
event le_connection_opened(address,address_type,master,connection,bonding)
C Functions
/* Event id */
dumo_evt_le_connection_opened_id
/* Event structure */
struct dumo_msg_le_connection_opened_evt_t
{
bd_addr *address,
uint8 address_type,
uint8 master,
uint8 connection,
uint8 bonding
}
3.13.2.4 evt_le_connection_parameters
This event is triggered whenever the connection parameters are changed and at any time a connection is established. The event is also
generated by LE connection listing.
2 0x08 class Message class: Connection management for Bluetooth Low Ener-
gy
BGScript event
event le_connection_parameters(connection,interval,latency,timeout,security_mode,address)
C Functions
/* Event id */
dumo_evt_le_connection_parameters_id
/* Event structure */
struct dumo_msg_le_connection_parameters_evt_t
{
uint8 connection,
uint16 interval,
uint16 latency,
uint16 timeout,
uint8 security_mode,
bd_addr *address
}
3.13.3.1 enum_le_connection_security
0 le_connection_mode1_level1 No security
The commands and events in this class are related to Generic Access Profile (GAP) in Bluetooth Low Energy (LE).
3.14.1.1 cmd_le_gap_discover
This command can be used to start the GAP discovery procedure to scan for advertising devices, that is to perform a device discovery.
Scanning parameters can be configured with the le_gap_set_scan_parameters command before issuing this command. To cancel an
ongoing discovery process use the le_gap_end_procedure command.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript command
call le_gap_discover(mode)(result)
BGLIB C API
/* Function */
void dumo_cmd_le_gap_discover(uint8 mode);
/* Response id */
dumo_rsp_le_gap_discover_id
/* Response structure */
struct dumo_msg_le_gap_discover_rsp_t
{
uint16 result
}
Event Description
le_gap_scan_response Every time an advertisement packet is received, this event is triggered. The packets are
not filtered in any way, so multiple events will be received for every advertising device in
range.
3.14.1.2 cmd_le_gap_end_procedure
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript command
call le_gap_end_procedure()(result)
BGLIB C API
/* Function */
void dumo_cmd_le_gap_end_procedure();
/* Response id */
dumo_rsp_le_gap_end_procedure_id
/* Response structure */
struct dumo_msg_le_gap_end_procedure_rsp_t
{
uint16 result
}
3.14.1.3 cmd_le_gap_open
This command can be used to open a Bluetooth LE connection. Scanning parameters can be configured with the le_gap_set_scan_pa-
rameters command before issuing this command. To cancel on an ongoing connection process use the endpoint_close command.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
6 uint8 connection Handle that will be assigned to the connection once the connec-
tion is established. This handle is valid only if the result code of
this response is 0 (zero).
BGScript command
call le_gap_open(address,address_type)(result,connection)
BGLIB C API
/* Function */
void dumo_cmd_le_gap_open(bd_addr *address, uint8 address_type);
/* Response id */
dumo_rsp_le_gap_open_id
/* Response structure */
struct dumo_msg_le_gap_open_rsp_t
{
uint16 result,
uint8 connection
}
Event Description
le_connection_opened This event is triggered after the connection has been opened, and indicates whether the
devices are already bonded and what is the role of the Bluetooth module (Slave or Mas-
ter).
3.14.1.4 cmd_le_gap_set_adv_data
This command can be used to set the data in advertisement packets or in the scan response packets. This data is used when advertis-
ing in user data mode. It is recommended to set both the advertisement data and scan response data at the same time.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
4 uint8 scan_rsp This value selects if the data is intended for advertisement pack-
ets or scan response packets. Values:
• 0: Advertisement packets
• 1: Scan response packets
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_le_gap_set_adv_data(uint8 scan_rsp, uint8array adv_data);
/* Response id */
dumo_rsp_le_gap_set_adv_data_id
/* Response structure */
struct dumo_msg_le_gap_set_adv_data_rsp_t
{
uint16 result
}
3.14.1.5 cmd_le_gap_set_adv_parameters
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
8 uint8 channel_map Advertisement channel map which determines which of the three
channels will be used for advertising. This value is given as a bit-
mask. Values:
• 1: Advertise on CH37
• 2: Advertise on CH38
• 3: Advertise on CH37 and CH38
• 4: Advertise on CH39
• 5: Advertise on CH37 and CH39
• 6: Advertise on CH38 and CH39
• 7: Advertise on all channels
• Recommended/default value: 7
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript command
call le_gap_set_adv_parameters(interval_min,interval_max,channel_map)(result)
BGLIB C API
/* Function */
void dumo_cmd_le_gap_set_adv_parameters(uint16 interval_min, uint16 interval_max, uint8 channel_map);
/* Response id */
dumo_rsp_le_gap_set_adv_parameters_id
/* Response structure */
struct dumo_msg_le_gap_set_adv_parameters_rsp_t
{
uint16 result
}
3.14.1.6 cmd_le_gap_set_conn_parameters
This command can be used to set the default Bluetooth LE connection parameters. The configured values are valid for all subsequent
connections that will be established. For changing the parameters of an already established connection use the command le_connec-
tion_set_parameters.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
4-5 uint16 min_interval Minimum value for the connection event interval. This must be set
be less than or equal to max_interval.
• Time = Value x 1.25 ms
• Range: 0x0006 to 0x0c80
• Time Range: 7.5 ms to 4 s
• default: 100
6-7 uint16 max_interval Maximum value for the connection event interval. This must be
set greater than or equal to min_interval.
• Time = Value x 1.25 ms
• Range: 0x0006 to 0x0c80
• Time Range: 7.5 ms to 4 s
• default: 200
8-9 uint16 latency Slave latency. This parameter defines how many connection inter-
vals the slave can skip if it has no data to send
• Range: 0x0000 to 0x01f4
Use 0x0000 for default value
10-11 uint16 timeout Supervision timeout. The supervision timeout defines for how long
the connection is maintained despite the devices being unable to
communicate at the currently configured connection intervals.
• Range: 0x000a to 0x0c80
• Time = Value x 10 ms
• Time Range: 100 ms to 32 s
• The minimum value must be at least maximum interval * (laten-
cy + 1)
• default: 100
It is recommended that the supervision timeout is set at a value
which allows communication attempts over at least a few connec-
tion intervals.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript command
call le_gap_set_conn_parameters(min_interval,max_interval,latency,timeout)(result)
BGLIB C API
/* Function */
void dumo_cmd_le_gap_set_conn_parameters(uint16 min_interval, uint16 max_interval, uint16 latency, uint16 timeo
ut);
/* Response id */
dumo_rsp_le_gap_set_conn_parameters_id
/* Response structure */
struct dumo_msg_le_gap_set_conn_parameters_rsp_t
{
uint16 result
}
3.14.1.7 cmd_le_gap_set_host_channel_classification
This command configures Bluetooth LE channel classifications. If successful, a bt_gap_host_channel_classification_complete event will
follow when the controller has completed the configuration.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
4 uint8array channel_map Channel bitmap for 37 channels. Mark known bad channels with a
zero bit, other channels with a one bit. The parameter must be
given as exactly 5 bytes; the 3 high bits are ignored.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_le_gap_set_host_channel_classification(uint8array channel_map);
/* Response id */
dumo_rsp_le_gap_set_host_channel_classification_id
/* Response structure */
struct dumo_msg_le_gap_set_host_channel_classification_rsp_t
{
uint16 result
}
3.14.1.8 cmd_le_gap_set_max_power
This command can be used to set the maximum TX power for Bluetooth LE.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript command
call le_gap_set_max_power(max_power)(result)
BGLIB C API
/* Function */
void dumo_cmd_le_gap_set_max_power(int8 max_power);
/* Response id */
dumo_rsp_le_gap_set_max_power_id
/* Response structure */
struct dumo_msg_le_gap_set_max_power_rsp_t
{
uint16 result
}
3.14.1.9 cmd_le_gap_set_mode
This command can be used to configure the current Bluetooth LE GAP Connectable and Discoverable modes. It can be used to enable
advertisements and/or allow incoming connections. To exit from this mode (to stop advertising and/or disallow incoming connections),
issue this command with the Not Discoverable / Not Connectable parameter values.Please note that to set module either discoverable
or connectable can only be done when module is non-connectable and non-discoverable
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript command
call le_gap_set_mode(discover,connect)(result)
BGLIB C API
/* Function */
void dumo_cmd_le_gap_set_mode(uint8 discover, uint8 connect);
/* Response id */
dumo_rsp_le_gap_set_mode_id
/* Response structure */
struct dumo_msg_le_gap_set_mode_rsp_t
{
uint16 result
}
3.14.1.10 cmd_le_gap_set_scan_parameters
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
4-5 uint16 scan_interval Scanner interval. This is defined as the time interval from when
the module started its last LE scan until it begins the subsequent
LE scan, that is how often to scan
• Time = Value x 0.625 ms
• Range: 0x0004 to 0x4000
• Time Range: 2.5 ms to 10.24 s
• Default: 0x0010 (10 ms)
6-7 uint16 scan_window Scan window. The duration of the LE scan. scan_window shall be
less than or equal to scan_interval
• Time = Value x 0.625 ms
• Range: 0x0004 to 0x4000
• Time Range: 2.5 ms to 10.24 s
• Default: 0x0010 (10 ms)
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript command
call le_gap_set_scan_parameters(scan_interval,scan_window,active)(result)
BGLIB C API
/* Function */
void dumo_cmd_le_gap_set_scan_parameters(uint16 scan_interval, uint16 scan_window, uint8 active);
/* Response id */
dumo_rsp_le_gap_set_scan_parameters_id
/* Response structure */
struct dumo_msg_le_gap_set_scan_parameters_rsp_t
{
uint16 result
}
3.14.1.11 cmd_le_gap_set_scan_result_filter
This command can be used to filter scan responses and advertisements by device name.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
4 uint8array name Beginning of the device name in the payload of the scan respon-
ses and advertisements must match this string for the
le_gap_scan_response to be generated. To turn off filtering send
length 0 array. By default and at boot filtering is disabled.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_le_gap_set_scan_result_filter(uint8array name);
/* Response id */
dumo_rsp_le_gap_set_scan_result_filter_id
/* Response structure */
struct dumo_msg_le_gap_set_scan_result_filter_rsp_t
{
uint16 result
}
3.14.2.1 evt_le_gap_host_channel_classification_complete
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
BGScript event
event le_gap_host_channel_classification_complete(status)
C Functions
/* Event id */
dumo_evt_le_gap_host_channel_classification_complete_id
/* Event structure */
struct dumo_msg_le_gap_host_channel_classification_complete_evt_t
{
uint16 status
}
3.14.2.2 evt_le_gap_scan_response
This event reports any advertisement or scan response packet that is received by the module's radio while in scanning mode.
2 0x03 class Message class: Generic Access Profile, Bluetooth Low Energy
13 uint8 bonding Bonding handle if the remote advertising device has previously
bonded with the local device. Values:
• 0xff: No bonding
• Other: Bonding handle
BGScript event
C Functions
/* Event id */
dumo_evt_le_gap_scan_response_id
/* Event structure */
struct dumo_msg_le_gap_scan_response_evt_t
{
int8 rssi,
uint8 packet_type,
bd_addr *address,
uint8 address_type,
uint8 bonding,
uint8array data
}
3.14.3.1 enum_le_gap_address_type
These values define the Bluetooth Address types used by the stack.
3.14.3.2 enum_le_gap_connectable_mode
3.14.3.3 enum_le_gap_discover_mode
These values indicate which Bluetooth LE discovery mode to use when scanning for advertising slaves.
3.14.3.4 enum_le_gap_discoverable_mode
These values define the available Discoverable Modes, which dictate how the module is visible to other devices.
These commands and events are related to the establishment of Bluetooth LE cable replacement connections. LE cable replacement
can be used to send and receive streaming data over LE connections. Please note that LE Cable Replacement commands are availa-
ble only in images compiled with LE Cable Replacement sdk
3.15.1.1 cmd_le_serial_listen
Listen for an incoming LE cable replacement connection. Creates an endpoint which will be set as active when an incoming connection
completes. Note that once the cable replacement connection is closed by the remote side, the endpoint is not usable anymore; it must
be cleaned up using endpoint_close command and listen must be called again to handle the next incoming connection. Also note that a
listening endpoint may be closed only when not yet connected or already disconnected by the remote. Only the side initiating the con-
nection may close the endpoint while it is connected.
4-5 uint16 characteristic Handle of the local characteristic used to transmit data
6 uint8 streaming_destina- Streaming destination endpoint for the connection. This should be
tion one of the fixed endpoints. If this argument is set to the invalid
endpoint handle (255), endpoint streaming will not be set up. In-
stead, bgscript can use endpoint_send command and end-
point_data event for sending and receiving data.
6 uint8 endpoint Endpoint ID assigned to the LE serial connection. Valid only if the
result code is zero. Endpoint will become active when connection
is ready.
BGScript command
call le_serial_listen(characteristic,streaming_destination)(result,endpoint)
BGLIB C API
/* Function */
void dumo_cmd_le_serial_listen(uint16 characteristic, uint8 streaming_destination);
/* Response id */
dumo_rsp_le_serial_listen_id
/* Response structure */
struct dumo_msg_le_serial_listen_rsp_t
{
uint16 result,
uint8 endpoint
}
Event Description
3.15.1.2 cmd_le_serial_open
Open an LE cable replacement connection endpoint to a remote device. The endpoint can be closed with the endpoint_close command
when done. If no ACL connection to the remote device exists, one is formed before the cable replacement connection handshake. Oth-
erwise the existing ACL connection will be used. Note that if the remote device requires encryption or authentication for communication,
ACL connection security must be set up before opening the LE cable replacement connection; see sm_increase_security command
4-9 bd_addr address Bluetooth address of the remote device in little endian format.
11 uint8 streaming_destina- Streaming destination for the connection endpoint. If this argu-
tion ment is set to the invalid endpoint handle (255), endpoint stream-
ing will not be set up. Instead, bgscript can use endpoint_send
command and endpoint_data event for sending and receiving da-
ta.
6 uint8 endpoint Endpoint ID assigned to the LE serial connection. Valid only if the
result code is zero. Endpoint will become active when connection
is ready.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_le_serial_open(bd_addr *address, uint8 address_type, uint8 streaming_destination, uint8array serv
ice);
/* Response id */
dumo_rsp_le_serial_open_id
/* Response structure */
struct dumo_msg_le_serial_open_rsp_t
{
uint16 result,
uint8 endpoint
}
Event Description
3.15.2.1 evt_le_serial_opened
BGScript event
event le_serial_opened(endpoint)
C Functions
/* Event id */
dumo_evt_le_serial_opened_id
/* Event structure */
struct dumo_msg_le_serial_opened_evt_t
{
uint8 endpoint
}
The commands and events in this class are used to manage Bluetooth security and include commands for starting and stopping en-
cryption and commands for managing bonding operations.
3.16.1 sm commands
3.16.1.1 cmd_sm_configure
This command can be used to configure authentication methods and I/O capabilities of the system.
BGScript command
call sm_configure(mitm_required,io_capabilities)(result)
BGLIB C API
/* Function */
void dumo_cmd_sm_configure(uint8 mitm_required, uint8 io_capabilities);
/* Response id */
dumo_rsp_sm_configure_id
/* Response structure */
struct dumo_msg_sm_configure_rsp_t
{
uint16 result
}
3.16.1.2 cmd_sm_delete_bonding
This command can be used to delete specified bonding information from Persistent Store.
BGScript command
call sm_delete_bonding(bonding)(result)
BGLIB C API
/* Function */
void dumo_cmd_sm_delete_bonding(uint8 bonding);
/* Response id */
dumo_rsp_sm_delete_bonding_id
/* Response structure */
struct dumo_msg_sm_delete_bonding_rsp_t
{
uint16 result
}
3.16.1.3 cmd_sm_delete_bondings
This command can be used to delete all bonding information from Persistent Store.
BGScript command
call sm_delete_bondings()(result)
BGLIB C API
/* Function */
void dumo_cmd_sm_delete_bondings();
/* Response id */
dumo_rsp_sm_delete_bondings_id
/* Response structure */
struct dumo_msg_sm_delete_bondings_rsp_t
{
uint16 result
}
3.16.1.4 cmd_sm_enter_passkey
This command can be used to enter a passkey after receiving a passkey request event.
BGScript command
call sm_enter_passkey(connection,passkey)(result)
BGLIB C API
/* Function */
void dumo_cmd_sm_enter_passkey(uint8 connection, uint32 passkey);
/* Response id */
dumo_rsp_sm_enter_passkey_id
/* Response structure */
struct dumo_msg_sm_enter_passkey_rsp_t
{
uint16 result
}
3.16.1.5 cmd_sm_enter_pin_code
This command can be used to enter a PIN code after receiving a PIN code request event.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_sm_enter_pin_code(bd_addr *address, uint8array pin_code);
/* Response id */
dumo_rsp_sm_enter_pin_code_id
/* Response structure */
struct dumo_msg_sm_enter_pin_code_rsp_t
{
uint16 result
}
3.16.1.6 cmd_sm_increase_security
This command can be used to enhance the security of a Bluetooth Classic or Bluetooth LE connection to current security requirements.
By default, connections opened by the module are not encrypted, unless the remote device requests it (most devices do). For Bluetooth
LE connections, this command initiates encryption, as there are only two levels of security: unencrypted and encrypted. If the devices
are bonded, the existing bonding will be used. If the devices are not bonded, a new key will be created; if bonding is enabled the key
will be stored for future use, if not the key will be discarded after the connection is closed. For Bluetooth Classic connections, in some
cases it's possible to first increase the security to encryption with a Just Works key, then increase it again by creating a MITM protected
key.
BGScript command
call sm_increase_security(connection)(result)
BGLIB C API
/* Function */
void dumo_cmd_sm_increase_security(uint8 connection);
/* Response id */
dumo_rsp_sm_increase_security_id
/* Response structure */
struct dumo_msg_sm_increase_security_rsp_t
{
uint16 result
}
3.16.1.7 cmd_sm_list_all_bondings
This command can be used to list all bondings stored in the bonding database. Bondings are reported by using the sm_list_bond-
ing_entry event for each bonding and the report is ended with sm_list_all_bondings_complete event. Recommended to be used only for
debugging purposes, because reading from the Persistent Store is relatively slow.
BGScript command
call sm_list_all_bondings()(result)
BGLIB C API
/* Function */
void dumo_cmd_sm_list_all_bondings();
/* Response id */
dumo_rsp_sm_list_all_bondings_id
/* Response structure */
struct dumo_msg_sm_list_all_bondings_rsp_t
{
uint16 result
}
Event Description
sm_list_bonding_entry This event is triggered by the command sm_list_all_bondings if bondings exist in the lo-
cal database.
3.16.1.8 cmd_sm_passkey_confirm
This command can be used for accepting or rejecting reported confirm value.
BGScript command
call sm_passkey_confirm(connection,confirm)(result)
BGLIB C API
/* Function */
void dumo_cmd_sm_passkey_confirm(uint8 connection, uint8 confirm);
/* Response id */
dumo_rsp_sm_passkey_confirm_id
/* Response structure */
struct dumo_msg_sm_passkey_confirm_rsp_t
{
uint16 result
}
3.16.1.9 cmd_sm_read_bonding
This command can be used to read the encryption key for a specific bonding. Used in debugging for reading encryption keys which can
be used e.g. for protocol sniffing.
6-11 bd_addr address Bluetooth address of the remote device this bonding entry refers
to
13 uint8array bonding_key Encryption key stored for this bonding entry. Maximum 16 bytes
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_sm_read_bonding(uint8 bonding);
/* Response id */
dumo_rsp_sm_read_bonding_id
/* Response structure */
struct dumo_msg_sm_read_bonding_rsp_t
{
uint16 result,
bd_addr *address,
uint8 address_type,
uint8array bonding_key
}
3.16.1.10 cmd_sm_read_bonding_configuration
This command can be used to read the maximum number of allowed bonding entries and to reveal the currently set bonding policy.
BGScript command
call sm_read_bonding_configuration()(max_bonding_count,policy_flags,result)
BGLIB C API
/* Function */
void dumo_cmd_sm_read_bonding_configuration();
/* Response id */
dumo_rsp_sm_read_bonding_configuration_id
/* Response structure */
struct dumo_msg_sm_read_bonding_configuration_rsp_t
{
uint8 max_bonding_count,
uint8 policy_flags,
uint16 result
}
3.16.1.11 cmd_sm_set_bondable_mode
This command can be used to set whether the device accepts new bondings or not.
BGScript command
call sm_set_bondable_mode(bondable)(result)
BGLIB C API
/* Function */
void dumo_cmd_sm_set_bondable_mode(uint8 bondable);
/* Response id */
dumo_rsp_sm_set_bondable_mode_id
/* Response structure */
struct dumo_msg_sm_set_bondable_mode_rsp_t
{
uint16 result
}
3.16.1.12 cmd_sm_set_oob_data
This command can be used to set the OOB data (out-of-band encryption data) for a device. The OOB data may be, for example, a PIN
code exchanged over an alternate path like NFC. The device will not allow any other kind of bonding if OOB data is set. This bonding
method is available only for LE bonding.
4 uint8array oob_data LE OOB data. To set OOB data, send a 16-byte array. To clear
OOB data, send a zero-length array.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_sm_set_oob_data(uint8array oob_data);
/* Response id */
dumo_rsp_sm_set_oob_data_id
/* Response structure */
struct dumo_msg_sm_set_oob_data_rsp_t
{
uint16 result
}
3.16.1.13 cmd_sm_store_bonding_configuration
This command can be used to set maximum allowed bonding count and bonding policy.
BGScript command
call sm_store_bonding_configuration(max_bonding_count,policy_flags)(result)
BGLIB C API
/* Function */
void dumo_cmd_sm_store_bonding_configuration(uint8 max_bonding_count, uint8 policy_flags);
/* Response id */
dumo_rsp_sm_store_bonding_configuration_id
/* Response structure */
struct dumo_msg_sm_store_bonding_configuration_rsp_t
{
uint16 result
}
3.16.2 sm events
3.16.2.1 evt_sm_bonded
This event is triggered after the pairing or bonding procedure has been successfully completed.
BGScript event
event sm_bonded(connection,bonding)
C Functions
/* Event id */
dumo_evt_sm_bonded_id
/* Event structure */
struct dumo_msg_sm_bonded_evt_t
{
uint8 connection,
uint8 bonding
}
3.16.2.2 evt_sm_bonding_failed
BGScript event
event sm_bonding_failed(connection,reason)
C Functions
/* Event id */
dumo_evt_sm_bonding_failed_id
/* Event structure */
struct dumo_msg_sm_bonding_failed_evt_t
{
uint8 connection,
uint16 reason
}
3.16.2.3 evt_sm_confirm_passkey
This event indicates a request to display the passkey to the user and for the user to confirm the displayed passkey. Use the command
sm_passkey_confirm to accept or reject the displayed passkey.
BGScript event
event sm_confirm_passkey(connection,passkey)
C Functions
/* Event id */
dumo_evt_sm_confirm_passkey_id
/* Event structure */
struct dumo_msg_sm_confirm_passkey_evt_t
{
uint8 connection,
uint32 passkey
}
3.16.2.4 evt_sm_list_all_bondings_complete
BGScript event
event sm_list_all_bondings_complete()
C Functions
/* Event id */
dumo_evt_sm_list_all_bondings_complete_id
/* Event structure */
struct dumo_msg_sm_list_all_bondings_complete_evt_t
{
}
3.16.2.5 evt_sm_list_bonding_entry
This event is triggered by the command sm_list_all_bondings if bondings exist in the local database.
BGScript event
event sm_list_bonding_entry(bonding,address,address_type)
C Functions
/* Event id */
dumo_evt_sm_list_bonding_entry_id
/* Event structure */
struct dumo_msg_sm_list_bonding_entry_evt_t
{
uint8 bonding,
bd_addr *address,
uint8 address_type
}
3.16.2.6 evt_sm_passkey_display
BGScript event
event sm_passkey_display(connection,passkey)
C Functions
/* Event id */
dumo_evt_sm_passkey_display_id
/* Event structure */
struct dumo_msg_sm_passkey_display_evt_t
{
uint8 connection,
uint32 passkey
}
3.16.2.7 evt_sm_passkey_request
This event indicates a request for the user to enter the passkey displayed on the remote device. Use the command sm_enter_passkey
to input the passkey value.
BGScript event
event sm_passkey_request(connection)
C Functions
/* Event id */
dumo_evt_sm_passkey_request_id
/* Event structure */
struct dumo_msg_sm_passkey_request_evt_t
{
uint8 connection
}
3.16.2.8 evt_sm_pin_code_request
This event indicates a request for the user to enter the PIN. Use the command sm_enter_pin_code to input the PIN code value. The
PIN code is used to create legacy pairing with old (v2.0 and before) Bluetooth devices.
BGScript event
event sm_pin_code_request(address)
C Functions
/* Event id */
dumo_evt_sm_pin_code_request_id
/* Event structure */
struct dumo_msg_sm_pin_code_request_evt_t
{
bd_addr *address
}
3.16.3 sm enumerations
3.16.3.1 enum_sm_io_capability
These values define the security management related I/O capabilities supported by the module
The commands and events in this class can be used to access and query the local device.
3.17.1.1 cmd_system_get_bt_address
This command can be used to read the Bluetooth address of the module.
4-9 bd_addr address Bluetooth Classic address and LE public address in little endian
format.
BGScript command
call system_get_bt_address()(address)
BGLIB C API
/* Function */
void dumo_cmd_system_get_bt_address();
/* Response id */
dumo_rsp_system_get_bt_address_id
/* Response structure */
struct dumo_msg_system_get_bt_address_rsp_t
{
bd_addr *address
}
3.17.1.2 cmd_system_get_class_of_device
This command can be used to read the device's Bluetooth Classic Class of Device (COD) information.
4-7 uint32 cod Class of Device. A comprehensive list of values can be found at
https://www.bluetooth.org/en-us/specification/assigned-numbers/
baseband
• Example:
• 0x001f00: Uncategorized device
BGScript command
call system_get_class_of_device()(cod,result)
BGLIB C API
/* Function */
void dumo_cmd_system_get_class_of_device();
/* Response id */
dumo_rsp_system_get_class_of_device_id
/* Response structure */
struct dumo_msg_system_get_class_of_device_rsp_t
{
uint32 cod,
uint16 result
}
3.17.1.3 cmd_system_get_local_name
This command can be used to read the Bluetooth Classic friendly name of the local device. Note that for Bluetooth LE the device name
is stored in the GAP Service of the GATT database.
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_system_get_local_name();
/* Response id */
dumo_rsp_system_get_local_name_id
/* Response structure */
struct dumo_msg_system_get_local_name_rsp_t
{
uint16 result,
uint8array name
}
3.17.1.4 cmd_system_hello
This command does not trigger any event but the response to the command is used to verify that communication between the host and
the module is working.
BGScript command
call system_hello()(result)
BGLIB C API
/* Function */
void dumo_cmd_system_hello();
/* Response id */
dumo_rsp_system_hello_id
/* Response structure */
struct dumo_msg_system_hello_rsp_t
{
uint16 result
}
3.17.1.5 cmd_system_reset
This command can be used to reset the system. It does not have a response, but it triggers one of the boot events (normal reset or boot
to DFU mode) depending on the selected boot mode.
BGScript command
call system_reset(dfu)
BGLIB C API
/* Function */
void dumo_cmd_system_reset(uint8 dfu);
Event Description
system_boot Sent after the device has booted into normal mode
dfu_boot Sent after the device has booted into DFU mode
3.17.1.6 cmd_system_reset_factory_settings
This command can be used to reset the module and clear all settings including bonding information. It also resets the friendly name to
its default value. The Apple iAP configuration and the persistent store are cleared. Note that the module's Bluetooth Classic / LE public
address is preserved.
BGScript command
call system_reset_factory_settings()(result)
BGLIB C API
/* Function */
void dumo_cmd_system_reset_factory_settings();
/* Response id */
dumo_rsp_system_reset_factory_settings_id
/* Response structure */
struct dumo_msg_system_reset_factory_settings_rsp_t
{
uint16 result
}
3.17.1.7 cmd_system_set_class_of_device
This command is used to set the Bluetooth Classic Class of Device (COD) setting.
4-7 uint32 cod Class of Device. A comprehensive list of values can be found at
https://www.bluetooth.org/en-us/specification/assigned-numbers/
baseband
• Example:
• 0x001f00: Uncategorized device
BGScript command
call system_set_class_of_device(cod)(result)
BGLIB C API
/* Function */
void dumo_cmd_system_set_class_of_device(uint32 cod);
/* Response id */
dumo_rsp_system_set_class_of_device_id
/* Response structure */
struct dumo_msg_system_set_class_of_device_rsp_t
{
uint16 result
}
3.17.1.8 cmd_system_set_local_name
This command can be used to set the local device's Bluetooth Classic friendly name. For Bluetooth LE the device name is stored in the
GAP Service local name parameter of the GATT database. If the device name attribute is not set as a constant in the project's GATT
configuration XML file, it can be changed with gatt_server_write_attribute_value. It is also possible to advertise with a different device
name by using le_gap_set_adv_data, but in that case if a remote device connects and asks for the device name over GATT, the value
will be different from the advertised value.
4 uint8array name Local device's Bluetooth Classic friendly name. Maximum name
length is 30 bytes
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_system_set_local_name(uint8array name);
/* Response id */
dumo_rsp_system_set_local_name_id
/* Response structure */
struct dumo_msg_system_set_local_name_rsp_t
{
uint16 result
}
3.17.1.9 cmd_system_set_max_power_mode
This command can be used to set the most efficient power saving state allowed for the system.
BGScript command
call system_set_max_power_mode(power_mode)(result)
BGLIB C API
/* Function */
void dumo_cmd_system_set_max_power_mode(uint8 power_mode);
/* Response id */
dumo_rsp_system_set_max_power_mode_id
/* Response structure */
struct dumo_msg_system_set_max_power_mode_rsp_t
{
uint16 result
}
3.17.2.1 evt_system_boot
This event indicates the device has started and is ready to receive commands that are not related to Bluetooth. When the Bluetooth
stack is ready, the event system_initialized is generated. This event carries the firmware build number and other SW and HW identifica-
tion codes.
BGScript event
event system_boot(major,minor,patch,build,bootloader,hw)
C Functions
/* Event id */
dumo_evt_system_boot_id
/* Event structure */
struct dumo_msg_system_boot_evt_t
{
uint16 major,
uint16 minor,
uint16 patch,
uint16 build,
uint16 bootloader,
uint16 hw
}
3.17.2.2 evt_system_initialized
This event indicates that all systems including the Bluetooth stack and radio are ready for use.
4-9 bd_addr address Bluetooth Classic address and LE public address in little endian
format.
BGScript event
event system_initialized(address)
C Functions
/* Event id */
dumo_evt_system_initialized_id
/* Event structure */
struct dumo_msg_system_initialized_evt_t
{
bd_addr *address
}
3.17.2.3 evt_system_recovery
This event indicates the device has encountered an error condition and has reset.
12 uint8array data
BGScript event
C Functions
/* Event id */
dumo_evt_system_recovery_id
/* Event structure */
struct dumo_msg_system_recovery_evt_t
{
uint32 id1,
uint32 id2,
uint8array data
}
3.17.2.4 evt_system_script_stopped
This event is generated when a event handler has been running more than 1 000 000 script intepreter steps (about 2 seconds).
BGScript event
event system_script_stopped(event_class,event_id)
C Functions
/* Event id */
dumo_evt_system_script_stopped_id
/* Event structure */
struct dumo_msg_system_script_stopped_evt_t
{
uint8 event_class,
uint8 event_id
}
The commands and events in this class can be used in production and RF development testing and as an aid in debugging.
3.18.1.1 cmd_test_device_under_test_mode
This command can used to set BT121 in "BT RF SIG mode" which is meant for connecting with a Bluetooth tester where the BT121 is
controlled over the LMP (Link Management Protocol). See Bluetooth Core Specification 4.1 Volume 2 Part E, chapter 7.6.3
BGScript command
call test_device_under_test_mode()(result)
BGLIB C API
/* Function */
void dumo_cmd_test_device_under_test_mode();
/* Response id */
dumo_rsp_test_device_under_test_mode_id
/* Response structure */
struct dumo_msg_test_device_under_test_mode_rsp_t
{
uint16 result
}
3.18.1.2 cmd_test_dtm_end
This command can be used to end the Bluetooth LE DTM (Direct Test Mode) mode.
BGScript command
call test_dtm_end()(result)
BGLIB C API
/* Function */
void dumo_cmd_test_dtm_end();
/* Response id */
dumo_rsp_test_dtm_end_id
/* Response structure */
struct dumo_msg_test_dtm_end_rsp_t
{
uint16 result
}
3.18.1.3 cmd_test_dtm_rx
This command can be used to start the Bluetooth LE DTM (Direct Test Mode) RX test.
BGScript command
call test_dtm_rx(channel)(result)
BGLIB C API
/* Function */
void dumo_cmd_test_dtm_rx(uint8 channel);
/* Response id */
dumo_rsp_test_dtm_rx_id
/* Response structure */
struct dumo_msg_test_dtm_rx_rsp_t
{
uint16 result
}
3.18.1.4 cmd_test_dtm_tx
This command can be used to start the Bluetooth LE Direct Test Mode TX test.
BGScript command
call test_dtm_tx(packet_type,length,channel)(result)
BGLIB C API
/* Function */
void dumo_cmd_test_dtm_tx(uint8 packet_type, uint8 length, uint8 channel);
/* Response id */
dumo_rsp_test_dtm_tx_id
/* Response structure */
struct dumo_msg_test_dtm_tx_rsp_t
{
uint16 result
}
3.18.1.5 cmd_test_packet_test
10 uint8 power TX power. Value range: 8-15, 8 is lowest, 15 is highest. See http://
processors.wiki.ti.com/index.php/
CC256x_VS_HCI_Commands#HCI_VS_DRPb_Set_Power_Vec-
tor_.280xFD82.29 for actual dBm values.
BGScript command
call test_packet_test(mode,tx_freq,rx_freq,acl_type,acl_len,power,disable_whitening)(result)
BGLIB C API
/* Function */
void dumo_cmd_test_packet_test(uint8 mode, uint8 tx_freq, uint8 rx_freq, uint8 acl_type, uint16 acl_len, uint8
power, uint8 disable_whitening);
/* Response id */
dumo_rsp_test_packet_test_id
/* Response structure */
struct dumo_msg_test_packet_test_rsp_t
{
uint16 result
}
3.18.1.6 cmd_test_rx_test
This command can be used to start the RX test mode with continuous reception.
BGScript command
call test_rx_test(channel)(result)
BGLIB C API
/* Function */
void dumo_cmd_test_rx_test(uint8 channel);
/* Response id */
dumo_rsp_test_rx_test_id
/* Response structure */
struct dumo_msg_test_rx_test_rsp_t
{
uint16 result
}
3.18.1.7 cmd_test_ssp_debug
This command can be used to enable or disable using a pre-defined Diffie-Hellman key pair for generating Bluetooth Classic Secure
Simple Pairing link keys. When the debug mode is enabled, a Bluetooth sniffer can decrypt the communication between two Bluetooth
devices using Secure Simple Pairing. It is sufficient that one party uses the debug mode - it is not necessary for both parties to use it.
BGScript command
call test_ssp_debug(enable)()
BGLIB C API
/* Function */
void dumo_cmd_test_ssp_debug(uint8 enable);
/* Response id */
dumo_rsp_test_ssp_debug_id
/* Response structure */
struct dumo_msg_test_ssp_debug_rsp_t
{
}
3.18.1.8 cmd_test_tx_test
This command can be used to start a continuous transmission TX test. For Continuous Wave modulation, the data is all zeros, for all
other modulations the data is PN15 pseudo-random noise.
BGScript command
call test_tx_test(modulation,channel,power)(result)
BGLIB C API
/* Function */
void dumo_cmd_test_tx_test(uint8 modulation, uint8 channel, uint8 power);
/* Response id */
dumo_rsp_test_tx_test_id
/* Response structure */
struct dumo_msg_test_tx_test_rsp_t
{
uint16 result
}
3.18.2.1 evt_test_dtm_completed
This event indicates that a Bluetooth LE DTM (Direct Test Mode) command has completed.
6-7 uint16 number_of_packets Number of packets received, only valid for test_dtm_end com-
mand
BGScript event
event test_dtm_completed(result,number_of_packets)
C Functions
/* Event id */
dumo_evt_test_dtm_completed_id
/* Event structure */
struct dumo_msg_test_dtm_completed_evt_t
{
uint16 result,
uint16 number_of_packets
}
3.18.3.1 enum_test_packet_type
The commands and events in this class can be used to simplify BGScript based application development and are typically not used in
any other applications.
3.19.1.1 cmd_util_atoi
4-7 int32 value Conversion result presenting the decimal value input as a string
as a 32-bit signed integer value
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_util_atoi(uint8array string);
/* Response id */
dumo_rsp_util_atoi_id
/* Response structure */
struct dumo_msg_util_atoi_rsp_t
{
int32 value
}
3.19.1.2 cmd_util_itoa
This command can be used to convert a 32-bit signed integer value into a decimal value represented as a string.
4 uint8array string Conversion result presenting the 32-bit signed integer value input
as a decimal value presented by a string
BGScript command
BGLIB C API
/* Function */
void dumo_cmd_util_itoa(int32 value);
/* Response id */
dumo_rsp_util_itoa_id
/* Response structure */
struct dumo_msg_util_itoa_rsp_t
{
uint8array string
}
0x0188 user_attribute User attribute was accessed through API which is not
supported
0x0192 server_already_in_use A server for the specified type of connection (SPP, HID,
or L2CAP with specific PSM) was already started. Only
one SPP server per SDP entry is supported; only one
HID server altogether is supported; only one L2CAP
sever per PSM is supported.
0x0194 invalid_endpoint The endpoint exists, but it does not support the BGAPI
command executed.
0x0195 invalid_endpoint_state The endpoint could not execute the command in its cur-
rent state.
■ SDP errors
0x0301 passkey_entry_failed The user input of passkey failed, for example, the user
cancelled the operation
0x0304 confirm_value_failed The confirm value does not match the calculated com-
pare value
0x0306 encryption_key_size The resultant encryption key size is insufficient for the
security requirements of this device
0x030a invalid_parameters The Invalid Parameters error code indicates: the com-
mand length is invalid or a parameter is outside of the
specified range.
■ Bluetooth errors
0x0202 unknown_connection_identifier A command was sent from the Host that should identify
a connection, but that connection does not exist.
0x0204 page_timeout The Page Timeout error code indicates that a page
timed out because of the Page Timeout configuration
parameter.
0x020b acl_connection_already_exists The ACL Connection Already Exists error code indicates
that an attempt to create a new ACL Connection to a de-
vice when there is already a connection to this device.
0x020f connection_rejected_due_to_unacceptable_bd_addr The Connection was rejected because this device does
not accept the BD_ADDR. This may be because the de-
vice will only accept connections from specific
BD_ADDRs.
0x0210 connection_accept_timeout_exceeded The Connection Accept Timeout has been exceeded for
this connection attempt.
0x0218 pairing_not_allowed The device does not allow pairing. This can be for ex-
ample, when a device only allows pairing during a cer-
tain time window after some user input allows pairing
0x021a unsupported_remote_feature The remote device does not support the feature associ-
ated with the issued command or LMP PDU.
0x021e invalid_lmp_parameters Some LMP PDU / LL Control PDU parameters were in-
valid.
0x0221 role_change_not_allowed Controller will not allow a role change at this time.
0x0223 lmp_error_transaction_collision LMP transaction has collided with the same transaction
that is already in progress.
0x0224 lmp_pdu_not_allowed Controller sent an LMP PDU with an OpCode that was
not allowed.
0x0226 link_key_cannot_be_changed Link key cannot be changed because a fixed unit key is
being used.
0x0229 pairing_with_unit_key_not_supported It was not possible to pair as a unit key was requested
and it is not supported.
0x022a different_transaction_collision LMP transaction was started that collides with an ongo-
ing transaction.
0x022f insufficient_security The HCI command or LMP PDU sent is only possible on
an encrypted link.
0x0232 role_switch_pending Role Switch is pending. This can be used when an HCI
command or LMP PDU cannot be accepted because of
a pending role switch. This can also be used to notify a
peer device about a pending role switch.
0x0235 role_switch_failed role switch was attempted but it failed and the original
piconet structure is restored. The switch may have failed
because the TDD switch or piconet switch failed.
0x0236 extended_inquiry_response_too_large The extended inquiry response, with the requested re-
quirements for FEC, is too large to fit in any of the pack-
et types supported by the Controller.
0x0238 host_busy_pairing The Host is busy with another pairing operation and un-
able to support the requested pairing. The receiving de-
vice should retry pairing again later.
0x023f mac_connection_failed The MAC of the 802.11 AMP was requested to connect
to a peer, but the connection failed.
0x0240 coarse_clock_adjustment_rejected_but_will_try_to_ad- The master, at this time, is unable to make a coarse ad-
just_using_clock_dragging justment to the piconet clock, using the supplied param-
eters. Instead the master will attempt to move the clock
using clock dragging.
0x0241 refused_psm_not_supported The remote end did not have a service that would ac-
cept L2CAP connection requests to the specified PSM.
0x0242 refused_security_block The L2CAP connection attempt was blocked by the re-
mote end due to security reasons.
0x0243 refused_no_resources The remote end rejected the L2CAP connection due to
lack of resources.
0x0244 acl_disconnected The ACL carrying the L2CAP link was disconnected.
■ Application errors
0x0401 invalid_handle The attribute handle given was not valid on this server
0x0406 request_not_supported Attribute Server does not support the request received
from the client.
0x0407 invalid_offset Offset specified was past the end of the attribute
0x040b att_not_long The attribute cannot be read or written using the Read
Blob Request
0x040c insufficient_enc_key_size The Encryption Key Size used for encrypting this link is
insufficient.
0x040d invalid_att_length The attribute value length is invalid for the operation
0x040e unlikely_error The attribute request that was requested has encoun-
tered an error that was unlikely, and therefore could not
be completed as requested.
■ Filesystem errors