
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Thingpark X standalone IoT Flow Drivers API 镜像提供了物联网设备数据编解码的REST API服务。该镜像从公共仓库下载驱动并存储在本地内存中,通过暴露8095端口提供API访问,方便用户实现物联网设备数据的编码(下行链路)与解码(上行链路)功能。
适用于需要与物联网设备进行数据交互的场景,例如:
通过以下命令拉取Docker镜像:
bashdocker pull docker.xuanyuan.run/actility/iot-flow-drivers
运行容器时需暴露8095端口以访问API服务:
bashdocker run -d -p 8095:8095 docker.xuanyuan.run/actility/iot-flow-drivers
容器运行后,可通过以下URL访问Swagger UI,查看完整API文档及使用示例:
http://localhost:8095/v1/swagger-ui
4.1 列出可用驱动
通过GET请求获取所有可用驱动列表:
bashcurl -X GET http://localhost:8095/v1/drivers
示例响应:
json[ { "id": "{driverId}", "producerId": "example", "moduleId": "myDriver", "version": "1" } ]
4.2 编码下行链路数据
将业务数据编码为设备可识别的二进制载荷:
bashcurl -X POST \ http://localhost:8095/v1/encode \ -H 'Content-Type: application/json' \ -d '{ "direction": "downlink", "meta": { "driverId": "${driverId}", "lorawan": { "fPort": 15 } }, "message": { "temperature": 23.5, "humidity": 65.0 } }'
示例响应:
json{ "direction": "downlink", "meta": { "driverId": "${driverId}" }, "message": { "temperature": 23.5, "humidity": 65.0 }, "raw": { "binary": "{payload_in_hexadecimal}" } }
其中{payload_in_hexadecimal}为驱动生成的十六进制原始载荷。
4.3 解码上行链路数据
将设备原始二进制载荷解码为业务数据:
bashcurl -X POST \ http://localhost:8095/v1/decode \ -H 'Content-Type: application/json' \ -d '{ "direction": "uplink", "meta": { "driverId": "${driverId}" }, "raw": { "binary": "{payload_in_hexadecimal}" } }'
示例响应:
json{ "direction": "uplink", "meta": { "driverId": "${driverId}" }, "thing": { "points": { "temperature": { "records": [{ "eventTime": "2019-01-01T10:00:00+01:00", "value": 23.5 }], "unitId": "Cel", "type": "double" }, "humidity": { "records": [{ "eventTime": "2019-01-01T10:00:00+01:00", "value": 65.0 }], "unitId": "%RH", "type": "double" } } }, "raw": { "binary": "{payload_in_hexadecimal}" }, "message": { "temperature": 23.5, "humidity": 65.0 } }
其中message字段为解码后的业务数据。
4.4 批量解码数据
支持同时解码多个设备的原始数据,可使用不同驱动:
bashcurl -X POST \ http://localhost:8095/v1/decode \ -H 'Content-Type: application/json' \ -d '[ { "id": "correlationId1", "input": { "direction": "uplink", "meta": { "driverId": "${driverId1}" }, "raw": { "binary": "${payload_in_hexadecimal1}" } } }, { "id": "correlationId2", "input": { "direction": "uplink", "meta": { "driverId": "${driverId2}" }, "raw": { "binary": "${payload_in_hexadecimal2}" } } } ]'
示例响应包含每个请求的解码结果,通过id字段关联原始请求。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务