Class ClientCommandSender

java.lang.Object
io.github.lunasaw.gbproxy.client.transmit.cmd.ClientCommandSender

public class ClientCommandSender extends Object
GB28181客户端命令发送器 使用策略模式和建造者模式,提供更灵活和可扩展的命令发送接口
Author:
luna
  • Constructor Details

    • ClientCommandSender

      public ClientCommandSender()
  • Method Details

    • sendCommand

      public static String sendCommand(String commandType, FromDevice fromDevice, ToDevice toDevice, Object... params)
      使用策略模式发送命令
      Parameters:
      commandType - 命令类型
      fromDevice - 发送设备
      toDevice - 接收设备
      params - 命令参数
      Returns:
      callId
    • sendCommand

      public static String sendCommand(String commandType, FromDevice fromDevice, ToDevice toDevice, javax.sip.RequestEvent requestEvent, Object... params)
      使用策略模式发送命令(支持事务上下文) 通过RequestEvent复用原请求的Call-ID,确保事务一致性
      Parameters:
      commandType - 命令类型
      fromDevice - 发送设备
      toDevice - 接收设备
      requestEvent - 原始请求事件,用于复用Call-ID
      params - 命令参数
      Returns:
      callId
    • sendCommand

      public static String sendCommand(String commandType, FromDevice fromDevice, ToDevice toDevice, Event errorEvent, Event okEvent, Object... params)
      使用策略模式发送命令(带事件)
      Parameters:
      commandType - 命令类型
      fromDevice - 发送设备
      toDevice - 接收设备
      errorEvent - 错误事件
      okEvent - 成功事件
      params - 命令参数
      Returns:
      callId
    • sendAlarmCommand

      public static String sendAlarmCommand(FromDevice fromDevice, ToDevice toDevice, DeviceAlarm deviceAlarm)
      发送告警命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceAlarm - 告警信息
      Returns:
      callId
    • sendAlarmCommand

      public static String sendAlarmCommand(FromDevice fromDevice, ToDevice toDevice, DeviceAlarmNotify deviceAlarmNotify)
      发送告警命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceAlarmNotify - 告警通知对象
      Returns:
      callId
    • sendKeepaliveCommand

      public static String sendKeepaliveCommand(FromDevice fromDevice, ToDevice toDevice, String status)
      发送心跳命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      status - 状态信息
      Returns:
      callId
    • sendKeepaliveCommand

      public static String sendKeepaliveCommand(FromDevice fromDevice, ToDevice toDevice, DeviceKeepLiveNotify deviceKeepLiveNotify)
    • sendCatalogCommand

      public static String sendCatalogCommand(FromDevice fromDevice, ToDevice toDevice, DeviceResponse deviceResponse)
      发送目录命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceResponse - 设备响应对象
      Returns:
      callId
    • sendCatalogCommand

      public static String sendCatalogCommand(FromDevice fromDevice, ToDevice toDevice, List<DeviceItem> deviceItems)
      发送目录命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceItems - 设备列表
      Returns:
      callId
    • sendCatalogCommand

      public static String sendCatalogCommand(FromDevice fromDevice, ToDevice toDevice, DeviceItem deviceItem)
      发送目录命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceItem - 单个设备项
      Returns:
      callId
    • sendDeviceInfoCommand

      public static String sendDeviceInfoCommand(FromDevice fromDevice, ToDevice toDevice, DeviceInfo deviceInfo)
      发送设备信息响应命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceInfo - 设备信息
      Returns:
      callId
    • sendDeviceInfoCommand

      public static String sendDeviceInfoCommand(FromDevice fromDevice, ToDevice toDevice, DeviceInfo deviceInfo, javax.sip.RequestEvent requestEvent)
      发送设备信息响应命令(支持事务上下文) 通过RequestEvent复用原请求的Call-ID,确保事务一致性
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceInfo - 设备信息
      requestEvent - 原始请求事件,用于复用Call-ID
      Returns:
      callId
    • sendDeviceStatusCommand

      public static String sendDeviceStatusCommand(FromDevice fromDevice, ToDevice toDevice, String online)
      发送设备状态响应命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      online - 在线状态 "ONLINE":"OFFLINE"
      Returns:
      callId
    • sendDeviceStatusCommand

      public static String sendDeviceStatusCommand(FromDevice fromDevice, ToDevice toDevice, DeviceStatus deviceStatus)
      发送设备状态响应命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceStatus - 在线状态 "ONLINE":"OFFLINE"
      Returns:
      callId
    • sendMobilePositionCommand

      public static String sendMobilePositionCommand(FromDevice fromDevice, ToDevice toDevice, MobilePositionNotify mobilePositionNotify, SubscribeInfo subscribeInfo)
      发送位置通知命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      mobilePositionNotify - 位置通知对象
      subscribeInfo - 订阅信息
      Returns:
      callId
    • sendDeviceChannelUpdateCommand

      public static String sendDeviceChannelUpdateCommand(FromDevice fromDevice, ToDevice toDevice, List<DeviceUpdateItem> deviceItems)
      发送设备通道更新通知命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceItems - 通道列表
      Returns:
      callId
    • sendDeviceOtherUpdateCommand

      public static String sendDeviceOtherUpdateCommand(FromDevice fromDevice, ToDevice toDevice, List<DeviceOtherUpdateNotify.OtherItem> deviceItems)
      发送设备其他更新通知命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceItems - 推送事件列表
      Returns:
      callId
    • sendDeviceRecordCommand

      public static String sendDeviceRecordCommand(FromDevice fromDevice, ToDevice toDevice, DeviceRecord deviceRecord)
      发送录像响应命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceRecord - 录像响应对象
      Returns:
      callId
    • sendDeviceRecordCommand

      public static String sendDeviceRecordCommand(FromDevice fromDevice, ToDevice toDevice, List<DeviceRecord.RecordItem> deviceRecordItems)
      发送录像响应命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceRecordItems - 录像文件列表
      Returns:
      callId
    • sendDeviceConfigCommand

      public static String sendDeviceConfigCommand(FromDevice fromDevice, ToDevice toDevice, DeviceConfigResponse deviceConfigResponse)
      发送设备配置响应命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      deviceConfigResponse - 配置响应对象
      Returns:
      callId
    • sendConfigDownloadResponse

      public static String sendConfigDownloadResponse(FromDevice fromDevice, ToDevice toDevice, ConfigDownloadResponse response)
      发送设备配置查询应答
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      response - 配置查询应答对象
      Returns:
      callId
    • sendMediaStatusCommand

      public static String sendMediaStatusCommand(FromDevice fromDevice, ToDevice toDevice, String notifyType)
      发送媒体状态通知命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      notifyType - 通知类型 121
      Returns:
      callId
    • sendPresetQueryResponse

      public static String sendPresetQueryResponse(FromDevice fromDevice, ToDevice toDevice, PresetQueryResponse response)
      发送设备预置位查询应答
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      response - 预置位查询应答对象
      Returns:
      callId
    • sendMobilePositionNotify

      public static String sendMobilePositionNotify(FromDevice fromDevice, ToDevice toDevice, MobilePositionNotify response)
      发送设备预置位查询应答
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      response - 预置位查询应答对象
      Returns:
      callId
    • sendByeCommand

      public static String sendByeCommand(FromDevice fromDevice, ToDevice toDevice)
      发送BYE请求命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      Returns:
      callId
    • sendAckCommand

      public static String sendAckCommand(FromDevice fromDevice, ToDevice toDevice)
      发送ACK响应命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      Returns:
      callId
    • sendAckCommand

      public static String sendAckCommand(FromDevice fromDevice, ToDevice toDevice, String callId)
      发送ACK响应命令(指定callId)
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      callId - 呼叫ID
      Returns:
      callId
    • sendAckCommand

      public static String sendAckCommand(FromDevice fromDevice, ToDevice toDevice, String content, String callId)
      发送ACK响应命令(带内容和callId)
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      content - 内容
      callId - 呼叫ID
      Returns:
      callId
    • sendInvitePlayCommand

      public static String sendInvitePlayCommand(FromDevice fromDevice, ToDevice toDevice, String sdpContent)
      发送实时点播命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      sdpContent - SDP内容
      Returns:
      callId
    • sendInvitePlayCommand

      public static String sendInvitePlayCommand(FromDevice fromDevice, ToDevice toDevice, String sdpContent, Event errorEvent, Event okEvent)
      发送实时点播命令(带事件)
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      sdpContent - SDP内容
      errorEvent - 错误事件
      okEvent - 成功事件
      Returns:
      callId
    • sendInvitePlayBackCommand

      public static String sendInvitePlayBackCommand(FromDevice fromDevice, ToDevice toDevice, String sdpContent)
      发送回放点播命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      sdpContent - SDP内容
      Returns:
      callId
    • sendInvitePlayBackCommand

      public static String sendInvitePlayBackCommand(FromDevice fromDevice, ToDevice toDevice, String sdpContent, Event errorEvent, Event okEvent)
      发送回放点播命令(带事件)
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      sdpContent - SDP内容
      errorEvent - 错误事件
      okEvent - 成功事件
      Returns:
      callId
    • sendInvitePlayControlCommand

      public static String sendInvitePlayControlCommand(FromDevice fromDevice, ToDevice toDevice, String controlContent)
      发送点播控制命令(暂停、继续、快进等)
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      controlContent - 控制内容
      Returns:
      callId
    • sendRegisterCommand

      public static String sendRegisterCommand(FromDevice fromDevice, ToDevice toDevice, Integer expires)
      发送注册命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      expires - 过期时间
      Returns:
      callId
    • sendRegisterCommand

      public static String sendRegisterCommand(FromDevice fromDevice, ToDevice toDevice, Integer expires, Event event)
      发送注册命令(带事件)
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      expires - 过期时间
      event - 事件
      Returns:
      callId
    • sendUnregisterCommand

      public static String sendUnregisterCommand(FromDevice fromDevice, ToDevice toDevice)
      发送注销命令
      Parameters:
      fromDevice - 发送设备
      toDevice - 接收设备
      Returns:
      callId
    • builder

      public static ClientCommandSender.CommandBuilder builder()
      创建命令建造者
      Returns:
      命令建造者