jiangping
2023-10-16 47b7c25027580aa41fa6daa20f715044b1772a46
server/×ÔÐгµmqttЭÒé.md
@@ -1,48 +1,49 @@
# è‡ªè¡Œè½¦ mqtt åè®®æ–‡æ¡£
## {"bikeCode":"1234567890","id":"kjflksjlkfsjdlk","siteId": 456,"status":0,"code":"789"}
## {"bikeCode":"1234567890","lockId":789,"siteId": 456,"time":"2023-10-13 10:12:90"}
## é€šä¿¡è§„范
- æ¯ä¸ªç«™ç‚¹ä¸€ä¸ª mqtt è¿žæŽ¥ï¼ŒclientId ä¸º SITE_站点编号
- ä¸€ä¸ªç«™ç‚¹ç”±éƒ¨ç½²åœ¨ä¸Šä½æœºä¸Šçš„软件通过can总线与多个锁通信,并与服务器通过mqtt做消息转发
## sub: device/lock/{id}/info
## sub: device/lock/{siteId}/{lockId}/info
> **锁信息,在初始化、状态变更时会推送锁的完整状态**
- æ•°æ®
```json
{
    "siteId": "1015", // ç«™ç‚¹ç¼–号
    "code": "01", // é”ç¼–号
    "id": "123456789103", // é”å”¯ä¸€id,同主题{id}
    "status": 1, // çŠ¶æ€ï¼Œ0闭合, 1打开,2运行中, 3异常
    "bikeCode": "1234567890" // è‡ªè¡Œè½¦ic卡号,无车为空
    "siteId": "1015", // ç«™ç‚¹ç¼–号,同主题{siteId}
    "lockId": 2, // é”ç¼–号,同主题{lockId}
    "status": 1, // çŠ¶æ€ï¼Œ0闭合, 1打开,2运行中, 3异常, -1自检中
    "bikeCode": "12345678" // è‡ªè¡Œè½¦ic卡号,8位数字,如:10000012,无车为空
}
## {"bikeCode":"1234567890","id":"kjflksjlkfsjdlk","siteId": 456,"status":0,"code":"789"}
```
## pub: device/lock/{id}/getInfo
## pub: device/lock/{siteId}/{lockId}/getInfo
> å®žæ—¶èŽ·å–é”ä¿¡æ¯
- æ•°æ®
```json
{}
```
## pub: device/lock/{id}/unlock
## pub: device/lock/{siteId}/{lockId}/unlock
> å¼€é”ï¼ŒæˆåŠŸå¤±è´¥å¯å…³æ³¨info消息推送
- æ•°æ®
```json
{}
```
## sub: device/lock/{id}/bike
## sub: device/lock/{siteId}/{lockId}/bike
> è¿˜è½¦, è¿˜è½¦æˆåŠŸæ—¶ï¼ŒèŽ·å¾—æ‰€è¿˜è½¦è¾†ic卡号推送
- æ•°æ®
```json
{
    "bikeCode": "1234567890",
    "lockId": 123,
    "siteId": 234,
    "time": "2023-10-13 10:12:90"
    "bikeCode": "12345678",
    "lockId": 2,
    "siteId": "1050",
    "time": "2023-10-13 10:12:90" // ç«™ç‚¹ä¸Šä½æœºæ”¶åˆ°è¿˜è½¦æŒ‡ä»¤çš„æ—¶é—´ï¼Œä»…做参考,请以服务器时间为准
}
## {"bikeCode":"1234567890","lockId":789,"siteId": 456,"time":"2023-10-13 10:12:90"}
```