You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
4.6 KiB
138 lines
4.6 KiB
#ifndef __PROTOCOL_ONVIF_HEADER__
|
|
#define __PROTOCOL_ONVIF_HEADER__
|
|
|
|
#include "protocolHTTP.h"
|
|
#include "xmlParser.h"
|
|
#include "../../components/base/basicMutex.h"
|
|
|
|
#define ONE_WAY_TEMPLATE "<operation name=\"%s\"><input message=\"%s:%s\"/></operation>"
|
|
|
|
/*
|
|
device.GetSystemDateAndTime
|
|
<? xml version = "1.0" encoding = "UTF-8" ?>
|
|
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
|
<SOAP-ENV:Body>
|
|
<tds:GetSystemDateAndTime/>
|
|
</SOAP-ENV:Body>
|
|
</SOAP-ENV:Envelope>
|
|
|
|
GetDeviceInformation
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
|
|
xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
|
|
|
<SOAP-ENV:Body>
|
|
<tds:GetDeviceInformation/>
|
|
</SOAP-ENV:Body>
|
|
</SOAP-ENV:Envelope>
|
|
|
|
|
|
device.GetCapabilities
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
|
|
xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
|
<SOAP-ENV:Body>
|
|
<tds:GetCapabilities>
|
|
<tds:Category>All</tds:Category>
|
|
</tds:GetCapabilities>
|
|
</SOAP-ENV:Body>
|
|
</SOAP-ENV:Envelope>
|
|
|
|
*/
|
|
//GetProfiles
|
|
#define ONVIF_GetProfiles "<?xml version=\"1.0\" encoding=\"UTF-8\"?><soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:trt=\"http://www.onvif.org/ver10/media/wsdl\"><soap:Body><trt:GetProfiles/></soap:Body></soap:Envelope>"
|
|
//GetStreamURI
|
|
//#define ONVIF_GetStreamURI "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:trt=\"http://www.onvif.org/ver10/media/wsdl\" xmlns:tt=\"http://www.onvif.org/ver10/schema\"><soap:Body><trt:GetStreamUri><trt:StreamSetup><tt:Stream>RTP-Unicast</tt:Stream><tt:Transport><tt:Protocol>UDP</tt:Protocol></Transport></trt:StreamSetup><trt:ProfileToken>%s</trt:ProfileToken></trt:GetStreamUri></soap:Body></soap:Envelope>"
|
|
#define ONVIF_GetStreamURI "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:trt=\"http://www.onvif.org/ver10/media/wsdl\" xmlns:tt=\"http://www.onvif.org/ver10/schema\"><soap:Body><trt:GetStreamUri><trt:ProfileToken>%s</trt:ProfileToken></trt:GetStreamUri></soap:Body></soap:Envelope>"
|
|
/*
|
|
|
|
GetVideoSourceConfigurations
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
|
xmlns:trt="http://www.onvif.org/ver10/media/wsdl">
|
|
<soap:Body>
|
|
<trt:GetVideoSourceConfigurations />
|
|
</soap:Body>
|
|
</soap:Envelope>
|
|
|
|
|
|
|
|
ContinuousMove
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
|
xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl"
|
|
xmlns:tt="http://www.onvif.org/ver10/schema">
|
|
<soap:Body>
|
|
<tptz:ContinuousMove>
|
|
<tptz:ProfileToken>Profile1</tptz:ProfileToken>
|
|
<tptz:Velocity>
|
|
<tt:PanTilt x="1" y="1"/>
|
|
<tt:Zoom x="1"/>
|
|
</tptz:Velocity>
|
|
</tptz:ContinuousMove>
|
|
</soap:Body>
|
|
</soap:Envelope>
|
|
|
|
Stop
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
|
xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl">
|
|
<soap:Body>
|
|
<tptz:Stop>
|
|
<tptz:ProfileToken>Profile1</tptz:ProfileToken>
|
|
<tptz:PanTilt>true</tptz:PanTilt>
|
|
<tptz:Zoom>true</tptz:Zoom>
|
|
</tptz:Stop>
|
|
</soap:Body>
|
|
</soap:Envelope>
|
|
|
|
|
|
*/
|
|
#define ONVIF_REQUEST_TIMEOUT_TIME 10 // in Milliseconds
|
|
#define ONVIF_REQUEST_TIMEOUT_COUNT 1000 // 10 sec
|
|
|
|
typedef struct S_PROFILE_ONVIF {
|
|
CSTR pToken;
|
|
CSTR pNcode;
|
|
CSTR pName;
|
|
int nWidth;
|
|
int nHeight;
|
|
int nFramerate;
|
|
int nBitrate;
|
|
} profileONVIF;
|
|
|
|
|
|
typedef std::vector<profileONVIF *> vectorProfileOnvif;
|
|
|
|
/**
|
|
* TODO: Add class description
|
|
*
|
|
* @author gagua
|
|
*/
|
|
class protocolONVIF : public protocolHTTP {
|
|
private:
|
|
CSTR buildOneWayRequest(CSTR OPName, CSTR Prefix);
|
|
bool m_bRequestIsActive;
|
|
basicMutex *m_pRequestMutex;//???
|
|
bool m_bProtoIsBusy;
|
|
int m_nRequestTimeOut;
|
|
CSTR m_pStreamURI;
|
|
vectorProfileOnvif m_vProfiles;
|
|
protected:
|
|
basicTransport *m_oDataTransport;
|
|
//virtual bool packetHandler(unsigned char *Buffer, size_t BufferSize);
|
|
virtual bool packetHandler(protocolPackage *Package);
|
|
public:
|
|
// Constructor
|
|
protocolONVIF();
|
|
//ToDo: change Serial to BaseClass of some kind of socket
|
|
protocolONVIF( basicTransport *SocketTransport );
|
|
// Destructor
|
|
virtual ~protocolONVIF();
|
|
virtual bool init(){ return true; };
|
|
bool GetProfiles(CSTR URL);
|
|
CSTR GetStreamURI(CSTR URL, int profileID);
|
|
vectorProfileOnvif *GetAccessProfiles(void){ return &m_vProfiles; };
|
|
};
|
|
|
|
#endif
|