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

STA5 SmartLink command guidance · Changes

Page history
Create STA5 SmartLink command guidance authored Apr 08, 2022 by Ervin Lan's avatar Ervin Lan
Hide whitespace changes
Inline Side-by-side
Showing with 55 additions and 0 deletions
+55 -0
  • STA5-SmartLink-command-guidance.md STA5-SmartLink-command-guidance.md +55 -0
  • No files found.
STA5-SmartLink-command-guidance.md 0 → 100644
View page @ 9e98cb26
# STA5 SmartLink command guidance
## 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:
<pre>
export
├── include
│   ├── libunixsocket.h
│   ├── sml_def.h
│   └── sml_data_format.h
└── libsocket.so
</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 | 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. |
Clone repository
  • APIs
  • STA5 SmartLink command guidance
  • Home