移除多余代码
parent
1f6a2f3fdb
commit
cb5a09214a
|
@ -15,7 +15,7 @@ import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask;
|
|||
import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeTask;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
@ -63,7 +63,7 @@ public class DeviceQuery {
|
|||
private IInviteStreamService inviteStreamService;
|
||||
|
||||
@Autowired
|
||||
private SIPCommander cmder;
|
||||
private ISIPCommander cmder;
|
||||
|
||||
@Autowired
|
||||
private DeferredResultHolder resultHolder;
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.genersoft.iot.vmp.gb28181.event;
|
|||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.device.RequestTimeoutEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition.MobilePositionEvent;
|
||||
|
@ -13,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sip.TimeoutEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -53,12 +51,6 @@ public class EventPublisher {
|
|||
}
|
||||
|
||||
|
||||
public void requestTimeOut(TimeoutEvent timeoutEvent) {
|
||||
RequestTimeoutEvent requestTimeoutEvent = new RequestTimeoutEvent(this);
|
||||
requestTimeoutEvent.setTimeoutEvent(timeoutEvent);
|
||||
applicationEventPublisher.publishEvent(requestTimeoutEvent);
|
||||
}
|
||||
|
||||
public void catalogEventPublish(Platform platform, CommonGBChannel deviceChannel, String type) {
|
||||
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
||||
deviceChannelList.add(deviceChannel);
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package com.genersoft.iot.vmp.gb28181.event.device;
|
||||
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import javax.sip.TimeoutEvent;
|
||||
|
||||
/**
|
||||
* @author lin
|
||||
*/
|
||||
public class RequestTimeoutEvent extends ApplicationEvent {
|
||||
public RequestTimeoutEvent(Object source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
|
||||
private TimeoutEvent timeoutEvent;
|
||||
|
||||
public TimeoutEvent getTimeoutEvent() {
|
||||
return timeoutEvent;
|
||||
}
|
||||
|
||||
public void setTimeoutEvent(TimeoutEvent timeoutEvent) {
|
||||
this.timeoutEvent = timeoutEvent;
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package com.genersoft.iot.vmp.gb28181.event.device;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sip.ClientTransaction;
|
||||
import javax.sip.address.SipURI;
|
||||
import javax.sip.message.Request;
|
||||
|
||||
/**
|
||||
* @author lin
|
||||
*/
|
||||
@Component
|
||||
public class RequestTimeoutEventImpl implements ApplicationListener<RequestTimeoutEvent> {
|
||||
|
||||
@Autowired
|
||||
private IDeviceService deviceService;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(RequestTimeoutEvent event) {
|
||||
ClientTransaction clientTransaction = event.getTimeoutEvent().getClientTransaction();
|
||||
if (clientTransaction != null) {
|
||||
Request request = clientTransaction.getRequest();
|
||||
if (request != null) {
|
||||
String host = ((SipURI) request.getRequestURI()).getHost();
|
||||
int port = ((SipURI) request.getRequestURI()).getPort();
|
||||
Device device = deviceService.getDeviceByHostAndPort(host, port);
|
||||
if (device == null) {
|
||||
return;
|
||||
}
|
||||
deviceService.offline(device.getDeviceId(), "等待消息超时");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -190,13 +190,13 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
|
||||
@Override
|
||||
public void offline(String deviceId, String reason) {
|
||||
log.warn("[设备离线],{}, device:{}", reason, deviceId);
|
||||
Device device = getDeviceByDeviceIdFromDb(deviceId);
|
||||
if (device == null) {
|
||||
log.warn("[设备不存在] device:{}", deviceId);
|
||||
return;
|
||||
}
|
||||
log.info("[设备离线] device:{}, 心跳间隔: {},心跳超时次数: {}, 上次心跳时间:{}, 上次注册时间: {}", deviceId,
|
||||
// TODO 主动查询设备状态
|
||||
log.info("[设备离线] {}, device:{}, 心跳间隔: {},心跳超时次数: {}, 上次心跳时间:{}, 上次注册时间: {}", reason, deviceId,
|
||||
device.getHeartBeatInterval(), device.getHeartBeatCount(), device.getKeepaliveTime(), device.getRegisterTime());
|
||||
String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + deviceId;
|
||||
dynamicTask.stop(registerExpireTaskKey);
|
||||
|
@ -407,7 +407,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
log.error("[命令发送失败] 设备状态查询: {}", e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,45 +23,6 @@ import java.text.ParseException;
|
|||
*/
|
||||
public interface ISIPCommander {
|
||||
|
||||
/**
|
||||
* 云台方向放控制,使用配置文件中的默认镜头移动速度
|
||||
*
|
||||
* @param device 控制设备
|
||||
* @param channelId 预览通道
|
||||
* @param leftRight 镜头左移右移 0:停止 1:左移 2:右移
|
||||
* @param upDown 镜头上移下移 0:停止 1:上移 2:下移
|
||||
*/
|
||||
void ptzdirectCmd(Device device,String channelId,int leftRight, int upDown) throws InvalidArgumentException, ParseException, SipException;
|
||||
|
||||
/**
|
||||
* 云台方向放控制
|
||||
*
|
||||
* @param device 控制设备
|
||||
* @param channelId 预览通道
|
||||
* @param leftRight 镜头左移右移 0:停止 1:左移 2:右移
|
||||
* @param upDown 镜头上移下移 0:停止 1:上移 2:下移
|
||||
* @param moveSpeed 镜头移动速度
|
||||
*/
|
||||
void ptzdirectCmd(Device device,String channelId,int leftRight, int upDown, int moveSpeed) throws InvalidArgumentException, ParseException, SipException;
|
||||
|
||||
/**
|
||||
* 云台缩放控制,使用配置文件中的默认镜头缩放速度
|
||||
*
|
||||
* @param device 控制设备
|
||||
* @param channelId 预览通道
|
||||
* @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大
|
||||
*/
|
||||
void ptzZoomCmd(Device device,String channelId,int inOut) throws InvalidArgumentException, ParseException, SipException;
|
||||
|
||||
/**
|
||||
* 云台缩放控制
|
||||
*
|
||||
* @param device 控制设备
|
||||
* @param channelId 预览通道
|
||||
* @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大
|
||||
*/
|
||||
void ptzZoomCmd(Device device,String channelId,int inOut, int moveSpeed) throws InvalidArgumentException, ParseException, SipException;
|
||||
|
||||
/**
|
||||
* 云台控制,支持方向与缩放控制
|
||||
*
|
||||
|
@ -323,7 +284,6 @@ public interface ISIPCommander {
|
|||
* @param expires 订阅过期时间(0 = 取消订阅)
|
||||
* @param startPriority 报警起始级别(可选)
|
||||
* @param endPriority 报警终止级别(可选)
|
||||
* @param alarmType 报警类型
|
||||
* @param startTime 报警发生起始时间(可选)
|
||||
* @param endTime 报警发生终止时间(可选)
|
||||
* @return true = 命令发送成功
|
||||
|
|
Loading…
Reference in New Issue