Commit bed733519ebddfc289386720de6dd68ffd7fbef7
1 parent
8449ccbb
review:【iot 物联网】tcp 协议的接入
Showing
2 changed files
with
6 additions
and
0 deletions
yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/codec/tcp/IotTcpBinaryDeviceMessageCodec.java
| @@ -175,6 +175,7 @@ public class IotTcpBinaryDeviceMessageCodec implements IotDeviceMessageCodec { | @@ -175,6 +175,7 @@ public class IotTcpBinaryDeviceMessageCodec implements IotDeviceMessageCodec { | ||
| 175 | } | 175 | } |
| 176 | } else { | 176 | } else { |
| 177 | // 请求消息只处理 params 参数 | 177 | // 请求消息只处理 params 参数 |
| 178 | + // TODO @haohao:如果为空,是不是得写个长度 0 哈? | ||
| 178 | if (message.getParams() != null) { | 179 | if (message.getParams() != null) { |
| 179 | bodyBuffer.appendBytes(JsonUtils.toJsonByte(message.getParams())); | 180 | bodyBuffer.appendBytes(JsonUtils.toJsonByte(message.getParams())); |
| 180 | } | 181 | } |
yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/tcp/manager/IotTcpConnectionManager.java
| @@ -135,6 +135,7 @@ public class IotTcpConnectionManager { | @@ -135,6 +135,7 @@ public class IotTcpConnectionManager { | ||
| 135 | */ | 135 | */ |
| 136 | @Data | 136 | @Data |
| 137 | public static class ConnectionInfo { | 137 | public static class ConnectionInfo { |
| 138 | + | ||
| 138 | /** | 139 | /** |
| 139 | * 设备 ID | 140 | * 设备 ID |
| 140 | */ | 141 | */ |
| @@ -147,6 +148,7 @@ public class IotTcpConnectionManager { | @@ -147,6 +148,7 @@ public class IotTcpConnectionManager { | ||
| 147 | * 设备名称 | 148 | * 设备名称 |
| 148 | */ | 149 | */ |
| 149 | private String deviceName; | 150 | private String deviceName; |
| 151 | + | ||
| 150 | /** | 152 | /** |
| 151 | * 客户端 ID | 153 | * 客户端 ID |
| 152 | */ | 154 | */ |
| @@ -155,9 +157,12 @@ public class IotTcpConnectionManager { | @@ -155,9 +157,12 @@ public class IotTcpConnectionManager { | ||
| 155 | * 消息编解码类型(认证后确定) | 157 | * 消息编解码类型(认证后确定) |
| 156 | */ | 158 | */ |
| 157 | private String codecType; | 159 | private String codecType; |
| 160 | + // TODO @haohao:有没可能不要 authenticated 字段,通过 deviceId 或者其他的?进一步简化,想的是哈。 | ||
| 158 | /** | 161 | /** |
| 159 | * 是否已认证 | 162 | * 是否已认证 |
| 160 | */ | 163 | */ |
| 161 | private boolean authenticated; | 164 | private boolean authenticated; |
| 165 | + | ||
| 162 | } | 166 | } |
| 167 | + | ||
| 163 | } | 168 | } |
| 164 | \ No newline at end of file | 169 | \ No newline at end of file |