|  |  | 
 |  |  |  | 
 |  |  | import com.genersoft.iot.vmp.conf.SipConfig; | 
 |  |  | import com.genersoft.iot.vmp.gb28181.bean.Device; | 
 |  |  | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 
 |  |  | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 
 |  |  | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 
 |  |  | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | 
 |  |  | 
 |  |  | import javax.sip.header.FromHeader; | 
 |  |  | import javax.sip.message.Response; | 
 |  |  | import java.text.ParseException; | 
 |  |  |  | 
 |  |  | import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText; | 
 |  |  |  | 
 |  |  | @Component | 
 |  |  | public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { | 
 |  |  | 
 |  |  |         FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); | 
 |  |  |         // 回复200 OK | 
 |  |  |         try { | 
 |  |  |              responseAck((SIPRequest) evt.getRequest(), Response.OK); | 
 |  |  |             responseAck((SIPRequest) evt.getRequest(), Response.OK); | 
 |  |  |         } catch (SipException | InvalidArgumentException | ParseException e) { | 
 |  |  |             logger.error("[命令发送失败] 国标级联 DeviceStatus查询回复200OK: {}", e.getMessage()); | 
 |  |  |         } | 
 |  |  |         String sn = rootElement.element("SN").getText(); | 
 |  |  |         String channelId = getText(rootElement, "DeviceID"); | 
 |  |  |         DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(parentPlatform.getServerGBId(), channelId); | 
 |  |  |         if (deviceChannel ==null){ | 
 |  |  |             logger.error("[平台没有该通道的使用权限]:platformId"+parentPlatform.getServerGBId()+"  deviceID:"+channelId); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         try { | 
 |  |  |             cmderFroPlatform.deviceStatusResponse(parentPlatform, sn, fromHeader.getTag()); | 
 |  |  |             cmderFroPlatform.deviceStatusResponse(parentPlatform,channelId, sn, fromHeader.getTag(),deviceChannel.isStatus()); | 
 |  |  |         } catch (SipException | InvalidArgumentException | ParseException e) { | 
 |  |  |             logger.error("[命令发送失败] 国标级联 DeviceStatus查询回复: {}", e.getMessage()); | 
 |  |  |         } |