Control API

This section describes the communication protocol between the control system and the BTI

The BTI Configurator does use the same protocol, see its debug window for more information

Caution

Please use >80ms between each command sent

Connection TCP (NGTC-BTI is server), Port 20108
Command Format AT+ Command {=Param1{, Param2{, Param3…}}}<CR><LF>
Reply Format <CR><LF>+reply {=Param1{, Param2{, Param3…}}} <CR><LF>

<CR> stands for “carriage return”, corresponding hex is 0x0D
<LF> stands for “line feed”, corresponding hex is 0x0A

Notice

Command Format Details

All commands start with “AT”, end with <CR><LF>
If a command has a parameter, the parameter is behind the “=”
If a command has multiple parameters, the parameters must be separated by “,”

Notice

Reply Format Details

All replies start with <CR><LF> and end with <CR><LF>
If a reply has a parameter, the parameter is behind the “=”
If a reply has multiple parameters, the parameters must be separated by “,”
The interface will always report the execution result using “OK” for success or “ERROR” for failure

Examples

Read BTI’s Bluetooth name

Communication Command Parameter Example
Request AT+NAME<CR><LF>
AT+NAME<CR><LF>
Reply #1 <CR><LF>+NAME=NGTC-BTI<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Set BTI’s Bluetooth name

Communication Command Parameter Example
Request AT+NAME=Parameter<CR><LF>
NGTC-BTI
AT+NAME=NGTC-BTI<CR><LF>
Reply <CR><LF>OK<CR><LF>

Subsections of Control API

General

Request firmware version

Communication Command Parameter Example
Request AT+VER<CR><LF>
AT+VER<CR><LF>
Reply #1 <CR><LF>>+VER=20171125,NGTC-BTI<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Bluetooth General

Request Bluetooth MAC address

Communication Command Parameter Example
Request AT+ADDR<CR><LF>
AT+ADDR<CR><LF>
Reply #1 <CR><LF>>+ADDR=DC0D30123456<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Request Bluetooth name

Communication Command Parameter Example
Request AT+NAME<CR><LF>
AT+NAME<CR><LF>
Reply #1 <CR><LF>+NAME=NGTC-BTI<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Set Bluetooth name

Communication Command Parameter Example
Request AT+NAME=Parameter<CR><LF>
NGTC-BTI
AT+NAME=NGTC-BTI<CR><LF>
Reply <CR><LF>OK<CR><LF>

Release all Bluetooth connections

Communication Command Parameter Example
Request AT+DSCA<CR><LF>
AT+DSCA<CR><LF>
Reply <CR><LF>OK<CR><LF>

Release all Bluetooth connections and reboot

Communication Command Parameter Example
Request AT+REBOOT<CR><LF>
AT+REBOOT<CR><LF>
Reply <CR><LF>OK<CR><LF>

Set Bluetooth discoverability and connection

  • Undiscoverable = disconnect all devices connected and set’s the NGTC-BTI into an unconnectable and undiscoverable mode
Communication Command Parameter Example
Request AT+BTEN=Parameter<CR><LF>
0: Undiscoverable
1: operational
AT+BTEN=1<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request Bluetooth discoverability and connection

Communication Command Parameter Example
Request AT+BTEN<CR><LF>
AT+BTEN<CR><LF>
Reply #1 <CR><LF>+BTEN=1<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Request operation status

Notice

Status parameter will be reported in bit representation

Communication Command Parameter Example
Request AT+DEVSTAT<CR><LF>
BIT[0]: PWR OFF; 1: PWR ON
BIT[1]: Non Discoverable; 1: Discoverable
BIT[2]: Non Advertising; 1: Advertising
BIT[3]: Non Scanning; 1: Scanning
AT+DEVSTAT<CR><LF>
Reply #1 <CR><LF>+DEVSTAT=9<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Set auto connect

Caution

This command needs a reboot to activate

  • The NGTC-BTI will attempt to reconnect last device after power on
Communication Command Parameter Example
Request AT+AUTOCONN=Parameter<CR><LF>
0: Off
1: 15 Attempts
AT+AUTOCONN=0<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request auto connect

Communication Command Parameter Example
Request AT+AUTOCONN<CR><LF>
AT+AUTOCONN<CR><LF>
Reply #1 <CR><LF>+AUTOCONN=1<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Restore all Bluetooth parameters to factory default

Caution

BTI module needs to be power cycled afterwards

Communication Command Parameter Example
Request AT+RESTORE<CR><LF>
AT+RESTORE<CR><LF>
Reply <CR><LF>OK<CR><LF>

Bluetooth Audio

Set volume of connected Bluetooth device

Caution

Please watch the volume carefully There is no real standard for the source volume.
If you all the way to 15, you may overload the interface and it will result in distortion

