Having trouble in reading the data from the server please need help|OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Having trouble in reading the data from the server please need help
Avatar
Yashvanth B
Member
Members
Forum Posts: 6
Member Since:
04/19/2020
sp_UserOfflineSmall Offline
1
05/07/2020 - 08:23
sp_Permalink sp_Print

Hi everyone i am using C++ based OPC UA Client/Server SDK + Pub/Sub Bundle v1.7.2

i have  file simpleconfig.ini in that where the credential are stored 

this are the Nodes i want to read but when i change the string(s) to numeric the reading is failing 

NodesToRead/size =4
NodesToRead/Variable00 =ns=2;s=Demo.Dynamic.Scalar.Float
NodesToRead/Variable01 =ns=0;s=Demo.Dynamic.Scalar.Int32
NodesToRead/Variable02 =ns=1;s=AirConditioner_1.Humidity
NodesToRead/Variable03 =ns=2;s=Demo.CTT.AllProfiles.Scalar.String

when i change the s=Demo.Dynamic.Scalar.Float to i=2255 the reading i failing can anyone suggest me 

how can i pass the numeric as well as the string so i can read the  

 

////Read code 

UaStatus SampleClient::read()
{
UaStatus result;
ServiceSettings serviceSettings;
UaReadValueIds nodesToRead;
UaDataValues values;
UaDiagnosticInfos diagnosticInfos;

// read all nodes from the configuration
UaNodeIdArray nodes = m_pConfiguration->getNodesToRead();
nodesToRead.create(nodes.length());

for (OpcUa_UInt32 i = 0; i < nodes.length(); i++)
{
nodesToRead[i].AttributeId = OpcUa_Attributes_Value;
OpcUa_NodeId_CopyTo(&nodes[i], &nodesToRead[i].NodeId);
}

printf("
Reading ...
");
result = m_pSession->read(
serviceSettings,
0,
OpcUa_TimestampsToReturn_Both,
nodesToRead,
values,
diagnosticInfos);

if (result.isGood())
{
// Read service succeded - check individual status codes
for (OpcUa_UInt32 i = 0; i < nodes.length(); i++)
{
if (OpcUa_IsGood(values[i].StatusCode))
{
printf("Value[%d]: %s
", i, UaVariant(values[i].Value).toString().toUtf8());
}
else
{
printf("Read failed for item[%d] with status %s
", i, UaStatus(values[i].StatusCode).toString().toUtf8());
}
}
}
else
{
// Service call failed
printf("Read failed with status %s
", result.toString().toUtf8());
}

return result;
}

Avatar
Randy Armstrong
Admin
Forum Posts: 1451
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
05/07/2020 - 20:03
sp_Permalink sp_Print

If you are intending to read the Server NamespaceArray the NodeId is

i=2255

not

ns=2;i=2255

Avatar
Yashvanth B
Member
Members
Forum Posts: 6
Member Since:
04/19/2020
sp_UserOfflineSmall Offline
3
05/07/2020 - 22:08
sp_Permalink sp_Print

I tried with giving the i=2255 still read is failing

Read failed for item[0] with status BadNodeIdUnknown

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online: Svein Folkeson
Guest(s) 43
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1348
Posts: 4576