ONVIF:如何在EventBindingService::CreatePullPointSubscription中实现过滤器

问题描述 投票:0回答:1

我们正在使用 gSoap 2.8.106(因为这是 Yocto Kirkstone 提供的)。我们以 https://github.com/KoynovStas/onvif_srvd 为基础,开始实施 ONVIF S 和 T Profile。 T Profile 需要额外的事件过滤,如 EVENT-2-1-26-v17.06 基本通知界面 – 拉消息过滤器中的主题子树等测试所示。在

EventBindingService::CreatePullPointSubscription
中,您会收到一个
_tev__CreatePullPointSubscription
指针。有一个成员
Filter
指向
wsnt__FilterType
:

/* complex XML schema type 'tev:CreatePullPointSubscription': */
class SOAP_CMAC _tev__CreatePullPointSubscription {
      public:
        /// Optional element 'tev:Filter' of XML schema type 'wsnt:FilterType'
        wsnt__FilterType *Filter;

但是

wsnt__FilterType
里面什么都没有:

/* complex XML schema type 'wsnt:FilterType': */
class SOAP_CMAC wsnt__FilterType : public soap_dom_element {
      public:
        /// XML DOM element node graph
        std::vector<struct soap_dom_element> __any;

关于 gSOAP - ONVIF 示例:ONVIF_Extensibility 它解释:

ONVIF 数据类型可以扩展,允许附加元素和/或属性。但是,大多数与配置文件相关的场景不需要这些扩展,因此我们默认删除它们以减少生成的源代码的大小。

如果在特定情况下仍然需要复杂类型的特定元素和/或属性扩展,那么我们只需使用 typemap.dat 文件将它们作为附加可选成员添加到生成的类/结构中。

同样,我们将以下行添加到 typemap.dat,以将 wsnt:TopicExpression 元素添加到事件 ONVIF WSDL 的 tt:Events 的 tt:Filter 元素:

tt__EventFilter = $ wsnt__TopicExpressionType *wsnt__TopicExpression;

如果我这样做,那么

tt__EventFilter
会更改为:

class SOAP_CMAC tt__EventFilter : public wsnt__FilterType {
      public:
        /// XML DOM attribute list
        /// Typedef xsd__anyAttribute with custom serializer for struct soap_dom_attribute
        struct soap_dom_attribute __anyAttribute;
        /// Optional element 'wsnt:TopicExpression' of XML schema type 'wsnt:TopicExpressionType'
        wsnt__TopicExpressionType *wsnt__TopicExpression;

但这不是

wsnt__FilterType
,而是我从
_tev__CreatePullPointSubscription
得到的。那么这里的意图是什么?

我可以将

typemap.dat
中的行更改为:

wsnt__FilterType = $ wsnt__TopicExpressionType *wsnt__TopicExpression;

然后

wsnt__FilterType
变为:

class SOAP_CMAC wsnt__FilterType : public soap_dom_element {
      public:
        /// XML DOM element node graph
        std::vector<struct soap_dom_element> __any;
        /// Optional element 'wsnt:TopicExpression' of XML schema type 'wsnt:TopicExpressionType'
        wsnt__TopicExpressionType *wsnt__TopicExpression;

使用

wsnt__TopicExpressionType
我可以阅读
Dialect
但仅此而已。我如何阅读过滤器的其余详细信息?

一旦我阅读了过滤器,是否有任何地方可以实现它,或者我是否必须从头开始编写它?

c++ gsoap onvif
1个回答
0
投票

将以下行添加到传递到

wsdl/typemap.dat
wsdl2h
文件中:

wsnt__FilterType = $ std::vector<wsnt__TopicExpressionType*> TopicExpression            0;  ///< Multiple elements.
wsnt__FilterType = $ std::vector<wsnt__QueryExpressionType*> MessageContent             0;  ///< Multiple elements.

这将包括指定元素的序列化和反序列化代码。

您应该能够从

soap_dom_element
__any
:

获取主题表达式
std::string topic = topicExpression->__any.get_text();
© www.soinside.com 2019 - 2024. All rights reserved.