Class ClientCommandSender
java.lang.Object
io.github.lunasaw.gbproxy.client.transmit.cmd.ClientCommandSender
GB28181客户端命令发送器
使用策略模式和建造者模式,提供更灵活和可扩展的命令发送接口
- Author:
- luna
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
命令发送建造者 提供流式API,支持链式调用 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
创建命令建造者static String
sendAckCommand
(FromDevice fromDevice, ToDevice toDevice) 发送ACK响应命令static String
sendAckCommand
(FromDevice fromDevice, ToDevice toDevice, String callId) 发送ACK响应命令(指定callId)static String
sendAckCommand
(FromDevice fromDevice, ToDevice toDevice, String content, String callId) 发送ACK响应命令(带内容和callId)static String
sendAlarmCommand
(FromDevice fromDevice, ToDevice toDevice, DeviceAlarm deviceAlarm) 发送告警命令static String
sendAlarmCommand
(FromDevice fromDevice, ToDevice toDevice, DeviceAlarmNotify deviceAlarmNotify) 发送告警命令static String
sendByeCommand
(FromDevice fromDevice, ToDevice toDevice) 发送BYE请求命令static String
sendCatalogCommand
(FromDevice fromDevice, ToDevice toDevice, DeviceItem deviceItem) 发送目录命令static String
sendCatalogCommand
(FromDevice fromDevice, ToDevice toDevice, DeviceResponse deviceResponse) 发送目录命令static String
sendCatalogCommand
(FromDevice fromDevice, ToDevice toDevice, List<DeviceItem> deviceItems) 发送目录命令static String
sendCommand
(String commandType, FromDevice fromDevice, ToDevice toDevice, Event errorEvent, Event okEvent, Object... params) 使用策略模式发送命令(带事件)static String
sendCommand
(String commandType, FromDevice fromDevice, ToDevice toDevice, Object... params) 使用策略模式发送命令static String
sendCommand
(String commandType, FromDevice fromDevice, ToDevice toDevice, javax.sip.RequestEvent requestEvent, Object... params) 使用策略模式发送命令(支持事务上下文) 通过RequestEvent复用原请求的Call-ID,确保事务一致性static String
sendConfigDownloadResponse
(FromDevice fromDevice, ToDevice toDevice, ConfigDownloadResponse response) 发送设备配置查询应答static String
sendDeviceChannelUpdateCommand
(FromDevice fromDevice, ToDevice toDevice, List<DeviceUpdateItem> deviceItems) 发送设备通道更新通知命令static String
sendDeviceConfigCommand
(FromDevice fromDevice, ToDevice toDevice, DeviceConfigResponse deviceConfigResponse) 发送设备配置响应命令static String
sendDeviceInfoCommand
(FromDevice fromDevice, ToDevice toDevice, DeviceInfo deviceInfo) 发送设备信息响应命令static String
sendDeviceInfoCommand
(FromDevice fromDevice, ToDevice toDevice, DeviceInfo deviceInfo, javax.sip.RequestEvent requestEvent) 发送设备信息响应命令(支持事务上下文) 通过RequestEvent复用原请求的Call-ID,确保事务一致性static String
sendDeviceOtherUpdateCommand
(FromDevice fromDevice, ToDevice toDevice, List<DeviceOtherUpdateNotify.OtherItem> deviceItems) 发送设备其他更新通知命令static String
sendDeviceRecordCommand
(FromDevice fromDevice, ToDevice toDevice, DeviceRecord deviceRecord) 发送录像响应命令static String
sendDeviceRecordCommand
(FromDevice fromDevice, ToDevice toDevice, List<DeviceRecord.RecordItem> deviceRecordItems) 发送录像响应命令static String
sendDeviceStatusCommand
(FromDevice fromDevice, ToDevice toDevice, DeviceStatus deviceStatus) 发送设备状态响应命令static String
sendDeviceStatusCommand
(FromDevice fromDevice, ToDevice toDevice, String online) 发送设备状态响应命令static String
sendInvitePlayBackCommand
(FromDevice fromDevice, ToDevice toDevice, String sdpContent) 发送回放点播命令static String
sendInvitePlayBackCommand
(FromDevice fromDevice, ToDevice toDevice, String sdpContent, Event errorEvent, Event okEvent) 发送回放点播命令(带事件)static String
sendInvitePlayCommand
(FromDevice fromDevice, ToDevice toDevice, String sdpContent) 发送实时点播命令static String
sendInvitePlayCommand
(FromDevice fromDevice, ToDevice toDevice, String sdpContent, Event errorEvent, Event okEvent) 发送实时点播命令(带事件)static String
sendInvitePlayControlCommand
(FromDevice fromDevice, ToDevice toDevice, String controlContent) 发送点播控制命令(暂停、继续、快进等)static String
sendKeepaliveCommand
(FromDevice fromDevice, ToDevice toDevice, DeviceKeepLiveNotify deviceKeepLiveNotify) static String
sendKeepaliveCommand
(FromDevice fromDevice, ToDevice toDevice, String status) 发送心跳命令static String
sendMediaStatusCommand
(FromDevice fromDevice, ToDevice toDevice, String notifyType) 发送媒体状态通知命令static String
sendMobilePositionCommand
(FromDevice fromDevice, ToDevice toDevice, MobilePositionNotify mobilePositionNotify, SubscribeInfo subscribeInfo) 发送位置通知命令static String
sendMobilePositionNotify
(FromDevice fromDevice, ToDevice toDevice, MobilePositionNotify response) 发送设备预置位查询应答static String
sendPresetQueryResponse
(FromDevice fromDevice, ToDevice toDevice, PresetQueryResponse response) 发送设备预置位查询应答static String
sendRegisterCommand
(FromDevice fromDevice, ToDevice toDevice, Integer expires) 发送注册命令static String
sendRegisterCommand
(FromDevice fromDevice, ToDevice toDevice, Integer expires, Event event) 发送注册命令(带事件)static String
sendUnregisterCommand
(FromDevice fromDevice, ToDevice toDevice) 发送注销命令
-
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-IDparams
- 命令参数- 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
发送心跳命令- 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
发送BYE请求命令- Parameters:
fromDevice
- 发送设备toDevice
- 接收设备- Returns:
- callId
-
sendAckCommand
发送ACK响应命令- Parameters:
fromDevice
- 发送设备toDevice
- 接收设备- Returns:
- callId
-
sendAckCommand
发送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
发送注册命令- 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
发送注销命令- Parameters:
fromDevice
- 发送设备toDevice
- 接收设备- Returns:
- callId
-
builder
创建命令建造者- Returns:
- 命令建造者
-