媒体管理
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 | 文件扩展信息 | |
| »»flight_id | 任务 ID | text | 关联的航线任务 ID | |
| »»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 | 拍摄时的 GPS 位置 | |
| »»»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 | STS 临时凭证信息 | |
| »»access_key_id | 访问密钥 ID | text | 临时访问密钥 ID | |
| »»access_key_secret | 秘密访问密钥 | text | 临时访问密钥 | |
| »»expire | 访问密钥过期时间 | int | {"step":"1","unit_name":"秒 / s"} | 凭证过期时间(秒) |
| »»security_token | 会话凭证 | text | 安全令牌 | |
| »endpoint | 对外服务的访问域名 | text | 对象存储服务地址 | |
| »provider | 云厂商枚举值 | enum_string | {"aws":"亚马逊云","minio":"minio"} | 存储服务提供商 |
| »region | 数据中心所在的地域 | text | 存储桶所在区域 | |
| »object_key_prefix | 对象存储桶的 Key 的前缀 | text | 上传文件的 key 前缀 |
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"
}