Communication Command Parameter Example
Request AT+SPKVOL=Parameter<CR><LF>
+: UP
-: DOWN
AT+SPKVOL=+<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request volume of connected Bluetooth device

Communication Command Parameter Example
Request AT+SPKVOL<CR><LF>
AT+SPKVOL<CR><LF>
Reply #1 <CR><LF>+SPKVOL=10<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Operation Mode

Set operation mode

Caution

BTI module will reboot and all device profiles will be deleted

  • Set’s the NGTC-BTI to sink(stream from device to BTI or source) or source(stream from BTI to headphone)
Communication Command Parameter Example
Request AT+A2DPROLE=Parameter<CR><LF>
0: Sink
1: Source
AT+A2DPROLE=0<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request operation mode

Communication Command Parameter Example
Request AT+A2DPROLE<CR><LF>
AT+A2DPROLE<CR><LF>
Reply #1 <CR><LF>+A2DPROLE=1<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Sink Mode

Caution

To use the commands below the BTI needs to be switched to sink mode first

Set pairing active/inactive

Communication Command Parameter Example
Request AT+PAIR=Parameter<CR><LF>
0: Off
1: On
AT+PAIR=1<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request pairing active/inactive status

Communication Command Parameter Example
Request AT+PAIR<CR><LF>
AT+PAIR<CR><LF>
Reply #1 <CR><LF>+PAIR=1<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Activate simple/secure pairing

Communication Command Parameter Example
Request AT+SSP=Parameter<CR><LF>
0: Off
1: On
AT+SSP=1<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request simple/secure pairing status

Communication Command Parameter Example
Request AT+SSP<CR><LF>
AT+SSP<CR><LF>
Reply #1 <CR><LF>+SSP=0<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Set BTI’s pin code

Communication Command Parameter Example
Request AT+PIN=Parameter<CR><LF>
4-15 ASCII numbers
AT+PIN=1234<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request BTI’s pin code

Communication Command Parameter Example
Request AT+PIN<CR><LF>
AT+PIN<CR><LF>
Reply #1 <CR><LF>+PIN=1234<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Clear a paired record

Caution

If the device (headphone/speaker) is deleted in the BTI it needs to be reconnected to work

Communication Command Parameter Example
Request AT+PLIST=Parameter<CR><LF>
0: Clear list
x: Clear index (x)
AT+PLIST=E<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request paired records

Communication Command Parameter Example
Request AT+PLIST<CR><LF>
AT+PLIST<CR><LF>
Reply #1 <CR><LF>+PLIST=1,123456ABCDEF <CR><LF>
<CR><LF>+PLIST=1,ABCDEF123456 <CR><LF>
<CR><LF>+PLIST=E <CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Reconnect to Bluetooth device

Communication Command Parameter Example
Request AT+A2DPCONN=Parameter<CR><LF>
No parameter: To last device
MAC: Mac of target device (12 Bytes ASCII)
AT+A2DPCONN=123456ABCEDF<CR><LF>
Reply #1 <CR><LF>+A2DPCONN=123456ABCEDF<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Release Bluetooth connection to device

Communication Command Parameter Example
Request AT+A2DPDISC<CR><LF>
AT+A2DPDISC<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request status of connected device

Communication Command Parameter Example
Request AT+A2DPSTAT<CR><LF>
AT+A2DPSTAT<CR><LF>
Reply #1 <CR><LF>+A2DPSTAT=4<CR><LF>
0: Unsupported
1: Standby
2: Connecting
3: Connected
4: Streaming
Reply #2 <CR><LF>OK<CR><LF>

Nofification address of connected device

Notice

Event at device connection only, cannot be requested by control system

Communication Command Parameter Example
Reply #1 <CR><LF>+A2DPDEV=123456ABCDEF <CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Request codex used by the connected device

Communication Command Parameter Example
Request AT+A2DPDEC<CR><LF>
AT+A2DPDEC<CR><LF>
Reply #1 <CR><LF>+A2DPDEC=1<CR><LF>
0: Invalid
1: SBC
2: MP3
3: AAC
4: FASTSTREAM
5: APTX
6: APTX-Sprint
7: APTX-HD
8: APTX-LL
Reply #2 <CR><LF>OK<CR><LF>

Set ID track feedback

Caution

This command needs a reboot to activate

  • Parameter: Default is 11, Base 10 representation of a bit
Communication Command Parameter Example
Request AT+AVRCPCFG<CR><LF>
BIT[0]: Auto get rack ID3 information (title, artist, album) on track changed (default 1)
BIT[1-3]: Auto get track state (play progress) if value >0 (default 5sec)
AT+AVRCPCFG=11<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request status of connected device

Communication Command Parameter Example
Request AT+AVRCPSTAT<CR><LF>
AT+AVRCPSTAT<CR><LF>
Reply #1 <CR><LF>+AVRCPSTAT=4<CR><LF>
0: Unsupported
1: Standby
2: Connecting
3: Connected
Reply #2 <CR><LF>OK<CR><LF>

