|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SIPCommander cmder; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | if (deviceInStore == null) { //第一次上线 | 
|---|
|  |  |  | logger.info("[{}] 首次注册,查询设备信息以及通道信息", device.getDeviceId()); | 
|---|
|  |  |  | cmder.deviceInfoQuery(device); | 
|---|
|  |  |  | cmder.catalogQuery(device, null); | 
|---|
|  |  |  | deviceService.sync(device); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | // 设备主动发送心跳触发的在线事件 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 处理上线监听 | 
|---|
|  |  |  | storager.updateDevice(device); | 
|---|
|  |  |  | List<DeviceChannel> deviceChannelList = storager.queryOnlineChannelsByDeviceId(device.getDeviceId()); | 
|---|
|  |  |  | eventPublisher.catalogEventPublish(null, deviceChannelList, CatalogEvent.ON); | 
|---|
|  |  |  | // 上线添加订阅 | 
|---|
|  |  |  | if (device.getSubscribeCycleForCatalog() > 0) { | 
|---|
|  |  |  | // 查询在线设备那些开启了订阅,为设备开启定时的目录订阅 | 
|---|
|  |  |  | deviceService.addCatalogSubscribe(device); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (device.getSubscribeCycleForMobilePosition() > 0) { | 
|---|
|  |  |  | deviceService.addMobilePositionSubscribe(device); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|