Commit d97e8186 authored by Claes Sjofors's avatar Claes Sjofors

Opc client, support for canonical data types added

parent 8477adef
......@@ -124,9 +124,51 @@ void opc_provider::insert_object( pwr_tOix fth, pwr_tOix bws, s0__BrowseElement
sizeof(((pwr_sClass_Opc_Hier *)o->po.body)->Description));
}
else {
bool foundType = false;
if ( opc_get_property( element->Properties, opc_mProperty_DataType, &valp)) {
if ( !opc_string_to_opctype( ((xsd__string *)valp)->__item.c_str(), &opctype)) {
foundType = false;
opctype = opc_eDataType_;
}
else
foundType = true;
}
if (!foundType) {
// Call opc server to Get Properties of this element for DataType
_s0__GetPropertiesResponse properties_response_datatype;
_s0__GetProperties get_properties_dataType;
s0__ItemIdentifier itemid;
get_properties_dataType.ReturnPropertyValues = (bool *) malloc( sizeof(bool));
*get_properties_dataType.ReturnPropertyValues = true;
itemid.ItemName = new std::string( o->item_name);
get_properties_dataType.ItemIDs.push_back( &itemid);
opc_mask_to_propertynames( get_properties_dataType.PropertyNames, opc_mProperty_DataType);
if ( soap_call___s0__GetProperties( &soap, opc_endpoint, NULL, &get_properties_dataType,
&properties_response_datatype) == SOAP_OK) {
server_state->RequestCnt++;
if ( properties_response_datatype.PropertyLists.size() > 0 &&
properties_response_datatype.PropertyLists[0]->Properties.size() > 0) {
if ( opc_get_property( properties_response_datatype.PropertyLists[0]->Properties,
opc_mProperty_DataType, &valp)) {
if ( !opc_string_to_opctype( ((xsd__string *)valp)->__item.c_str(), &opctype))
opctype = opc_eDataType_;
else
foundType = true;
}
}
}
delete itemid.ItemName;
free( (char *)get_properties_dataType.ReturnPropertyValues);
}
switch ( opctype) {
case opc_eDataType_string:
......@@ -317,8 +359,9 @@ void opc_provider::insert_object( pwr_tOix fth, pwr_tOix bws, s0__BrowseElement
break;
}
}
}
else {
// No dataType could be found, set as OpcHier object
if (!foundType) {
o->po.cid = pwr_cClass_Opc_Hier;
o->po.body_size = sizeof(pwr_sClass_Opc_Hier);
o->po.body = calloc( 1, o->po.body_size);
......@@ -355,7 +398,8 @@ void opc_provider::insert_object( pwr_tOix fth, pwr_tOix bws, s0__BrowseElement
m_list.push_back( o);
if ( opc_get_property( element->Properties, opc_mProperty_EuType, &valp)) {
if ( ((xsd__string *)valp)->__item == "analog")
if ( ( ((xsd__string *)valp)->__item == "analog" || ((xsd__string *)valp)->__item == "" ) ||
( ( ((xsd__string *)valp)->__item != "noEnum") && ((xsd__string *)valp)->__item != "enumerated") )
m_list[o->po.oix]->po.flags |= procom_obj_mFlags_Analog;
}
if ( m_list[o->po.oix]->po.flags & procom_obj_mFlags_Analog) {
......
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