Nofification Mediaplayer play progress

Notice

Event at device connection only, cannot be requested by control system

Communication Command Parameter Example
Param1: (0-4) Media Player State – please see PLAYSTAT parameters
Param2:(Decimal ASCII), Elapsed time of current track in ms
Param3:(Decimal ASCII), Total time of track in ms
Reply #1 <CR><LF>+TRACKSTAT=1,142000,248000 <CR><LF>

Nofification Mediaplayer track info

Notice

Event at device connection only, cannot be requested by control system

Communication Command Parameter Example
Param1: Title
Param2: Artist
Param3: Album
Reply #1 <CR><LF>+TRACKINFO=Creep<FF>Radiohead<FF>Pablo Honey <CR><LF>

Nofification Mediaplayer status of the connected device

Notice

Event at device connection only, cannot be requested by control system

Communication Command Parameter Example
0: Stopped
1: Playing
2: Paused
3: Fast Forward
4: Fast Rewind
Reply #1 <CR><LF>+PLAYSTAT=1<CR><LF>

Transport Play/Pause

Communication Command Parameter Example
Request AT+PLAYPAUSE<CR><LF>
AT+PLAYPAUSE<CR><LF>
Reply <CR><LF>OK<CR><LF>

Transport Play

Communication Command Parameter Example
Request AT+PLAY<CR><LF>
AT+PLAY<CR><LF>
Reply <CR><LF>OK<CR><LF>

Transport Pause

Communication Command Parameter Example
Request AT+PAUSE<CR><LF>
AT+PAUSE<CR><LF>
Reply <CR><LF>OK<CR><LF>

Transport Stop

Communication Command Parameter Example
Request AT+STOP<CR><LF>
AT+STOP<CR><LF>
Reply <CR><LF>OK<CR><LF>

Transport Track Forward

Communication Command Parameter Example
Request AT+FORWARD<CR><LF>
AT+FORWARD<CR><LF>
Reply <CR><LF>OK<CR><LF>

Transport Track Backward

Communication Command Parameter Example
Request AT+BACKWARD<CR><LF>
AT+BACKWARD<CR><LF>
Reply <CR><LF>OK<CR><LF>

Source Mode

Caution

To use the commands below the BTI needs to be switched to source mode first

Set autoscan

Communication Command Parameter Example
Request AT+INQCFG=Parameter<CR><LF>
0: Off
1: On
AT+INQCFG=1<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request autoscan status

Communication Command Parameter Example
Request AT+INQCFG<CR><LF>
AT+INQCFG<CR><LF>
Reply #1 <CR><LF>+INQCFG=10<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Clear a paired record

Caution

If the device (headphone/speaker) is deleted in the BTI it needs to be reconnected to work

Communication Command Parameter Example
Request AT+PLIST=Parameter<CR><LF>
0: Clear list
x: Clear index (x)
AT+PLIST=E<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request paired records

Communication Command Parameter Example
Request AT+PLIST<CR><LF>
AT+PLIST<CR><LF>
Reply #1 <CR><LF>+PLIST=1,123456ABCDEF <CR><LF>
<CR><LF>+PLIST=1,ABCDEF123456 <CR><LF>
<CR><LF>+PLIST=E <CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Reconnect to Bluetooth device

Communication Command Parameter Example
Request AT+A2DPCONN=Parameter<CR><LF>
No parameter: To last device
MAC: Mac of target device (12 Bytes ASCII)
AT+A2DPCONN=123456ABCEDF<CR><LF>
Reply #1 <CR><LF>+A2DPCONN=123456ABCEDF<CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Release Bluetooth connection to device

Communication Command Parameter Example
Request AT+A2DPDISC<CR><LF>
AT+A2DPDISC<CR><LF>
Reply <CR><LF>OK<CR><LF>

Request status of connected device

Communication Command Parameter Example
Request AT+A2DPSTAT<CR><LF>
AT+A2DPSTAT<CR><LF>
Reply #1 <CR><LF>+A2DPSTAT=4<CR><LF>
0: Unsupported
1: Standby
2: Connecting
3: Connected
4: Streaming
Reply #2 <CR><LF>OK<CR><LF>

Nofification address of connected device

Notice

Event at device connection only, cannot be requested by control system

Communication Command Parameter Example
Reply #1 <CR><LF>+A2DPDEV=123456ABCDEF <CR><LF>
Reply #2 <CR><LF>OK<CR><LF>

Request codex used by the connected device

Communication Command Parameter Example
Request AT+A2DPDEC<CR><LF>
AT+A2DPDEC<CR><LF>
Reply #1 <CR><LF>+A2DPDEC=1<CR><LF>
1: SBC
5: APTX
6: APTX-LL
Reply #2 <CR><LF>OK<CR><LF>