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
  • APIs

APIs · Changes

Page history
Create APIs authored May 18, 2022 by delly chen's avatar delly chen
Hide whitespace changes
Inline Side-by-side
Showing with 458 additions and 0 deletions
+458 -0
  • APIs.md APIs.md +458 -0
  • No files found.
APIs.md 0 → 100644
View page @ 5e5d100c
# STA5 SmartLink command guidance
*Agenda*
- [Purpose](#purpose)
- [Main Flow Chart](#main-flow-chart)
- [APIs](#apis)
- [SmartLink data format](#smartlink-data-format)
- [SmartLink data base structure](#smartlink-data-base-structure)
- [Common Command](#common-command)
- [E_REQ_SUBSCRIBE](#subscribe)
- [E_REQ_GET_WIFI_STATUS](#get-wifi-status)
- [E_RETURN_WIFI_STATUS_ON/E_RETURN_WIFI_STATUS_OFF](#return-wifi-status)
- [Windows Focus switch command](#windows-focus-switch-command)
- [E_REQ_I_AM_TOP](#on-top-notification)
- [E_REQ_I_AM_TOP for Android Auto](#on-top-notification-for-android-auto)
- [E_GET_UP](#get-up)
- [E_GET_DOWN](#get-down)
- [Device Manager Command](#device-manager-command)
- [E_REQ_GET_DEVICE_INFO](#get-device-information)
- [E_RETURN_DEVICE_INFO](#return-device-information)
- [E_DEVICE_PHONE_LINK_ON](#device-phone-link-on)
- [E_DEVICE_PHONE_LINK_OFF](#device-phone-link-off)
- [E_UI_PHONE_LINK_BTN](#ui-phone-link-software-button)
- [E_BT_IAP2_CONNECTED](#iap2-connected)
- [E_BT_IAP2_DISCONNECTED](#iap2-disconnected)
- [E_UI_POP_WINDOW_PHONE_LINK_CONN](#pop-a-window-for-phone-link)
- [E_UI_WINDOW_MSG_BTN_YES/E_UI_WINDOW_MSG_BTN_NO/E_UI_WINDOW_MSG_BTN_CANCEL](#pop-up-window-return)
- [E_DISCONNECT_IPHONE_BT](#disconnect-bt-connection-with-iphone)
- [Resource Manager VIP Socket](#resource-manager-vip-socket)
- [Android Auto VIP Socket](#android-auto-vip-socket)
- [CarPlay VIP Socket](#carplay-vip-socket)
## Purpose
<pre>
SmartLink, an IPC application on STA5 platform, it's a middle-ware between applications
such as UI, AndroidAuto, Apple CarPlay, Bluetooth,... .
Main function includes:
- Windows focus switching(by software, hardware button)
- Audio manager(by rotary button)
- Wi-Fi manager
- Device manager
- Resource manager
</pre>
## APIs
- To connect:
<pre>
ret = sfd = create_unix_stream_socket(TMP_SOCKET_SML, 0);
if (ret < 0) {
perror(0);
exit(1);
}
</pre>
- Send message:
<pre>
ret = write(sfd, &send_data, sizeof(send_data));
if (ret < 0) {
perror(0);
goto ERR_EXIT;
}
</pre>
- Receive message:
<pre>
ret = bytes = read(sfd, buf, MAX_MESSAGE_READ);
if (ret < 0) {
perror(0);
exit(1);
}
</pre>
## SmartLink data format
| Data member | Data 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 | Data 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. |
## Common Command
### Subscribe
- From APPs - Client
- To subscribe the service from SmartLink. Send below message to SmartLink.
- Supported types: E_MAIN_UI, E_PHONE_CONNECTIVITY_AA, E_PHONE_CONNECTIVITY_CP, E_BT_SRV, E_OTHER_TYPE.
| 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.
### Get WiFi status
- From APPs - Client
- To get the Wi-Fi AP status from SmartLink. Send below message to SmartLink.
- Supported types: E_MAIN_UI, E_PHONE_CONNECTIVITY_AA, E_PHONE_CONNECTIVITY_CP, E_BT_SRV, E_OTHER_TYPE.
| 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_GET_WIFI_STATUS |
| len | Total length of message in bytes(288). |
- From SmartLink: Returned message, refer next section(Return WiFi status).
### Return WiFi status
- From SmartLink - Server
- Wi-Fi AP status returned from SmartLink:
- E_RETURN_WIFI_STATUS_ON means Wi-Fi AP is on and ready.
- E_RETURN_WIFI_STATUS_OFF means Wi-Fi AP is off and not ready.
- Supported types: E_MAIN_UI, E_PHONE_CONNECTIVITY_AA, E_PHONE_CONNECTIVITY_CP, E_BT_SRV, E_OTHER_TYPE.
| 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_RETURN_WIFI_STATUS_ON/E_RETURN_WIFI_STATUS_OFF |
| len | Total length of message in bytes(288). |
## Windows Focus switch command
### On Top Notification
- From APPs - Client
- Notify SmartLink when APP is on Projection mode. Send below message to SmartLink.
- Supported types: E_MAIN_UI, E_PHONE_CONNECTIVITY_CP, E_OTHER_TYPE.
| 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.
- Supported types: E_PHONE_CONNECTIVITY_AA.
| 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.
- Supported types: E_MAIN_UI, E_PHONE_CONNECTIVITY_AA, E_PHONE_CONNECTIVITY_CP, E_OTHER_TYPE.
| 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). |
### Get Down
- From SmartLink - Server
- Notify APP to hide to background.
- Supported types: E_MAIN_UI, E_PHONE_CONNECTIVITY_AA, E_PHONE_CONNECTIVITY_CP, E_OTHER_TYPE.
| 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_DOWN |
| len | Total length of message in bytes(288). |
## Device Manager Command
### Get device information
- From APPs - Client
- To get the device info from SmartLink. Send below message to SmartLink.
- Supported types: E_MAIN_UI, E_PHONE_CONNECTIVITY_AA, E_BT_SRV, E_OTHER_TYPE.
| 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_GET_DEVICE_INFO |
| len | Total length of message in bytes(288+6). |
| ---Outside of 288 bytes--- | |
| BtMacAddress[6] | 6 bytes, the BT MAC address of MD. |
- From SmartLink: Returned message, refer next page(Return device information).
### Return device information
- From SmartLink - Server
- The device info returned from SmartLink.
- Supported types: E_MAIN_UI, E_PHONE_CONNECTIVITY_AA, E_BT_SRV, E_OTHER_TYPE.
| 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_RETURN_DEVICE_INFO |
| len | Total length of message in bytes(288+10). |
| ---Outside of 288 bytes--- | |
| BtMacAddress[6] | 6 bytes, the BT MAC address from E_REQ_GET_DEVICE_INFO command. |
| SupportedAPP | 4 bytes, refer to APP_TYPE. |
### Device Phone Link ON
- From SmartLink - Server
- The device Phone Link status is ON.
- Supported types: E_MAIN_UI.
| 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_DEVICE_PHONE_LINK_ON |
| len | Total length of message in bytes(288+10).|
| ---Outside of 288 bytes--- | |
| BtMacAddress[6] | 6 bytes, the BT MAC address of MD. |
| SupportedAPP | 4 bytes, refer to APP_TYPE. |
### Device Phone Link OFF
- From SmartLink - Server
- The device Phone Link status is OFF.
- Supported types: E_MAIN_UI.
| 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_DEVICE_PHONE_LINK_OFF |
| len | Total length of message in bytes(288+10).|
| ---Outside of 288 bytes--- | |
| BtMacAddress[6] | 6 bytes, the BT MAC address of MD. |
| SupportedAPP | 4 bytes, refer to APP_TYPE. |
### UI Phone Link software button
- From UI - Client
- The Phone Link software button pressed, need to notify SmartLink.
- Supported types: E_MAIN_UI.
| 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_UI_PHONE_LINK_BTN |
| len | Total length of message in bytes(288+6). |
| ---Outside of 288 bytes--- | |
| BtMacAddress[6] | 6 bytes, the BT MAC address of MD. |
- From SmartLink: No return message.
### iAP2 connected
- From BTSRV - Client
- When iAP2 connected, need to notify SmartLink.
- Supported types: E_BT_SRV.
| 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_BT_IAP2_CONNECTED |
| len | Total length of message in bytes(288+10). |
| ---Outside of 288 bytes--- | |
| BtMacAddress[6] | 6 bytes, the BT MAC address of MD. |
| iAP2SessionHandle | 4 bytes int. Represents a handle of iAP2 Session over bluetooth. |
- From SmartLink: No return message.
### iAP2 disconnected
- From BTSRV - Client
- When iAP2 disconnected, need to notify SmartLink.
- Supported types: E_BT_SRV.
| 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_BT_IAP2_DISCONNECTED |
| len | Total length of message in bytes(288+10). |
| ---Outside of 288 bytes--- | |
| BtMacAddress[6] | 6 bytes, the BT MAC address of MD. |
| iAP2SessionHandle | 4 bytes int. Represents a handle of iAP2 Session over bluetooth. |
- From SmartLink: No return message.
### Pop a window for Phone Link
- From SmartLink - Server
- Call UI to pop a window for user confirm if Phone Link connection is allowed or not.
- Supported types: E_MAIN_UI.
| 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_UI_POP_WINDOW_PHONE_LINK_CONN |
| len | Total length of message in bytes(288+10). |
| ---Outside of 288 bytes--- | |
| BtMacAddress[6] | 6 bytes, the BT MAC address of MD. |
| SupportedAPP | 4 bytes, refer to APP_TYPE. |
### Pop up window return
- From UI - Client
- To return the result of pop up window to SmartLink.
- Supported types: E_MAIN_UI.
| 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_UI_WINDOW_MSG_BTN_YES/E_UI_WINDOW_MSG_BTN_NO/E_UI_WINDOW_MSG_BTN_CANCEL |
| len | Total length of message in bytes(288). |
### Disconnect BT connection with iPhone
- From SmartLink - Server
- Call BTSRV to disconnect BT connection with iPhone.
- Supported types: E_BT_SRV.
| 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_DISCONNECT_IPHONE_BT |
| len | Total length of message in bytes(288+6). |
| ---Outside of 288 bytes--- | |
| BtMacAddress[6] | 6 bytes, the BT MAC address of MD. |
## Resource Manager VIP Socket
### Android Auto VIP Socket
- Purpose: For Android Auto resource manager data transfer between Android Auto and SmartLink.
- The Data type and Data are defined in header file: aa_rsc_mgr.h.
| Object | Description |
| --------------------------------- | ------------------------------------------------------- |
| Socket Path(defined in sml_def.h) | #define TMP_SOCKET_AA_VIP "/tmp/socket_aa_vip" |
| Message format(From SmartLink) | “Ez”+(Total Length of Message)+(Data type)+(Data)+”RCM” |
- Total length of message: 16 bit.
- Data type: 8 bit.
### CarPlay VIP Socket
- Purpose: For CarPlay resource manager data transfer between CarPlay and SmartLink.
- The ResourceID and Data are defined in header file: cp_rsc_mgr.h.
| Object | Description |
| --------------------------------- | ---------------------------------------------- |
| Socket Path(defined in sml_def.h) | #define TMP_SOCKET_CP_VIP "/tmp/socket_cp_vip" |
| Message format(From SmartLink) | (ResourceID)+(Length of Data)+(Data) |
- ResourceID: 32 bit.
- Length of data: 32 bit.
- Data: Length of data.
\ No newline at end of file
Clone repository
  • APIs
  • STA5 SmartLink command guidance
  • Home