优化订阅信息的发送与取消订阅
This commit is contained in:
@@ -4,8 +4,8 @@ import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.service.bean.CatalogSubscribeTask;
|
||||
import com.genersoft.iot.vmp.service.bean.MobilePositionSubscribeTask;
|
||||
import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask;
|
||||
import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeTask;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -42,7 +42,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
int subscribeCycleForCatalog = device.getSubscribeCycleForCatalog();
|
||||
// 设置最小值为30
|
||||
subscribeCycleForCatalog = Math.max(subscribeCycleForCatalog, 30);
|
||||
dynamicTask.startCron(device.getDeviceId() + "catalog", catalogSubscribeTask, subscribeCycleForCatalog - 5);
|
||||
dynamicTask.startCron(device.getDeviceId() + "catalog", catalogSubscribeTask, subscribeCycleForCatalog);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -53,8 +53,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
logger.info("移除目录订阅: {}", device.getDeviceId());
|
||||
dynamicTask.stop(device.getDeviceId() + "catalog");
|
||||
device.setSubscribeCycleForCatalog(0);
|
||||
sipCommander.catalogSubscribe(device, null, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -75,7 +73,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
int subscribeCycleForCatalog = device.getSubscribeCycleForCatalog();
|
||||
// 设置最小值为30
|
||||
subscribeCycleForCatalog = Math.max(subscribeCycleForCatalog, 30);
|
||||
dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, subscribeCycleForCatalog - 5);
|
||||
dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, subscribeCycleForCatalog -1 );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -86,8 +84,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
logger.info("移除移动位置订阅: {}", device.getDeviceId());
|
||||
dynamicTask.stop(device.getDeviceId() + "mobile_position");
|
||||
device.setSubscribeCycleForCatalog(0);
|
||||
sipCommander.mobilePositionSubscribe(device, null, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user