Commit 4fc9d620 authored by claes's avatar claes

*** empty log message ***

parent bf2579a6
This diff is collapsed.
/* /*
* Proview $Id: opc_provider.h,v 1.2 2007-03-02 08:52:20 claes Exp $ * Proview $Id: opc_provider.h,v 1.3 2007-03-08 07:26:29 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -22,12 +22,15 @@ ...@@ -22,12 +22,15 @@
#include "co_provider.h" #include "co_provider.h"
#include "co_procom.h" #include "co_procom.h"
#include "pwr_opcclasses.h"
#include "opc_soap_H.h" #include "opc_soap_H.h"
class opc_provider : public co_provider { class opc_provider : public co_provider {
public: public:
opc_provider( pvd_eEnv env = pvd_eEnv_Wb) : co_provider(env), root(0), next_oix(1) {} opc_provider( pvd_eEnv env = pvd_eEnv_Wb) : co_provider(env), root(0), next_oix(1) {
memset( &server_state, 0, sizeof(server_state));
}
virtual void object( co_procom *pcom); virtual void object( co_procom *pcom);
virtual void objectOid( co_procom *pcom, pwr_tOix oix); virtual void objectOid( co_procom *pcom, pwr_tOix oix);
virtual void objectName( co_procom *pcom, char *name); virtual void objectName( co_procom *pcom, char *name);
...@@ -61,10 +64,13 @@ public: ...@@ -61,10 +64,13 @@ public:
void insert_object( pwr_tOix fth, pwr_tOix bws, ns1__BrowseElement *element, void insert_object( pwr_tOix fth, pwr_tOix bws, ns1__BrowseElement *element,
int first, int last, int load_children); int first, int last, int load_children);
void get_server_state();
vector<procom_obj> m_list; vector<procom_obj> m_list;
pwr_tOix root; pwr_tOix root;
pwr_tOix next_oix; pwr_tOix next_oix;
struct soap soap; struct soap soap;
pwr_sClass_Opc_ServerState server_state;
}; };
#endif #endif
This diff is collapsed.
...@@ -6294,7 +6294,9 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__ItemProperty(struct soap *soap, const ch ...@@ -6294,7 +6294,9 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__ItemProperty(struct soap *soap, const ch
if (((ns1__ItemProperty *)a)->ResultID) if (((ns1__ItemProperty *)a)->ResultID)
soap_set_attr(soap, "ResultID", soap_QName2s(soap, ((ns1__ItemProperty *)a)->ResultID->c_str())); soap_set_attr(soap, "ResultID", soap_QName2s(soap, ((ns1__ItemProperty *)a)->ResultID->c_str()));
soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__ItemProperty), type); soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__ItemProperty), type);
soap_outliteral(soap, "ns1:Value", &(((ns1__ItemProperty*)a)->Value), NULL); /* !! Value type added !! */
soap_outliteral(soap, "ns1:Value", &(((ns1__ItemProperty*)a)->Value),
((ns1__ItemProperty*)a)->ValueType);
/* transient soap skipped */ /* transient soap skipped */
soap_element_end_out(soap, tag); soap_element_end_out(soap, tag);
return SOAP_OK; return SOAP_OK;
...@@ -6407,7 +6409,9 @@ SOAP_FMAC3 ns1__ItemProperty * SOAP_FMAC4 soap_in_ns1__ItemProperty(struct soap ...@@ -6407,7 +6409,9 @@ SOAP_FMAC3 ns1__ItemProperty * SOAP_FMAC4 soap_in_ns1__ItemProperty(struct soap
if (soap_flag_Value1 && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_flag_Value1 && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))
if (soap_inliteral(soap, "ns1:Value", &(((ns1__ItemProperty*)a)->Value))) if (soap_inliteral(soap, "ns1:Value", &(((ns1__ItemProperty*)a)->Value)))
{ soap_flag_Value1--; { soap_flag_Value1--;
continue; /* !! Extract type !! */
strcpy( ((ns1__ItemValue*)a)->ValueType, soap->type);
continue;
} }
/* transient soap skipped */ /* transient soap skipped */
if (soap->error == SOAP_TAG_MISMATCH) if (soap->error == SOAP_TAG_MISMATCH)
...@@ -10101,7 +10105,8 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__ItemValue(struct soap *soap, const char ...@@ -10101,7 +10105,8 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__ItemValue(struct soap *soap, const char
soap_set_attr(soap, "ResultID", soap_QName2s(soap, ((ns1__ItemValue *)a)->ResultID->c_str())); soap_set_attr(soap, "ResultID", soap_QName2s(soap, ((ns1__ItemValue *)a)->ResultID->c_str()));
soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__ItemValue), type); soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__ItemValue), type);
soap_out_PointerTostd__string(soap, "ns1:DiagnosticInfo", -1, &(((ns1__ItemValue*)a)->DiagnosticInfo), ""); soap_out_PointerTostd__string(soap, "ns1:DiagnosticInfo", -1, &(((ns1__ItemValue*)a)->DiagnosticInfo), "");
soap_outliteral(soap, "ns1:Value", &(((ns1__ItemValue*)a)->Value), NULL); /* !! Value type added !! */
soap_outliteral(soap, "ns1:Value", &(((ns1__ItemValue*)a)->Value), ((ns1__ItemValue*)a)->ValueType);
soap_out_PointerTons1__OPCQuality(soap, "ns1:Quality", -1, &(((ns1__ItemValue*)a)->Quality), ""); soap_out_PointerTons1__OPCQuality(soap, "ns1:Quality", -1, &(((ns1__ItemValue*)a)->Quality), "");
/* transient soap skipped */ /* transient soap skipped */
soap_element_end_out(soap, tag); soap_element_end_out(soap, tag);
...@@ -10237,6 +10242,8 @@ SOAP_FMAC3 ns1__ItemValue * SOAP_FMAC4 soap_in_ns1__ItemValue(struct soap *soap, ...@@ -10237,6 +10242,8 @@ SOAP_FMAC3 ns1__ItemValue * SOAP_FMAC4 soap_in_ns1__ItemValue(struct soap *soap,
if (soap_flag_Value1 && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_flag_Value1 && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))
if (soap_inliteral(soap, "ns1:Value", &(((ns1__ItemValue*)a)->Value))) if (soap_inliteral(soap, "ns1:Value", &(((ns1__ItemValue*)a)->Value)))
{ soap_flag_Value1--; { soap_flag_Value1--;
/* !! Extract type !! */
strcpy( ((ns1__ItemValue*)a)->ValueType, soap->type);
continue; continue;
} }
if (soap_flag_Quality1 && soap->error == SOAP_TAG_MISMATCH) if (soap_flag_Quality1 && soap->error == SOAP_TAG_MISMATCH)
......
...@@ -218,6 +218,7 @@ class SOAP_CMAC ns1__ItemValue ...@@ -218,6 +218,7 @@ class SOAP_CMAC ns1__ItemValue
public: public:
std::string *DiagnosticInfo; /* optional element of type xsd:string */ std::string *DiagnosticInfo; /* optional element of type xsd:string */
char *Value; /* optional element of type xsd:anyType */ char *Value; /* optional element of type xsd:anyType */
char ValueType[80]; /* !! Value type added !! */
class ns1__OPCQuality *Quality; /* optional element of type ns1:OPCQuality */ class ns1__OPCQuality *Quality; /* optional element of type ns1:OPCQuality */
std::string *ValueTypeQualifier; /* optional attribute */ std::string *ValueTypeQualifier; /* optional attribute */
std::string *ItemPath; /* optional attribute */ std::string *ItemPath; /* optional attribute */
...@@ -752,6 +753,7 @@ class SOAP_CMAC ns1__ItemProperty ...@@ -752,6 +753,7 @@ class SOAP_CMAC ns1__ItemProperty
{ {
public: public:
char *Value; /* optional element of type xsd:anyType */ char *Value; /* optional element of type xsd:anyType */
char ValueType[80]; /* !! Added to insert value type !! */
std::string Name; /* required attribute */ std::string Name; /* required attribute */
std::string *Description; /* optional attribute */ std::string *Description; /* optional attribute */
std::string *ItemPath; /* optional attribute */ std::string *ItemPath; /* optional attribute */
......
/* /*
* Proview $Id: opc_utl.cpp,v 1.2 2007-03-05 14:56:51 claes Exp $ * Proview $Id: opc_utl.cpp,v 1.3 2007-03-08 07:26:29 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -22,6 +22,24 @@ ...@@ -22,6 +22,24 @@
#include "opc_utl.h" #include "opc_utl.h"
#include "opc_soap_Stub.h" #include "opc_soap_Stub.h"
static char opc_PropertyNames[17][20] = {"dataType",
"value",
"quality",
"timestamp",
"accessRights",
"scanRate",
"euType",
"euInfo",
"engineeringUnits",
"description",
"highEU",
"lowEU",
"highIR",
"lowIR",
"closeLabel",
"openLabel",
"timeZone"};
// //
// Return the corresponding opc type string for a pwr_eType // Return the corresponding opc type string for a pwr_eType
// //
...@@ -82,38 +100,47 @@ bool opc_pwrtype_to_string( int type, char **str) ...@@ -82,38 +100,47 @@ bool opc_pwrtype_to_string( int type, char **str)
void opc_mask_to_propertynames( std::vector<std::string>& pnames, unsigned int mask) void opc_mask_to_propertynames( std::vector<std::string>& pnames, unsigned int mask)
{ {
if ( mask & opc_mProperty_DataType) unsigned int m;
pnames.push_back( std::string("dataName"));
if ( mask & opc_mProperty_Value) for ( int i = 0; i < opc_cPropertySize; i++) {
pnames.push_back( std::string("value")); m = 1 << i;
if ( mask & opc_mProperty_Quality) if ( mask & m)
pnames.push_back( std::string("quality")); pnames.push_back( std::string( opc_PropertyNames[i]));
if ( mask & opc_mProperty_Timestamp) }
pnames.push_back( std::string("timestamp")); }
if ( mask & opc_mProperty_ScanRate)
pnames.push_back( std::string("scanRate")); bool opc_get_property( std::vector<ns1__ItemProperty *> properties, unsigned int mask,
if ( mask & opc_mProperty_EuType) char **valp)
pnames.push_back( std::string("euType")); {
if ( mask & opc_mProperty_EuInfo) char name[80];
pnames.push_back( std::string("euInfo")); char *s;
if ( mask & opc_mProperty_EngineeringUnits) int idx = -1;
pnames.push_back( std::string("engineeringUnits"));
if ( mask & opc_mProperty_Description) for ( int i = 0; i < opc_cPropertySize; i++) {
pnames.push_back( std::string("description")); if ( (unsigned int)(1 << i) == mask) {
if ( mask & opc_mProperty_HighEU) idx = i;
pnames.push_back( std::string("highEU")); break;
if ( mask & opc_mProperty_LowEU) }
pnames.push_back( std::string("lowEU")); }
if ( mask & opc_mProperty_HighIR) if ( idx == -1)
pnames.push_back( std::string("highIR")); return false;
if ( mask & opc_mProperty_LowIR)
pnames.push_back( std::string("lowIR")); for ( int i = 0; i < (int)properties.size(); i++) {
if ( mask & opc_mProperty_CloseLabel)
pnames.push_back( std::string("closeLabel")); strcpy( name, properties[i]->Name.c_str());
if ( mask & opc_mProperty_OpenLabel) if ( (s = strrchr( name, ':')))
pnames.push_back( std::string("openLabel")); s++;
if ( mask & opc_mProperty_TimeZone) else
pnames.push_back( std::string("timeZone")); s = name;
if ( strcmp( s, opc_PropertyNames[idx]) == 0) {
if ( !properties[0]->Value)
return false;
*valp = properties[i]->Value;
return true;
}
}
return false;
} }
bool opc_propertynames_to_mask( std::vector<std::string>& pnames, unsigned int *mask) bool opc_propertynames_to_mask( std::vector<std::string>& pnames, unsigned int *mask)
...@@ -215,3 +242,62 @@ bool opc_propertynames_to_mask( std::vector<std::string>& pnames, unsigned int * ...@@ -215,3 +242,62 @@ bool opc_propertynames_to_mask( std::vector<std::string>& pnames, unsigned int *
} }
return true; return true;
} }
bool opc_quality_to_string( int quality, char **str)
{
*str = (char *) malloc(30);
switch ( quality) {
case ns1__qualityBits__bad:
strcpy( *str, "bad");
break;
case ns1__qualityBits__badConfigurationError:
strcpy( *str, "badConfigurationError");
break;
case ns1__qualityBits__badNotConnected:
strcpy( *str, "badNotConnected");
break;
case ns1__qualityBits__badDeviceFailure:
strcpy( *str, "badDeviceFailure");
break;
case ns1__qualityBits__badSensorFailure:
strcpy( *str, "badSensorFailure");
break;
case ns1__qualityBits__badLastKnownValue:
strcpy( *str, "badLastKnownValue");
break;
case ns1__qualityBits__badCommFailure:
strcpy( *str, "badCommFailure");
break;
case ns1__qualityBits__badOutOfService:
strcpy( *str, "badOutOfService");
break;
case ns1__qualityBits__badWaitingForInitialData:
strcpy( *str, "badWaitingForInitialData");
break;
case ns1__qualityBits__uncertain:
strcpy( *str, "uncertain");
break;
case ns1__qualityBits__uncertainLastUsableValue:
strcpy( *str, "uncertainLastUsableValue");
break;
case ns1__qualityBits__uncertainSensorNotAccurate:
strcpy( *str, "uncertainSensorNotAccurate");
break;
case ns1__qualityBits__uncertainEUExceeded:
strcpy( *str, "uncertainEUExceede");
break;
case ns1__qualityBits__uncertainSubNormal:
strcpy( *str, "uncertainSubNormal");
break;
case ns1__qualityBits__good:
strcpy( *str, "good");
break;
case ns1__qualityBits__goodLocalOverride:
strcpy( *str, "goodLocalOverride");
break;
default:
return false;
}
return true;
}
/* /*
* Proview $Id: opc_utl.h,v 1.2 2007-03-05 14:56:51 claes Exp $ * Proview $Id: opc_utl.h,v 1.3 2007-03-08 07:26:29 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -20,26 +20,37 @@ ...@@ -20,26 +20,37 @@
#include <vector.h> #include <vector.h>
#include <string.h> #include <string.h>
#include "pwr.h" #include "pwr.h"
#include "opc_soap_Stub.h"
const int opc_cPropertySize = 17;
typedef enum { typedef enum {
opc_mProperty_DataType = 1 << 0, opc_mProperty_DataType = 1 << 0,
opc_mProperty_Value = 1 << 1, opc_mProperty_Value = 1 << 1,
opc_mProperty_Quality = 1 << 2, opc_mProperty_Quality = 1 << 2,
opc_mProperty_Timestamp = 1 << 3, opc_mProperty_Timestamp = 1 << 3,
opc_mProperty_ScanRate = 1 << 4, opc_mProperty_AccessRights = 1 << 4,
opc_mProperty_EuType = 1 << 5, opc_mProperty_ScanRate = 1 << 5,
opc_mProperty_EuInfo = 1 << 6, opc_mProperty_EuType = 1 << 6,
opc_mProperty_EngineeringUnits = 1 << 7, opc_mProperty_EuInfo = 1 << 7,
opc_mProperty_Description = 1 << 8, opc_mProperty_EngineeringUnits = 1 << 8,
opc_mProperty_HighEU = 1 << 9, opc_mProperty_Description = 1 << 9,
opc_mProperty_LowEU = 1 << 10, opc_mProperty_HighEU = 1 << 10,
opc_mProperty_HighIR = 1 << 11, opc_mProperty_LowEU = 1 << 11,
opc_mProperty_LowIR = 1 << 12, opc_mProperty_HighIR = 1 << 12,
opc_mProperty_CloseLabel = 1 << 13, opc_mProperty_LowIR = 1 << 13,
opc_mProperty_OpenLabel = 1 << 14, opc_mProperty_CloseLabel = 1 << 14,
opc_mProperty_TimeZone = 1 << 15 opc_mProperty_OpenLabel = 1 << 15,
opc_mProperty_TimeZone = 1 << 16
} opc_mProperty; } opc_mProperty;
bool opc_pwrtype_to_string( int type, char **str); bool opc_pwrtype_to_string( int type, char **str);
bool opc_get_property( std::vector<ns1__ItemProperty *> properties, unsigned int mask,
char **valp);
void opc_mask_to_propertynames( std::vector<std::string>& pnames, unsigned int mask); void opc_mask_to_propertynames( std::vector<std::string>& pnames, unsigned int mask);
bool opc_propertynames_to_mask( std::vector<std::string>& pnames, unsigned int *mask); bool opc_propertynames_to_mask( std::vector<std::string>& pnames, unsigned int *mask);
bool opc_quality_to_string( int quality, char **str);
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment