chore(project): rebranded project as 恭学教育 (GongXue Education)
Some checks failed
Deploy to Runner / deploy (push) Failing after 6m7s
Some checks failed
Deploy to Runner / deploy (push) Failing after 6m7s
- Updated pom.xml project name, description, and URL to 恭学教育. - Changed LICENSE copyright holder to 恭学教育 (GongXue Education). - Rebranded README.md with new project title and tagline. - Replaced @author 芋道源码 with @author 恭学教育 across all Java source files. - Updated Swagger metadata with 恭学教育 API title and admin@gongxue.com. - Added Gitea Actions CI pipeline for automated build and deployment.
This commit is contained in:
@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
/**
|
||||
* IoT 网关配置类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(IotGatewayProperties.class)
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
*
|
||||
* 负责接收来自消息总线的下行消息,并委托给子类进行业务处理
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
|
||||
@@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.iot.core.enums.IotProtocolTypeEnum;
|
||||
*
|
||||
* 定义传输层协议的生命周期管理
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotProtocol {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 协议管理器:负责根据配置创建和管理协议实例
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotProtocolManager implements SmartLifecycle {
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
/**
|
||||
* IoT CoAP 协议配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotCoapConfig {
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* 4. 属性上报:POST /topic/sys/{productKey}/{deviceName}/thing/property/post
|
||||
* 5. 事件上报:POST /topic/sys/{productKey}/{deviceName}/thing/event/post
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotCoapProtocol implements IotProtocol {
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 CoAP 订阅者:接收下行给设备的消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotCoapDownstreamSubscriber extends AbstractIotProtocolDownstreamSubscriber {
|
||||
|
||||
@@ -24,7 +24,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
||||
/**
|
||||
* IoT 网关 CoAP 协议的处理器抽象基类:提供通用的前置处理(认证)、请求解析、响应处理、全局的异常捕获等
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class IotCoapAbstractHandler {
|
||||
|
||||
@@ -20,7 +20,7 @@ import static cn.iocoder.yudao.module.iot.gateway.enums.ErrorCodeConstants.DEVIC
|
||||
/**
|
||||
* IoT 网关 CoAP 协议的【认证】处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotCoapAuthHandler extends IotCoapAbstractHandler {
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.eclipse.californium.core.server.resources.CoapExchange;
|
||||
*
|
||||
* 设备通过此资源进行认证,获取 Token
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotCoapAuthResource extends CoapResource {
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.eclipse.californium.core.server.resources.CoapExchange;
|
||||
* <p>
|
||||
* 用于直连设备/网关的一型一密动态注册,不需要认证
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
* @see <a href="https://help.aliyun.com/zh/iot/user-guide/unique-certificate-per-product-verification">阿里云 - 一型一密</a>
|
||||
*/
|
||||
@Slf4j
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.eclipse.californium.core.server.resources.CoapExchange;
|
||||
* <p>
|
||||
* 用于直连设备/网关的一型一密动态注册,不需要认证
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotCoapRegisterResource extends CoapResource {
|
||||
|
||||
@@ -21,7 +21,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
* <p>
|
||||
* 用于子设备的动态注册,需要网关认证
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
* @see <a href="https://help.aliyun.com/zh/iot/user-guide/register-devices">阿里云 - 动态注册子设备</a>
|
||||
*/
|
||||
@Slf4j
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.eclipse.californium.core.server.resources.Resource;
|
||||
* <p>
|
||||
* 支持动态路径匹配:productKey 和 deviceName 是网关设备的标识
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotCoapRegisterSubResource extends CoapResource {
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
*
|
||||
* Token 通过自定义 CoAP Option 2088 携带
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotCoapUpstreamHandler extends IotCoapAbstractHandler {
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.eclipse.californium.core.server.resources.Resource;
|
||||
* - /topic/sys/{productKey}/{deviceName}/thing/property/post
|
||||
* - /topic/sys/{productKey}/{deviceName}/thing/event/{eventId}/post
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotCoapUpstreamTopicResource extends CoapResource {
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT EMQX 协议配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotEmqxConfig {
|
||||
|
||||
@@ -39,7 +39,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
* 1. 提供 HTTP Hook 服务(/mqtt/auth、/mqtt/acl、/mqtt/event)给 EMQX 调用
|
||||
* 2. 通过 MQTT Client 订阅设备上行消息,并发布下行消息到 Broker
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotEmqxProtocol implements IotProtocol {
|
||||
|
||||
@@ -16,7 +16,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* <p>
|
||||
* 从消息总线接收到下行消息,然后发布到 MQTT Broker,从而被设备所接收
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotEmqxDownstreamHandler {
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 EMQX 订阅者:接收下行给设备的消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotEmqxDownstreamSubscriber extends AbstractIotProtocolDownstreamSubscriber {
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.Locale;
|
||||
* 3. 设备 ACL 权限接口 - 对应 EMQX HTTP ACL 插件 {@link #handleAcl(RoutingContext)}
|
||||
* 4. 设备注册接口 - 集成一型一密设备注册 {@link #handleDeviceRegister(RoutingContext, String, String)}
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotEmqxAuthEventHandler {
|
||||
|
||||
@@ -12,7 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 EMQX 上行消息处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotEmqxUpstreamHandler {
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
/**
|
||||
* IoT HTTP 协议配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotHttpConfig {
|
||||
|
||||
@@ -26,7 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* <p>
|
||||
* 基于 Vert.x 实现 HTTP 服务器,接收设备上行消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotHttpProtocol implements IotProtocol {
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 HTTP 订阅者:接收下行给设备的消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
|
||||
@@ -24,7 +24,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
||||
/**
|
||||
* IoT 网关 HTTP 协议的处理器抽象基类:提供通用的前置处理(认证)、全局的异常捕获等
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class IotHttpAbstractHandler implements Handler<RoutingContext> {
|
||||
|
||||
@@ -23,7 +23,7 @@ import static cn.iocoder.yudao.module.iot.gateway.enums.ErrorCodeConstants.DEVIC
|
||||
*
|
||||
* 参考 <a href="阿里云 IoT —— HTTPS 连接通信">https://help.aliyun.com/zh/iot/user-guide/establish-connections-over-https</a>
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public class IotHttpAuthHandler extends IotHttpAbstractHandler {
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
* <p>
|
||||
* 用于直连设备/网关的一型一密动态注册,不需要认证
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
* @see <a href="https://help.aliyun.com/zh/iot/user-guide/unique-certificate-per-product-verification">阿里云 - 一型一密</a>
|
||||
*/
|
||||
public class IotHttpRegisterHandler extends IotHttpAbstractHandler {
|
||||
|
||||
@@ -19,7 +19,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
* <p>
|
||||
* 用于子设备的动态注册,需要网关认证
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
* @see <a href="https://help.aliyun.com/zh/iot/user-guide/register-devices">阿里云 - 动态注册子设备</a>
|
||||
*/
|
||||
public class IotHttpRegisterSubHandler extends IotHttpAbstractHandler {
|
||||
|
||||
@@ -14,7 +14,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 HTTP 协议的【上行】处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotHttpUpstreamHandler extends IotHttpAbstractHandler {
|
||||
|
||||
@@ -24,7 +24,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
* 和 {@link #pollTask(Long, String)}。
|
||||
* <p>
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class AbstractIotModbusPollScheduler {
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.nio.ByteOrder;
|
||||
* <li>点位查找({@link #findPoint})</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@UtilityClass
|
||||
@Slf4j
|
||||
|
||||
@@ -22,7 +22,7 @@ import static cn.iocoder.yudao.module.iot.gateway.protocol.modbus.common.utils.I
|
||||
* 2. 通过 {@link IotModbusTcpClientConnectionManager.ModbusConnection} 执行事务
|
||||
* 3. 从响应中提取原始值
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@UtilityClass
|
||||
@Slf4j
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
/**
|
||||
* IoT Modbus TCP Client 协议配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotModbusTcpClientConfig {
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit;
|
||||
/**
|
||||
* IoT 网关 Modbus TCP Client 协议:主动轮询 Modbus 从站设备数据
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpClientProtocol implements IotProtocol {
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
||||
* 1. 处理下行消息(如属性设置 thing.service.property.set)
|
||||
* 2. 将属性值转换为 Modbus 写指令,通过 TCP 连接发送给设备
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT Modbus TCP 下行消息订阅器:订阅消息总线的下行消息并转发给处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpClientDownstreamSubscriber extends AbstractIotProtocolDownstreamSubscriber {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Map;
|
||||
/**
|
||||
* IoT Modbus TCP 上行数据处理器:将原始值转换为物模型属性值并上报
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpClientUpstreamHandler {
|
||||
|
||||
@@ -21,7 +21,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
/**
|
||||
* IoT Modbus TCP Client 配置缓存服务
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* 2. 分布式锁管理(连接级别),避免多节点重复创建连接
|
||||
* 3. 连接重试和故障恢复
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpClientConnectionManager {
|
||||
|
||||
@@ -22,7 +22,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
/**
|
||||
* IoT Modbus TCP Client 轮询调度器:管理点位的轮询定时器,调度读取任务并上报结果
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpClientPollScheduler extends AbstractIotModbusPollScheduler {
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.Data;
|
||||
/**
|
||||
* IoT Modbus TCP Server 协议配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotModbusTcpServerConfig {
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* 1. 设备通过自定义功能码(FC 65)发送认证请求
|
||||
* 2. 认证成功后,网关主动发送 Modbus 读请求,设备响应(云端轮询模式)
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpServerProtocol implements IotProtocol {
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.experimental.Accessors;
|
||||
/**
|
||||
* IoT Modbus 统一帧数据模型(TCP/RTU 公用)
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.function.BiConsumer;
|
||||
* - MODBUS_TCP:两阶段 RecordParser(MBAP length 字段驱动)
|
||||
* - MODBUS_RTU:功能码驱动的状态机
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.nio.charset.StandardCharsets;
|
||||
/**
|
||||
* IoT Modbus 帧编码器:负责将 Modbus 请求/响应编码为字节数组,支持 MODBUS_TCP(MBAP)和 MODBUS_RTU(CRC16)两种帧格式。
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* 1. 处理下行消息(如属性设置 thing.service.property.set)
|
||||
* 2. 将属性值转换为 Modbus 写指令,通过 TCP 连接发送给设备
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpServerDownstreamHandler {
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT Modbus TCP Server 下行消息订阅器:订阅消息总线的下行消息并转发给处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpServerDownstreamSubscriber extends AbstractIotProtocolDownstreamSubscriber {
|
||||
|
||||
@@ -46,7 +46,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
||||
* 1. 自定义 FC 认证
|
||||
* 2. 轮询响应 → 点位翻译 → thing.property.post
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpServerUpstreamHandler {
|
||||
|
||||
@@ -23,7 +23,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
/**
|
||||
* IoT Modbus TCP Server 配置缓存:认证时按需加载,断连时清理,定时刷新已连接设备
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* <p>
|
||||
* 管理设备 TCP 连接:socket ↔ 设备双向映射
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpServerConnectionManager {
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
* - TCP 模式:按 transactionId 精确匹配
|
||||
* - RTU 模式:按 slaveId + functionCode FIFO 匹配
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpServerPendingRequestManager {
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
/**
|
||||
* IoT Modbus TCP Server 轮询调度器:编码读请求帧,通过 TCP 连接发送到设备,注册 PendingRequest 等待响应
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotModbusTcpServerPollScheduler extends AbstractIotModbusPollScheduler {
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
/**
|
||||
* IoT 网关 MQTT 协议配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotMqttConfig {
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 网关 MQTT 协议:接收设备上行消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotMqttProtocol implements IotProtocol {
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 MQTT 协议:下行消息处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 MQTT 协议:接收下行给设备的消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotMqttDownstreamSubscriber extends AbstractIotProtocolDownstreamSubscriber {
|
||||
|
||||
@@ -15,7 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* <p>
|
||||
* 提供通用的连接校验、响应发送等功能
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -24,7 +24,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
||||
* <p>
|
||||
* 处理 MQTT CONNECT 事件,完成设备认证、连接注册、上线通知
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotMqttAuthHandler extends IotMqttAbstractHandler {
|
||||
|
||||
@@ -19,7 +19,7 @@ import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeC
|
||||
/**
|
||||
* IoT 网关 MQTT 设备注册处理器:处理设备动态注册消息(一型一密)
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotMqttRegisterHandler extends IotMqttAbstractHandler {
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 MQTT 上行消息处理器:处理业务消息(属性上报、事件上报等)
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotMqttUpstreamHandler extends IotMqttAbstractHandler {
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* 2. 管理设备会话和在线状态
|
||||
* 3. 管理消息发送到设备
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.Data;
|
||||
/**
|
||||
* IoT TCP 协议配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotTcpConfig {
|
||||
|
||||
@@ -29,7 +29,7 @@ import cn.hutool.core.lang.Assert;
|
||||
* <p>
|
||||
* 基于 Vert.x 实现 TCP 服务器,接收设备上行消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotTcpProtocol implements IotProtocol {
|
||||
|
||||
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
/**
|
||||
* IoT TCP 拆包类型枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -9,7 +9,7 @@ import io.vertx.core.parsetools.RecordParser;
|
||||
* <p>
|
||||
* 用于解决 TCP 粘包/拆包问题,提供解码(拆包)和编码(加帧)能力
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotTcpFrameCodec {
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.iot.gateway.protocol.tcp.IotTcpConfig;
|
||||
/**
|
||||
* IoT TCP 帧编解码器工厂
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public class IotTcpFrameCodecFactory {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import cn.hutool.core.lang.Assert;
|
||||
* <li>自定义字符串</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotTcpDelimiterFrameCodec implements IotTcpFrameCodec {
|
||||
|
||||
@@ -14,7 +14,7 @@ import cn.hutool.core.lang.Assert;
|
||||
* <p>
|
||||
* 基于固定长度的拆包策略,每条消息固定字节数
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotTcpFixedLengthFrameCodec implements IotTcpFrameCodec {
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
* <li>initialBytesToStrip: 解码后跳过的字节数</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotTcpLengthFieldFrameCodec implements IotTcpFrameCodec {
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 TCP 下行消息处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 TCP 下游订阅者:接收下行给设备的消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotTcpDownstreamSubscriber extends AbstractIotProtocolDownstreamSubscriber {
|
||||
|
||||
@@ -33,7 +33,7 @@ import static cn.iocoder.yudao.module.iot.gateway.enums.ErrorCodeConstants.DEVIC
|
||||
/**
|
||||
* TCP 上行消息处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotTcpUpstreamHandler implements Handler<NetSocket> {
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* 2. 管理设备会话和在线状态
|
||||
* 3. 管理消息发送到设备
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotTcpConnectionManager {
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
/**
|
||||
* IoT UDP 协议配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotUdpConfig {
|
||||
|
||||
@@ -25,7 +25,7 @@ import cn.hutool.core.lang.Assert;
|
||||
* <p>
|
||||
* 基于 Vert.x 实现 UDP 服务器,接收设备上行消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotUdpProtocol implements IotProtocol {
|
||||
|
||||
@@ -11,7 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 UDP 下行消息处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 UDP 下游订阅者:接收下行给设备的消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotUdpDownstreamSubscriber extends AbstractIotProtocolDownstreamSubscriber {
|
||||
|
||||
@@ -45,7 +45,7 @@ import static cn.iocoder.yudao.module.iot.gateway.enums.ErrorCodeConstants.DEVIC
|
||||
* 3. 后续请求:每次请求在 params 中携带 token
|
||||
* 4. 服务端验证:每次请求通过 IotDeviceTokenService.verifyToken() 验证
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotUdpUpstreamHandler {
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* 2. 自动清理超时会话(expireAfterAccess)
|
||||
* 3. 限制最大会话数(maximumSize)
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotUdpSessionManager {
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
/**
|
||||
* IoT WebSocket 协议配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotWebSocketConfig {
|
||||
|
||||
@@ -28,7 +28,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* <p>
|
||||
* 基于 Vert.x 实现 WebSocket 服务器,接收设备上行消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotWebSocketProtocol implements IotProtocol {
|
||||
|
||||
@@ -10,7 +10,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 WebSocket 下行消息处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* IoT 网关 WebSocket 下游订阅者:接收下行给设备的消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotWebSocketDownstreamSubscriber extends AbstractIotProtocolDownstreamSubscriber {
|
||||
|
||||
@@ -33,7 +33,7 @@ import static cn.iocoder.yudao.module.iot.gateway.enums.ErrorCodeConstants.DEVIC
|
||||
/**
|
||||
* WebSocket 上行消息处理器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotWebSocketUpstreamHandler implements Handler<ServerWebSocket> {
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* 2. 管理设备会话和在线状态
|
||||
* 3. 管理消息发送到设备
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotWebSocketConnectionManager {
|
||||
|
||||
@@ -8,7 +8,7 @@ import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
|
||||
*
|
||||
* 用于序列化和反序列化设备消息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotMessageSerializer {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Map;
|
||||
*
|
||||
* 负责根据枚举创建和管理序列化器实例
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotMessageSerializerManager {
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* - 请求消息:params 数据(JSON)
|
||||
* - 响应消息:code (4字节) + msg 长度(2字节) + msg 字符串 + data 数据(JSON)
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotBinarySerializer implements IotMessageSerializer {
|
||||
|
||||
@@ -11,7 +11,7 @@ import cn.iocoder.yudao.module.iot.gateway.serialize.IotMessageSerializer;
|
||||
*
|
||||
* 直接使用 JsonUtils 序列化/反序列化 {@link IotDeviceMessage},不包装额外字段
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public class IotJsonSerializer implements IotMessageSerializer {
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.iot.core.topic.IotDeviceIdentity;
|
||||
/**
|
||||
* IoT 设备 Token Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotDeviceTokenService {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import static cn.iocoder.yudao.module.iot.gateway.enums.ErrorCodeConstants.DEVIC
|
||||
*
|
||||
* 注意:目前仅 HTTP 协议使用
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
|
||||
@@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.iot.core.biz.dto.IotDeviceRespDTO;
|
||||
/**
|
||||
* IoT 设备信息 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotDeviceService {
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildAsync
|
||||
/**
|
||||
* IoT 设备信息 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
|
||||
@@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
|
||||
/**
|
||||
* IoT 设备消息 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotDeviceMessageService {
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import static cn.iocoder.yudao.module.iot.gateway.enums.ErrorCodeConstants.DEVIC
|
||||
/**
|
||||
* IoT 设备消息 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
|
||||
@@ -32,7 +32,7 @@ import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeC
|
||||
/**
|
||||
* Iot 设备信息 Service 实现类:调用远程的 device http 接口,进行设备认证、设备获取等
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
|
||||
@@ -9,7 +9,7 @@ import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
|
||||
* <p>
|
||||
* 用于统一管理 MQTT 协议中的主题常量,基于 Alink 协议规范
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public final class IotMqttTopicUtils {
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ import static cn.iocoder.yudao.module.iot.gateway.protocol.coap.handler.upstream
|
||||
* </li>
|
||||
* </ol>
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
@Disabled
|
||||
|
||||
@@ -51,7 +51,7 @@ import static cn.iocoder.yudao.module.iot.gateway.protocol.coap.handler.upstream
|
||||
* </li>
|
||||
* </ol>
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
@Disabled
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user