PSDK Features
Event
psdk-UI resource package upload result report
Topic: thing/product/{gateway_sn}/events
Direction: up
Method: psdk_ui_resource_upload_result
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| psdk_index | psdk payload device index | int | {"max":3,"min":0,"step":1} | |
| object_key | oss object | text | ||
| size | File size | int | {"unit_name":"Byte / B"} | |
| result | Error code | int |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"object_key": "f4a4a171-bb33-45d6-bd3d-b10034f66734/1581F5BLD22BE00A090U_2023_07_21_11_48_33_widget",
"psdk_index": 2,
"result": 0,
"size": 43488
},
"gateway": "4TADKAQ000002J",
"method": "psdk_ui_resource_upload_result",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689911315621
}
psdk-Floating window text push
Topic: thing/product/{gateway_sn}/events
Direction: up
Method: psdk_floating_window_text
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| psdk_index | psdk payload device index | int | {"max":3,"min":0,"step":1} | |
| value | Floating window content | text |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"psdk_index": 2,
"value": "System time : 1193683 ms"
},
"gateway": "4TADKAQ000002J",
"method": "psdk_floating_window_text",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689911744380
}
Speaker-Audio playback progress notification
Topic: thing/product/{gateway_sn}/events
Direction: up
Method: speaker_audio_play_start_progress
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | Result code | int | ||
| output | Output | struct | ||
| »psdk_index | psdk payload device index | int | {"min":0} | |
| »status | Current stage | enum_string | {"in_progress":"In progress","ok":"Playback succeeded"} | |
| »md5 | MD5 checksum of the file content, used as the unique identifier of the Dock | text | ||
| »progress | Progress | struct | ||
| »»percent | Progress percentage | int | {"max":"100","min":"0","step":"1","unit_name":"Percentage / %"} | |
| »»step_key | Current step | enum_string | {"change_work_mode":"Switch working mode","download":"Download audio file from cloud to Dock","encoding":"Encode pcm to opus","play":"Start playback","upload":"Dock uploads audio to psdk"} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"output": {
"md5": "e0ecd29bb44d9e08107aaccecdc6cae2",
"progress": {
"percent": 89,
"step_key": "upload"
},
"psdk_index": 2,
"status": "in_progress"
},
"result": 0
},
"gateway": "4TADKAQ000002J",
"method": "speaker_audio_play_start_progress",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689868551258
}
Speaker-TTS playback progress notification
Topic: thing/product/{gateway_sn}/events
Direction: up
Method: speaker_tts_play_start_progress
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | Result code | int | ||
| output | Output | struct | ||
| »psdk_index | psdk payload device index | int | {"min":0} | |
| »status | Current stage | enum_string | {"in_progress":"In progress","ok":"Playback succeeded"} | |
| »md5 | MD5 checksum of the file content, used as the unique identifier of the Dock | text | ||
| »progress | Progress | struct | ||
| »»percent | Progress percentage | int | {"max":"100","min":"0","step":"1","unit_name":"Percentage / %"} | |
| »»step_key | Current step | enum_string | {"change_work_mode":"Switch working mode","play":"Start playback","upload":"Dock uploads audio to psdk"} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"output": {
"md5": "bacee8ed225fa346f6da87f67c914728",
"progress": {
"percent": 100,
"step_key": "play"
},
"psdk_index": 2,
"status": "success"
},
"result": 0
},
"gateway": "4TADKAQ000002J",
"method": "speaker_tts_play_start_progress",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689911352309
}
Service
psdk-Set widget value
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: psdk_widget_value_set
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| psdk_index | psdk payload device index | int | {"min":0} | |
| index | Widget number | int | {"min":0,"step":1} | |
| value | Widget value | int | {} | Widget values such as switches and progress are defined by the developer |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"index": 1,
"psdk_index": 2,
"value": 60
},
"method": "psdk_widget_value_set",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689740550047
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: psdk_widget_value_set
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | Result code | int |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655,
"method": "psdk_widget_value_set"
}
psdk-Send input box text
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: psdk_input_box_text_set
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| psdk_index | psdk payload device index | int | {"min":0} | |
| value | Text content | text | {"length":128,"unit_name":"Byte / B"} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"psdk_index": 2,
"value": "hello world"
},
"method": "psdk_input_box_text_set",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689740550047
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: psdk_input_box_text_set
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | Result code | int |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655,
"method": "psdk_input_box_text_set"
}
Speaker-Start audio playback
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: speaker_audio_play_start
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| psdk_index | psdk payload device index | int | {"min":0} | |
| file | Audio file | struct | ||
| »name | File name | text | {} | |
| »url | File download URL | text | {} | |
| »md5 | MD5 checksum of the audio file, used as the unique identifier of the Dock | text | ||
| »format | Speaker input file format | enum_string | {"pcm":"pcm format"} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"file": {
"format": "pcm",
"md5": "b38257017001f45ec064b5157b2e4416",
"name": "20230720162718",
"url": "https://example.com/5a6f9d4b-2a38-4b4b-86f9-3a678da0bf4a/3dd27366-bf21-41a7-9f07-62b74f2e93a7/fe2f2474-720a-4122-a552-010e1ed08920/20230720162718.webm.pcm"
},
"psdk_index": 2
},
"method": "speaker_audio_play_start",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689912303287
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: speaker_audio_play_start
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | Result code | int |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655,
"method": "speaker_audio_play_start"
}
Speaker - Start playing TTS text
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: speaker_tts_play_start
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| psdk_index | PSDK payload device index | int | {"min":0} | |
| tts | TTS text | struct | ||
| »name | File name | text | {} | |
| »text | Text content | text | {} | |
| »md5 | MD5 checksum of the file content, used as a unique identifier for the dock | text |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"psdk_index": 2,
"tts": {
"md5": "0bfb9bceee974f41a6ddfd81521bd795",
"name": "1111",
"text": "1111"
}
},
"method": "speaker_tts_play_start",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689860575397
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: speaker_tts_play_start
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | Return code | int |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655,
"method": "speaker_tts_play_start"
}
Speaker - Replay
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: speaker_replay
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| psdk_index | PSDK payload device index | int | {"min":0} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"psdk_index": 2
},
"method": "speaker_replay",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689748764875
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: speaker_replay
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | Return code | int |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655,
"method": "speaker_replay"
}
Speaker - Stop playback
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: speaker_play_stop
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| psdk_index | PSDK payload device index | int | {"min":0} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"psdk_index": 2
},
"method": "speaker_play_stop",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689748815503
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: speaker_play_stop
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | Return code | int |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655,
"method": "speaker_play_stop"
}
Speaker - Set playback mode
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: speaker_play_mode_set
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| psdk_index | PSDK payload device index | int | {"max":3,"min":0,"step":1} | |
| play_mode | Speaker playback mode | enum_int | {"0":"Single play","1":"Loop play (single track)"} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"play_mode": 1,
"psdk_index": 2
},
"method": "speaker_play_mode_set",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689842974113
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: speaker_play_mode_set
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | Return code | int |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655,
"method": "speaker_play_mode_set"
}
Speaker - Set volume
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: speaker_play_volume_set
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| psdk_index | PSDK payload device index | int | {"max":3,"min":0,"step":1} | |
| play_volume | Speaker volume | int | {"max":100,"min":0,"step":1} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"play_volume": 13,
"psdk_index": 2
},
"method": "speaker_play_volume_set",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689842989237
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: speaker_play_volume_set
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | Return code | int |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655,
"method": "speaker_play_volume_set"
}
Requests
Get temporary credentials for upload
Topic: thing/product/{gateway_sn}/requests
Direction: up
Method: storage_config_get
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| module | Module enumeration value | enum_int | {"0":"Media","1":"PSDK UI resources"} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"module": 1
},
"gateway": "4TADKAQ000002J",
"method": "storage_config_get",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1689911314560
}
Topic: thing/product/{gateway_sn}/requests_reply
Direction: down
Method: storage_config_get
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| bucket | Object storage bucket name | text | ||
| credentials | Credential information | struct | ||
| »access_key_id | Access key ID | text | ||
| »access_key_secret | Secret access key | text | ||
| »expire | Access key expiration time | int | {"step":"1","unit_name":"Seconds / s"} | |
| »security_token | Session token | text | ||
| endpoint | Access domain for external services | text | ||
| provider | Cloud provider enumeration values | enum_string | {"ali":"Alibaba Cloud","aws":"Amazon Cloud","minio":"MinIO"} | |
| region | Region where the data center is located | text | ||
| object_key_prefix | Prefix of the key in the object storage bucket | text |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"data": {
"output": {
"bucket": "bucket_name",
"credentials": {
"access_key_id": "access_key_id",
"access_key_secret": "access_key_secret",
"expire": 3600,
"security_token": "security_token"
},
"endpoint": "https://oss-cn-hangzhou.aliyuncs.com",
"object_key_prefix": "b4cfaae6-bd9d-4cd0-8472-63b608c3c581",
"provider": "ali",
"region": "hz"
},
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1654070968655,
"method": "storage_config_get"
}