本文已参与「新人创作礼」活动,一起开启掘金创作之路。
一、获取IPC设备设备基本信息
上一篇文章介绍了如何搜索IPC摄像头,搜索出IPC后,就有了该IPC的Web Services地址:http://192.168.100.123:8099/onvif/device_service,接下来就能获取IPC摄像头的基本信息:
1、创建tcp socket,IP为192.168.100.123,端口:8099;
2、通过ONVIF Device Test Tool工具得到GetDeviceInformation数据
3、向socket发送(send)数据:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:tds="http://www.onvif.org/ver10/device/wsdl"
xmlns:tt="http://www.onvif.org/ver10/schema">
<soap:Body>
<tds:GetDeviceInformation />
</soap:Body>
</soap:Envelope>
4、接受(recv)数据
HTTP/1.1 200 OK
Server: gSOAP/2.7
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 3145
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2000/10/XMLSchema"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsa5="http://www.w3.org/2005/08/addressing"
xmlns:xop="http://www.w3.org/2004/08/xop/include"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:tt="http://www.onvif.org/ver10/schema"
xmlns:ns1="http://www.w3.org/2005/05/xmlmime"
xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
xmlns:ns7="http://docs.oasis-open.org/wsrf/r-2"
xmlns:ns2="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:dndl="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding"
xmlns:dnrd="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding"
xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery"
xmlns:dn="http://www.onvif.org/ver10/network/wsdl"
xmlns:ns10="http://www.onvif.org/ver10/replay/wsdl"
xmlns:ns11="http://www.onvif.org/ver10/search/wsdl"
xmlns:ns13="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding"
xmlns:ns14="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding"
xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl"
xmlns:ns15="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding"
xmlns:ns16="http://www.onvif.org/ver10/events/wsdl/EventBinding"
xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
xmlns:ns17="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding"
xmlns:ns18="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding"
xmlns:ns19="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding"
xmlns:ns20="http://www.onvif.org/ver10/events/wsdl/PullPointBinding"
xmlns:ns21="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding"
xmlns:ns22="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding"
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
xmlns:ns3="http://www.onvif.org/ver10/analyticsdevice/wsdl"
xmlns:ns4="http://www.onvif.org/ver10/deviceIO/wsdl"
xmlns:ns5="http://www.onvif.org/ver10/display/wsdl"
xmlns:ns8="http://www.onvif.org/ver10/receiver/wsdl"
xmlns:ns9="http://www.onvif.org/ver10/recording/wsdl"
xmlns:tds="http://www.onvif.org/ver10/device/wsdl"
xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl"
xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl"
xmlns:trt="http://www.onvif.org/ver10/media/wsdl"
xmlns:trt2="http://www.onvif.org/ver20/media/wsdl"
xmlns:ter="http://www.onvif.org/ver10/error"
xmlns:tns1="http://www.onvif.org/ver10/topics"
xmlns:tnsn="http://www.eventextension.com/2011/event/topics">
<SOAP-ENV:Body><tds:GetDeviceInformationResponse>
<tds:Manufacturer>H264</tds:Manufacturer>
<tds:Model>50X10_32M</tds:Model>
<tds:FirmwareVersion>V5.00.R02.00023650.10010.248201..ONVIF 2.41</tds:FirmwareVersion>
<tds:SerialNumber>7abe02981ea7ec68</tds:SerialNumber>
<tds:HardwareId>00001</tds:HardwareId>
</tds:GetDeviceInformationResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
5、解析上面接受到的数据,得到IPC摄像头设备的基本信息:
Manufacturer: H264
Model: 50X10_32M
Firmware Version: V5.00.R02.00023650.10010.248201..ONVIF 2.41
Serial Number: 7abe02981ea7ec68
Hardware Id: 00001