移除多余代码

2.7.3-20250312
lin 2025-03-11 15:11:45 +08:00
parent 1f6a2f3fdb
commit cb5a09214a
6 changed files with 4 additions and 117 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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(), "等待消息超时");
}
}
}
}

View File

@ -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

View File

@ -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 =