Command Write Configure - Control Bluetooth Classic and Bluetooth BLE on ESPrtk
‘T’ | ‘B’ | PL2 | Control Bluetooth Classic and Bluetooth BLE on ESPrtk | 8 |
| ‘0’ | B_Start_Bluetooth |
| |
‘1’ | B_Check_Client_Connected |
| ||
‘2’ | B_Send_String |
| ||
‘3’ | B_Send_Binary |
| ||
‘4’ | B_Available |
| ||
‘5’ | B_Read_String |
| ||
‘6’ | B_Read_Binary |
| ||
‘7’ | B_Clear_Buffer |
|
HOST send Control B_Start_Bluetooth
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘B’ | ‘0’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘0’ |
| ID Control : B_Start_Bluetooth |
| |||||
| PL3 | INTEGER | 0 | 1 | - | - | Type Bluetooth |
| |
0 | Start Bluetooth Classic | ||||||||
1 | Start Bluetooth Low Energy ( BLE ) | ||||||||
| PL4 | STRING | - | - | 1 | 100 | Name of ESPrtk Bluetooth |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘0’ |
| ID Control : B_Start_Bluetooth |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error: Bluetooth start Failed | ||||||||
1 | OK : Bluetooth Started success | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | ||
HOST Send | Start Bluetooth Classic | $ESP_OK|22|T|B|0|0|my_BLT_device|*216B |
Start Bluetooth BLE | $ESP_OK|22|T|B|0|1|my_BLE_device|*317A | |
ACK Respond | $ESP_OK|62|T|B|0|1|Bluetooth Classic Started success,Name: my_BLT_device|*2525 $ESP_OK|58|T|B|0|1|Bluetooth BLE Started success,Name: my_BLE_device|*320D | |
NACK Respond |
| |
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control B_Check_Client_Connected
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘B’ | ‘1’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘1’ | STRING | - | - | 1 | 1 | ID Control : B_Check_Client_Connected |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘1’ |
| ID Control : B_Check_Client_Connected |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | No Bluetooth client connect to ESPrtk | ||||||||
1 | Has Bluetooth client connected to ESPrtk | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|6|T|B|1|*7026 |
ACK Respond | $ESP_OK|32|T|B|1|0|Bluetooth-No connection|*1B57 $ESP_OK|36|T|B|1|1|Bluetooth Connected success|*1804 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control B_Send_String
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘B’ | ‘2’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘2’ |
| ID Control : B_Send_String |
| ||||
| PL3 | STRING | - | - | 1 | 1500 | Data send in string format |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘2’ |
| ID Control : B_Send_String |
| |||||
| PL3 | INTEGER | -1 | 2 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error : No Bluetooth client connect to ESPrtk or Bluetooth was not started yet. | ||||||||
1 | Error: Busy TX is sending | ||||||||
2 | OK: Send String success | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|38|T|B|2|Hello Bluetooth.\r\n I'm ESPrtk|*1C44 |
ACK Respond | $ESP_OK|38|T|B|2|2|Bluetooth Send String success|*604D |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control B_Send_Binary
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘B’ | ‘3’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘3’ |
| ID Control : B_Send_Binary |
| ||||
| PL3 | HEX | - | - | 2 | 1400 | Data send in string format |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘3’ |
| ID Control : B_Send_Binary |
| |||||
| PL3 | INTEGER | -1 | 2 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error : No Bluetooth client connect to ESPrtk or Bluetooth was not started yet. | ||||||||
1 | Error: Busy TX is sending | ||||||||
2 | OK: Send Binary success | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|67|T|B|3|48656c6c6f20426c7565746f6f74682e0D0a49276d2045535072746b0D0a|*6749 |
ACK Respond | $ESP_OK|38|T|B|3|2|Bluetooth Send Binary success|*7B5C |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control B_Available
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘B’ | ‘4’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘4’ | STRING | - | - | 1 | 1 | ID Control : B_Available |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘4’ |
| ID Control : B_Available |
| |||||
| PL3 | INTEGER | -1 | 1000 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
[0,1000] | Size available RX buffer Bluetooth |
Example
Message : | |
HOST Send | $ESP_OK|6|T|B|4|*7526 |
ACK Respond | $ESP_OK|9|T|B|4|31|*0413 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control B_Read_String
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘B’ | ‘5’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘5’ |
| ID Control : B_Read_String |
| ||||
| PL3 | INTEGER | 1 | 1000 | - | - | Size read buffer Bluetooth |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘5’ |
| ID Control : B_Read_String |
| |||||
| PL3 | INTEGER | -1 | 1000 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
[0,1000] | Size of string respond | ||||||||
| PL4 | STRING | - | - | 0 | 1000 | Data read buffer in String format |
|
Example
Message : | |
HOST Send | $ESP_OK|10|T|B|5|100|*0E3A |
ACK Respond | $ESP_OK|40|T|B|5|31|Hi ESPrtk, Im mobile device. |*705B |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control B_Read_Binary
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘B’ | ‘6’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘6’ |
| ID Control : B_Read_Binary |
| ||||
| PL3 | INTEGER | 1 | 1000 | - | - | Size read buffer RX Bluetooth |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘6’ |
| ID Control : B_Read_Binary |
| |||||
| PL3 | INTEGER | -1 | 1000 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
[0,1000] | Size of string respond | ||||||||
| PL4 | STRING | - | - | - | - | Data read buffer in HEX format |
|
Example
Message : | |
HOST Send | $ESP_OK|10|T|B|6|100|*0D3A |
ACK Respond | $ESP_OK|72|T|B|6|31|48692045535072746B2C20496D206D6F62696C65206465766963652E200D0A|*3D0C |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control B_Clear_Buffer
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘B’ | ‘7’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘7’ | STRING | - | - | 1 | 1 | ID Control : B_Clear_Buffer |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘7’ |
| ID Control : B_Clear_Buffer |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | - | ||||||||
1 | Clear Buffer Success | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|6|T|B|7|*7626 |
ACK Respond | $ESP_OK|39|T|B|7|1|Bluetooth Clear Buffer Success|*3767 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |