STA5 SmartLink command guidance
STA5 SmartLink command guidance
Agenda
Requirement
-
Platform: STA5
-
The version can be found in sml_def.h, please follow the latest version.
-
Please import below files to your project, they’re under SmartLink build folder:
export
├── include
│ ├── libunixsocket.h
│ ├── sml_def.h
│ └── sml_data_format.h
└── libsocket.so
APIs
ret = sfd = create_unix_stream_socket(TMP_SOCKET_SML, 0);
if (ret < 0) {
perror(0);
exit(1);
}
ret = write(sfd, &send_data, sizeof(send_data));
if (ret < 0) {
perror(0);
goto ERR_EXIT;
}
ret = bytes = read(sfd, buf, MAX_MESSAGE_READ);
if (ret < 0) {
perror(0);
exit(1);
}
SmartLink data format
| Data member |
Date type |
Data length |
Description |
| version |
unsigned char |
1 byte |
Set to SML_MAJOR_VERSION. |
| mode |
unsigned char |
1 byte |
Refer to type REQ_MODE. |
| AppType |
unsigned char |
1 byte |
Refer to type APP_TYPE. |
| state |
unsigned char |
1 byte |
Refer to type SML_STATE_CODE. |
| AppClientID |
unsigned int |
4 bytes |
Client ID. |
| srcAppName |
unsigned char[128] |
128 bytes |
Source application name in string. |
| dstAppName |
unsigned char[128] |
128 bytes |
Destination application name in string. |
| cmd |
unsigned int |
4 bytes |
Refer to type SML_COMMAND. |
| len |
unsigned int |
4 bytes |
Total length of message in bytes. |
SmartLink data base structure
| Data member |
Date type |
Data length |
Description |
| index |
int |
4 bytes |
|
| DeviceName[32] |
char |
32 bytes |
Phone Name. |
| usbSerialNumber[32] |
char |
32 bytes |
USB serial number. |
| btMacAddress[32] |
char |
32 bytes |
Bluetooth MAC address. |
| SupportedAPP |
int |
4 bytess |
Refer to APP_TYPE. |
Command
Subscribe
- From APPs - Client
- To subscribe the service from SmartLink. Send below message to SmartLink.
| Data member |
Value |
| version |
SML_MAJOR_VERSION |
| mode |
E_DELEGATE |
| AppType |
Refer to type APP_TYPE. |
| state |
E_STATE_OK |
| AppClientID |
Client ID. |
| srcAppName |
Source application name in string. |
| dstAppName |
"SML" |
| cmd |
E_REQ_SUBSCRIBE |
| len |
Total length of message in bytes(288). |
- From SmartLink: No return message.
On Top Notification
- From APPs - Client
- Notify SmartLink when APP is on Projection mode. Send below message to SmartLink.
| Data member |
Value |
| version |
SML_MAJOR_VERSION |
| mode |
E_DELEGATE |
| AppType |
Refer to type APP_TYPE. |
| state |
E_STATE_OK |
| AppClientID |
Client ID. |
| srcAppName |
Source application name in string. |
| dstAppName |
"SML" |
| cmd |
E_REQ_I_AM_TOP |
| len |
Total length of message in bytes(288). |
- From SmartLink: No return message.
On Top Notification(AA)
- From AA - Client
- Notify SmartLink when APP is on Projection mode. Send below message to SmartLink.
| Data member |
Value |
| version |
SML_MAJOR_VERSION |
| mode |
E_DELEGATE |
| AppType |
Refer to type APP_TYPE. |
| state |
E_STATE_OK |
| AppClientID |
Client ID. |
| srcAppName |
"AA" |
| dstAppName |
"SML" |
| cmd |
E_REQ_I_AM_TOP |
| len |
Total length of message in bytes(288+64). |
| ---Outside of 288 bytes--- |
|
| UsbSerialNumber[32] |
32 bytes, the USB serial number of MD. |
| BtMacAddress[32] |
32 bytes, the BT MAC address of MD. |
- From SmartLink: No return message.
Get Up
- From SmartLink - Server
- Notify APP to enter Projection mode.
| Data member |
Value |
| version |
SML_MAJOR_VERSION |
| mode |
E_DELEGATE |
| AppType |
Refer to type APP_TYPE. |
| state |
E_STATE_OK |
| AppClientID |
Client ID. |
| srcAppName |
"SML" |
| dstAppName |
Received Application name. |
| cmd |
E_GET_UP |
| len |
Total length of message in bytes(288). |