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.
*
* This program is free software; you can redistribute it and/or
......@@ -22,12 +22,15 @@
#include "co_provider.h"
#include "co_procom.h"
#include "pwr_opcclasses.h"
#include "opc_soap_H.h"
class opc_provider : public co_provider {
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 objectOid( co_procom *pcom, pwr_tOix oix);
virtual void objectName( co_procom *pcom, char *name);
......@@ -61,10 +64,13 @@ public:
void insert_object( pwr_tOix fth, pwr_tOix bws, ns1__BrowseElement *element,
int first, int last, int load_children);
void get_server_state();
vector<procom_obj> m_list;
pwr_tOix root;
pwr_tOix next_oix;
struct soap soap;
pwr_sClass_Opc_ServerState server_state;
};
#endif
This diff is collapsed.
......@@ -6294,7 +6294,9 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__ItemProperty(struct soap *soap, const ch
if (((ns1__ItemProperty *)a)->ResultID)
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_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 */
soap_element_end_out(soap, tag);
return SOAP_OK;
......@@ -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_inliteral(soap, "ns1:Value", &(((ns1__ItemProperty*)a)->Value)))
{ soap_flag_Value1--;
continue;
/* !! Extract type !! */
strcpy( ((ns1__ItemValue*)a)->ValueType, soap->type);
continue;
}
/* transient soap skipped */
if (soap->error == SOAP_TAG_MISMATCH)
......@@ -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_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_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), "");
/* transient soap skipped */
soap_element_end_out(soap, tag);
......@@ -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_inliteral(soap, "ns1:Value", &(((ns1__ItemValue*)a)->Value)))
{ soap_flag_Value1--;
/* !! Extract type !! */
strcpy( ((ns1__ItemValue*)a)->ValueType, soap->type);
continue;
}
if (soap_flag_Quality1 && soap->error == SOAP_TAG_MISMATCH)
......
......@@ -218,6 +218,7 @@ class SOAP_CMAC ns1__ItemValue
public:
std::string *DiagnosticInfo; /* optional element of type xsd:string */
char *Value; /* optional element of type xsd:anyType */
char ValueType[80]; /* !! Value type added !! */
class ns1__OPCQuality *Quality; /* optional element of type ns1:OPCQuality */
std::string *ValueTypeQualifier; /* optional attribute */
std::string *ItemPath; /* optional attribute */
......@@ -752,6 +753,7 @@ class SOAP_CMAC ns1__ItemProperty
{
public:
char *Value; /* optional element of type xsd:anyType */
char ValueType[80]; /* !! Added to insert value type !! */
std::string Name; /* required attribute */
std::string *Description; /* 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.
*
* This program is free software; you can redistribute it and/or
......@@ -22,6 +22,24 @@
#include "opc_utl.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
//
......@@ -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)
{
if ( mask & opc_mProperty_DataType)
pnames.push_back( std::string("dataName"));
if ( mask & opc_mProperty_Value)
pnames.push_back( std::string("value"));
if ( mask & opc_mProperty_Quality)
pnames.push_back( std::string("quality"));
if ( mask & opc_mProperty_Timestamp)
pnames.push_back( std::string("timestamp"));
if ( mask & opc_mProperty_ScanRate)
pnames.push_back( std::string("scanRate"));
if ( mask & opc_mProperty_EuType)
pnames.push_back( std::string("euType"));
if ( mask & opc_mProperty_EuInfo)
pnames.push_back( std::string("euInfo"));
if ( mask & opc_mProperty_EngineeringUnits)
pnames.push_back( std::string("engineeringUnits"));
if ( mask & opc_mProperty_Description)
pnames.push_back( std::string("description"));
if ( mask & opc_mProperty_HighEU)
pnames.push_back( std::string("highEU"));
if ( mask & opc_mProperty_LowEU)
pnames.push_back( std::string("lowEU"));
if ( mask & opc_mProperty_HighIR)
pnames.push_back( std::string("highIR"));
if ( mask & opc_mProperty_LowIR)
pnames.push_back( std::string("lowIR"));
if ( mask & opc_mProperty_CloseLabel)
pnames.push_back( std::string("closeLabel"));
if ( mask & opc_mProperty_OpenLabel)
pnames.push_back( std::string("openLabel"));
if ( mask & opc_mProperty_TimeZone)
pnames.push_back( std::string("timeZone"));
unsigned int m;
for ( int i = 0; i < opc_cPropertySize; i++) {
m = 1 << i;
if ( mask & m)
pnames.push_back( std::string( opc_PropertyNames[i]));
}
}
bool opc_get_property( std::vector<ns1__ItemProperty *> properties, unsigned int mask,
char **valp)
{
char name[80];
char *s;
int idx = -1;
for ( int i = 0; i < opc_cPropertySize; i++) {
if ( (unsigned int)(1 << i) == mask) {
idx = i;
break;
}
}
if ( idx == -1)
return false;
for ( int i = 0; i < (int)properties.size(); i++) {
strcpy( name, properties[i]->Name.c_str());
if ( (s = strrchr( name, ':')))
s++;
else
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)
......@@ -215,3 +242,62 @@ bool opc_propertynames_to_mask( std::vector<std::string>& pnames, unsigned int *
}
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.
*
* This program is free software; you can redistribute it and/or
......@@ -20,26 +20,37 @@
#include <vector.h>
#include <string.h>
#include "pwr.h"
#include "opc_soap_Stub.h"
const int opc_cPropertySize = 17;
typedef enum {
opc_mProperty_DataType = 1 << 0,
opc_mProperty_Value = 1 << 1,
opc_mProperty_Quality = 1 << 2,
opc_mProperty_Timestamp = 1 << 3,
opc_mProperty_ScanRate = 1 << 4,
opc_mProperty_EuType = 1 << 5,
opc_mProperty_EuInfo = 1 << 6,
opc_mProperty_EngineeringUnits = 1 << 7,
opc_mProperty_Description = 1 << 8,
opc_mProperty_HighEU = 1 << 9,
opc_mProperty_LowEU = 1 << 10,
opc_mProperty_HighIR = 1 << 11,
opc_mProperty_LowIR = 1 << 12,
opc_mProperty_CloseLabel = 1 << 13,
opc_mProperty_OpenLabel = 1 << 14,
opc_mProperty_TimeZone = 1 << 15
opc_mProperty_AccessRights = 1 << 4,
opc_mProperty_ScanRate = 1 << 5,
opc_mProperty_EuType = 1 << 6,
opc_mProperty_EuInfo = 1 << 7,
opc_mProperty_EngineeringUnits = 1 << 8,
opc_mProperty_Description = 1 << 9,
opc_mProperty_HighEU = 1 << 10,
opc_mProperty_LowEU = 1 << 11,
opc_mProperty_HighIR = 1 << 12,
opc_mProperty_LowIR = 1 << 13,
opc_mProperty_CloseLabel = 1 << 14,
opc_mProperty_OpenLabel = 1 << 15,
opc_mProperty_TimeZone = 1 << 16
} opc_mProperty;
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);
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