Payalnick
Payalnick

Reputation: 1

How can a Qt ONVIF application be created?

I want to create an application to control camera parameters (users/ptz/get video). The camera is using the ONVIF protocol.

I am using Qt framework 5.13.

I found gsoap tool and .wsdl files from onfiv.com. Then i use guide from https://www.genivia.com/examples/onvif/index.html to create .h/.cpp files from devicemanagement.wsdl. I have generated one proxy class from devicemanagement.wsdl, and the program on Qt with generated files is working, but I need user authorization and ptz control...

How can I use gsoap, onvif specifications files(.wsdl) to generate class, which user authorization and ptz control for Qt?

Maybe someone makes the same application on Qt and can help me.

Upvotes: -1

Views: 799

Answers (1)

Dr. Alex RE
Dr. Alex RE

Reputation: 1698

Run wsdl2h on the ptz.wsdl:

wsdl2h -O4 -P -x -o onvif.h http://www.onvif.org/onvif/ver20/ptz/wsdl/ptz.wsdl

This assumes you have the typemap.dat file in the current directory with the ONVIF namespace bindings, see the ONVIF example to get that file.

Option -O4 aggressively "slices" the WSDL to reduce code size only to the necessary components, see article Schema Slicing Methods to Reduce Development Costs of WSDL-Based Web Services.

To generate C++ proxy classes:

soapcpp2 -C -j -2 -I gsoap/import onvif.h

The -C option specifies client-only, -j specifies proxy classes, -2 specifies SOAP 1.2 enforcement, -I is to import the necessary files.

If you need WS-Security authentication, then add the line:

#import "wsse.h"

to the onvif.h file if not already there, then rerun soapcpp2.

Compile:

c++ -O2 -I. -Igsoap/custom -o app soapPTZBindingProxy.cpp soapC.cpp dom.cpp stdsoap2.cpp wsseapi.c

Some source code files are generated, others are part of the gSOAP libraries.

The code generation tools have lots of options, so it depends a bit on what you want to accomplish.

If you want to use QT strings and types, then this can be done too with a modification of the typemap.dat file and by using the custom serializers located in gsoap/custom. For example, custom/qstring.h tells you to:

        To automate the wsdl2h-mapping of xsd:string to
        QString, add this line to the typemap.dat file:

        xsd__string = #import "custom/qstring.h" | xsd__string 

Then rerun wsdl2h to get the QT string binding. Compile custom/qtstring.cpp with your project.

Upvotes: 1

Related Questions