媒体管理
Event
媒体文件上传结果上报
Topic: thing/product/{gateway_sn}/events
Direction: up
Method: file_upload_callback
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| file | 文件信息 | struct | ||
| »object_key | 文件在对象存储桶的 Key | text | ||
| »path | 文件的业务路径 | text | ||
| »name | 文件名称 | text | ||
| »ext | 文件扩展内容 | struct | ||
| »»even_id | 关联拍摄事件ID | array_text | 字符串数组 | |
| »»flight_id | 任务 ID | text | ||
| »»drone_model_key | 无人机产品枚举值 | text | ||
| »»payload_model_key | 负载产品枚举值 | text | ||
| »»is_original | 是否为原图 | bool | {"0":"否","1":"是"} | |
| »metadata | 媒体元数据 | struct | ||
| »»gimbal_yaw_degree | 云台偏航角 | float | ||
| »»absolute_altitude | 拍摄绝对高度 | float | ||
| »»relative_altitude | 拍摄相对高度 | float | ||
| »»create_time | 媒体拍摄时间 | date | {"format":"iso8601"} | |
| »»shoot_position | 拍摄位置 | struct | ||
| »»»lat | 拍摄位置纬度 | float | ||
| »»»lng | 拍摄位置经度 | float |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"file": {
"ext": {
"drone_model_key": "0-4",
"flight_id": "xxx",
"is_original": true,
"payload_model_key": "0-4"
},
"metadata": {
"absolute_altitude": 56.311,
"create_time": "2024-01-10 16:04:20",
"gimbal_yaw_degree": "0",
"relative_altitude": 41.124,
"shoot_position": {
"lat": 22.1,
"lng": 144.5
}
},
"name": "dog.jpeg",
"object_key": "object_key",
"path": "xxx"
}
},
"gateway": "xxx",
"need_reply": 1,
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1709192149431,
"method": "file_upload_callback"
}
Requests
获取上传临时凭证
Topic: thing/product/{gateway_sn}/requests
Direction: up
Method: storage_config_get
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| module | 模块枚举值 | enum_int | {"0":"媒体"} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"module": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1709192149431,
"method": "storage_config_get"
}
Topic: thing/product/{gateway_sn}/requests_reply
Direction: down
Method: storage_config_get
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | 返回码 | int | 非 0 代表错误 | |
| output | 输出 | struct | ||
| »bucket | 对象存储桶名称 | text | ||
| »credentials | 凭证信息 | struct | ||
| »»access_key_id | 访问密钥 ID | text | ||
| »»access_key_secret | 秘密访问密钥 | text | ||
| »»expire | 访问密钥过期时间 | int | {"step":"1","unit_name":"秒 / s"} | |
| »»security_token | 会话凭证 | text | ||
| »endpoint | 对外服务的访问域名 | text | ||
| »provider | 云厂商枚举值 | enum_string | {"ali":"阿里云","aws":"亚马逊云","minio":"minio"} | |
| »region | 数据中心所在的地域 | text | ||
| »object_key_prefix | 对象存储桶的 Key 的前缀 | text |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"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-xxxxxxxxxx",
"timestamp": 1709192149431,
"method": "storage_config_get"
}
任务文件上传状态上报
Topic: thing/product/{gateway_sn}/events
Direction: up
Method: file_upload_status
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| tasks | 任务列表 | array | 任务信息数组 | |
| »flight_id | 任务ID | text | ||
| »total_video_files | 视频文件总数量 | int | ||
| »uploaded_photo_files | 已上传完成视频文件数量 | int | ||
| »total_photo_files | 照片文件总数量 | int | ||
| »uploaded_photo_files | 已上传照片数量 | int | ||
| »status | 上传状态 | enum_int | {"0":"待上传","1":"上传完成","2":"上传中","4":"上传失败"} |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"tasks": [
{
"flight_id": "flight_123456",
"total_video_files": 10,
"uploaded_video_files": 0,
"total_photo_files": 10,
"uploaded_photo_files": 10,
"status": 0
},
{
"flight_id": "flight_123457",
"total_video_files": 10,
"uploaded_video_files": 0,
"total_photo_files": 10,
"uploaded_photo_files": 10,
"status": 1
},
{
"flight_id": "flight_123458",
"total_video_files": 10,
"uploaded_video_files": 0,
"total_photo_files": 10,
"uploaded_photo_files": 10,
"status": 3
}
]
},
"gateway": "xxx",
"need_reply": 1,
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1709192149431,
"method": "file_upload_status"
}
删除任务文件
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: file_delete
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| flight_id | 任务 ID | text |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"flight_id": "xxxxxxx"
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "file_delete"
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: file_delete
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | 返回码 | int | 非 0 代表错误 |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "file_delete"
}
取消上传任务文件
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: file_cancel
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| flight_id | 任务 ID | text |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"flight_id": "xxxxxxx"
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "file_cancel"
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: file_cancel
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | 返回码 | int | 非 0 代表错误 |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "file_cancel"
}
重新上传任务文件
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: file_reupload
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| flight_id | 任务 ID | text |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"flight_id": "xxxxxxx"
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "file_reupload"
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: file_reupload
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | 返回码 | int | 非 0 代表错误 |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "file_reupload"
}
设置上传时间
Topic: thing/product/{gateway_sn}/services
Direction: down
Method: file_regulate
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| flight_id | 任务 ID | text | ||
| regulate_time | 上传时间 | long | 毫秒时间戳 |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"flight_id": "xxxxxxx",
"regulate_time":"xxx"
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "file_regulate"
}
Topic: thing/product/{gateway_sn}/services_reply
Direction: up
Method: file_regulate
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | 返回码 | int | 非 0 代表错误 |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "file_regulate"
}
缓存媒体文件数据
Topic: thing/product/{gateway_sn}/requests
Direction: down
Method: set_file_cache
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| sn | 飞机Sn | String | ||
| file_cache | 媒体文件缓存数据 | String | json类型数据 |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"sn": "xxxxxxx",
"file_cache":"xxxxxx"
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "set_file_cache"
}
Topic: thing/product/{gateway_sn}/requests_reply
Direction: up
Method: set_file_cache
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | 返回码 | int | 非 0 代表错误 |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "set_file_cache"
}
获取媒体文件缓存
Topic: thing/product/{gateway_sn}/requests
Direction: down
Method: get_file_cache
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| sn | 飞机Sn | String |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"sn": "xxxxxxx"
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "get_file_cache"
}
Topic: thing/product/{gateway_sn}/requests_reply
Direction: up
Method: get_file_cache
Data:
| Column | Name | Type | constraint | Description |
|---|---|---|---|---|
| result | 返回码 | int | 非 0 代表错误 | |
| file_cache | 媒体文件缓存数据 | String | json类型数据 |
Example:
{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"output": {
"file_cache":"xxxxxx"
},
"result": 0
},
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1234567890123,
"method": "get_file_cache"
}