Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • AnW_STA5_SmartLink AnW_STA5_SmartLink
  • Project information
    • Project information
    • Activity
    • Members
  • Packages & Registries
    • Packages & Registries
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • Ervin Lan
  • AnW_STA5_SmartLinkAnW_STA5_SmartLink
  • Wiki
  • STA5 SmartLink command guidance

Last edited by delly chen Mar 22, 2023
Page history
This is an old version of this page. You can view the most recent version or browse the history.

STA5 SmartLink command guidance

STA5 SmartLink command guidance

Agenda

  • Requirement
  • APIs
  • SmartLink data format
  • SmartLink data base structure
  • Command
    • Subscribe
    • On Top Notification
    • On Top Notification for Android Auto
    • Get Up

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

  • To connect:
ret = sfd = create_unix_stream_socket(TMP_SOCKET_SML, 0);
if (ret < 0) {
    perror(0);
    exit(1);
}
  • Send message:
ret = write(sfd, &send_data, sizeof(send_data));
if (ret < 0) {
    perror(0);
    goto ERR_EXIT;
}
  • Receive message:
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 for Android Auto

  • 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).
Clone repository
  • APIs
  • STA5 SmartLink command guidance
  • Home