|  |  |  | 
|---|
|  |  |  | package com.genersoft.iot.vmp.gb28181.auth; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.impl.VideoManagerStoragerImpl; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.impl.VideoManagerStorageImpl; | 
|---|
|  |  |  | import org.slf4j.Logger; | 
|---|
|  |  |  | import org.slf4j.LoggerFactory; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | private SIPCommander cmder; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private VideoManagerStoragerImpl storager; | 
|---|
|  |  |  | private VideoManagerStorageImpl storager; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void onRegister(Device device) { | 
|---|
|  |  |  | // 只有第一次注册时调用查询设备信息,如需更新调用更新API接口 | 
|---|
|  |  |  | // TODO 此处错误无法获取到通道 | 
|---|
|  |  |  | Device device1 = storager.queryVideoDevice(device.getDeviceId()); | 
|---|
|  |  |  | if (device.isFirsRegister()) { | 
|---|
|  |  |  | logger.info("[{}] 首次注册,查询设备信息以及通道信息", device.getDeviceId()); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Thread.sleep(100); | 
|---|
|  |  |  | cmder.deviceInfoQuery(device); | 
|---|
|  |  |  | Thread.sleep(100); | 
|---|
|  |  |  | cmder.catalogQuery(device, null); | 
|---|
|  |  |  | } catch (InterruptedException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //      // TODO 此处错误无法获取到通道 | 
|---|
|  |  |  | //      Device device1 = storager.queryVideoDevice(device.getDeviceId()); | 
|---|
|  |  |  | //      if (device.isFirsRegister()) { | 
|---|
|  |  |  | //         logger.info("[{}] 首次注册,查询设备信息以及通道信息", device.getDeviceId()); | 
|---|
|  |  |  | //         try { | 
|---|
|  |  |  | //            Thread.sleep(100); | 
|---|
|  |  |  | //            cmder.deviceInfoQuery(device); | 
|---|
|  |  |  | //            Thread.sleep(100); | 
|---|
|  |  |  | //            cmder.catalogQuery(device, null); | 
|---|
|  |  |  | //         } catch (InterruptedException e) { | 
|---|
|  |  |  | //            e.printStackTrace(); | 
|---|
|  |  |  | //         } | 
|---|
|  |  |  | //      } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|