|
@@ -267,12 +267,12 @@ addPubSubConnectionRepresentation(UA_Server *server, UA_PubSubConnection *connec
|
|
|
UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
|
|
|
UA_NODEID_NUMERIC(0, connection->identifier.identifier.numeric));
|
|
|
|
|
|
- if (UA_NodeId_equal(&addressNode, &UA_NODEID_NULL) ||
|
|
|
- UA_NodeId_equal(&urlNode, &UA_NODEID_NULL) ||
|
|
|
- UA_NodeId_equal(&interfaceNode, &UA_NODEID_NULL) ||
|
|
|
- UA_NodeId_equal(&publisherIdNode, &UA_NODEID_NULL) ||
|
|
|
- UA_NodeId_equal(&connectionPropertieNode, &UA_NODEID_NULL) ||
|
|
|
- UA_NodeId_equal(&transportProfileUri, &UA_NODEID_NULL)) {
|
|
|
+ if(UA_NodeId_equal(&addressNode, &UA_NODEID_NULL) ||
|
|
|
+ UA_NodeId_equal(&urlNode, &UA_NODEID_NULL) ||
|
|
|
+ UA_NodeId_equal(&interfaceNode, &UA_NODEID_NULL) ||
|
|
|
+ UA_NodeId_equal(&publisherIdNode, &UA_NODEID_NULL) ||
|
|
|
+ UA_NodeId_equal(&connectionPropertieNode, &UA_NODEID_NULL) ||
|
|
|
+ UA_NodeId_equal(&transportProfileUri, &UA_NODEID_NULL)) {
|
|
|
return UA_STATUSCODE_BADNOTFOUND;
|
|
|
}
|
|
|
|
|
@@ -346,7 +346,7 @@ addPubSubConnectionAction(UA_Server *server,
|
|
|
&UA_TYPES[UA_TYPES_NETWORKADDRESSURLDATATYPE]);
|
|
|
if(pubSubConnectionDataType.publisherId.type == &UA_TYPES[UA_TYPES_UINT32]){
|
|
|
connectionConfig.publisherId.numeric = * ((UA_UInt32 *) pubSubConnectionDataType.publisherId.data);
|
|
|
- } else if (pubSubConnectionDataType.publisherId.type == &UA_TYPES[UA_TYPES_STRING]){
|
|
|
+ } else if(pubSubConnectionDataType.publisherId.type == &UA_TYPES[UA_TYPES_STRING]){
|
|
|
connectionConfig.publisherIdType = UA_PUBSUB_PUBLISHERID_STRING;
|
|
|
UA_String_copy((UA_String *) pubSubConnectionDataType.publisherId.data, &connectionConfig.publisherId.string);
|
|
|
} else {
|
|
@@ -523,7 +523,7 @@ removeDataSetFolderAction(UA_Server *server,
|
|
|
#endif
|
|
|
|
|
|
UA_StatusCode
|
|
|
-addPublishedDataItemsRepresentation(UA_Server *server, UA_PublishedDataSet *publishedDataSet){
|
|
|
+addPublishedDataItemsRepresentation(UA_Server *server, UA_PublishedDataSet *publishedDataSet) {
|
|
|
UA_StatusCode retVal = UA_STATUSCODE_GOOD;
|
|
|
if(publishedDataSet->config.name.length > 512)
|
|
|
return UA_STATUSCODE_BADOUTOFMEMORY;
|
|
@@ -541,42 +541,46 @@ addPublishedDataItemsRepresentation(UA_Server *server, UA_PublishedDataSet *publ
|
|
|
valueCallback.onRead = onRead;
|
|
|
valueCallback.onWrite = NULL;
|
|
|
|
|
|
- UA_NodeId configurationVersionNode, publishedDataNode;
|
|
|
- configurationVersionNode = findSingleChildNode(server, UA_QUALIFIEDNAME(0, "ConfigurationVersion"),
|
|
|
- UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
- UA_NODEID_NUMERIC(0, publishedDataSet->identifier.identifier.numeric));
|
|
|
- if (UA_NodeId_equal(&configurationVersionNode, &UA_NODEID_NULL)) {
|
|
|
+ UA_NodeId configurationVersionNode =
|
|
|
+ findSingleChildNode(server, UA_QUALIFIEDNAME(0, "ConfigurationVersion"),
|
|
|
+ UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
+ UA_NODEID_NUMERIC(0, publishedDataSet->identifier.identifier.numeric));
|
|
|
+ if(UA_NodeId_equal(&configurationVersionNode, &UA_NODEID_NULL))
|
|
|
return UA_STATUSCODE_BADNOTFOUND;
|
|
|
- }
|
|
|
|
|
|
- UA_NodePropertyContext * configurationVersionContext = (UA_NodePropertyContext *) UA_malloc(sizeof(UA_NodePropertyContext));
|
|
|
+ UA_NodePropertyContext * configurationVersionContext = (UA_NodePropertyContext *)
|
|
|
+ UA_malloc(sizeof(UA_NodePropertyContext));
|
|
|
configurationVersionContext->parentNodeId = publishedDataSet->identifier;
|
|
|
configurationVersionContext->parentClassifier = UA_NS0ID_PUBLISHEDDATAITEMSTYPE;
|
|
|
- configurationVersionContext->elementClassiefier = UA_NS0ID_PUBLISHEDDATAITEMSTYPE_CONFIGURATIONVERSION;
|
|
|
- retVal |= addVariableValueSource(server, valueCallback, configurationVersionNode, configurationVersionContext);
|
|
|
+ configurationVersionContext->elementClassiefier =
|
|
|
+ UA_NS0ID_PUBLISHEDDATAITEMSTYPE_CONFIGURATIONVERSION;
|
|
|
+ retVal |= addVariableValueSource(server, valueCallback, configurationVersionNode,
|
|
|
+ configurationVersionContext);
|
|
|
|
|
|
- publishedDataNode = findSingleChildNode(server, UA_QUALIFIEDNAME(0, "PublishedData"),
|
|
|
- UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
- UA_NODEID_NUMERIC(0, publishedDataSet->identifier.identifier.numeric));
|
|
|
- if (UA_NodeId_equal(&publishedDataNode, &UA_NODEID_NULL)) {
|
|
|
+ UA_NodeId publishedDataNode =
|
|
|
+ findSingleChildNode(server, UA_QUALIFIEDNAME(0, "PublishedData"),
|
|
|
+ UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
+ UA_NODEID_NUMERIC(0, publishedDataSet->identifier.identifier.numeric));
|
|
|
+ if(UA_NodeId_equal(&publishedDataNode, &UA_NODEID_NULL))
|
|
|
return UA_STATUSCODE_BADNOTFOUND;
|
|
|
- }
|
|
|
|
|
|
- UA_NodePropertyContext * publishingIntervalContext = (UA_NodePropertyContext *) UA_malloc(sizeof(UA_NodePropertyContext));
|
|
|
+ UA_NodePropertyContext * publishingIntervalContext = (UA_NodePropertyContext *)
|
|
|
+ UA_malloc(sizeof(UA_NodePropertyContext));
|
|
|
publishingIntervalContext->parentNodeId = publishedDataSet->identifier;
|
|
|
publishingIntervalContext->parentClassifier = UA_NS0ID_PUBLISHEDDATAITEMSTYPE;
|
|
|
publishingIntervalContext->elementClassiefier = UA_NS0ID_PUBLISHEDDATAITEMSTYPE_PUBLISHEDDATA;
|
|
|
- retVal |= addVariableValueSource(server, valueCallback, publishedDataNode, publishingIntervalContext);
|
|
|
+ retVal |= addVariableValueSource(server, valueCallback, publishedDataNode,
|
|
|
+ publishingIntervalContext);
|
|
|
|
|
|
UA_NodeId dataSetMetaDataNode =
|
|
|
findSingleChildNode(server, UA_QUALIFIEDNAME(0, "DataSetMetaData"),
|
|
|
UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
UA_NODEID_NUMERIC(0, publishedDataSet->identifier.identifier.numeric));
|
|
|
- if (UA_NodeId_equal(&dataSetMetaDataNode, &UA_NODEID_NULL)) {
|
|
|
+ if(UA_NodeId_equal(&dataSetMetaDataNode, &UA_NODEID_NULL))
|
|
|
return UA_STATUSCODE_BADNOTFOUND;
|
|
|
- }
|
|
|
|
|
|
- UA_NodePropertyContext *metaDataContext = (UA_NodePropertyContext *) UA_malloc(sizeof(UA_NodePropertyContext));
|
|
|
+ UA_NodePropertyContext *metaDataContext = (UA_NodePropertyContext *)
|
|
|
+ UA_malloc(sizeof(UA_NodePropertyContext));
|
|
|
metaDataContext->parentNodeId = publishedDataSet->identifier;
|
|
|
metaDataContext->parentClassifier = UA_NS0ID_PUBLISHEDDATAITEMSTYPE;
|
|
|
metaDataContext->elementClassiefier = UA_NS0ID_PUBLISHEDDATAITEMSTYPE_DATASETMETADATA;
|
|
@@ -621,7 +625,7 @@ addPublishedDataItemsAction(UA_Server *server,
|
|
|
retVal |= UA_Server_addPublishedDataSet(server, &publishedDataSetConfig, &dataSetItemsNodeId).addResult;
|
|
|
|
|
|
UA_DataSetFieldConfig dataSetFieldConfig;
|
|
|
- for (size_t j = 0; j < variablesToAddSize; ++j) {
|
|
|
+ for(size_t j = 0; j < variablesToAddSize; ++j) {
|
|
|
memset(&dataSetFieldConfig, 0, sizeof(dataSetFieldConfig));
|
|
|
dataSetFieldConfig.dataSetFieldType = UA_PUBSUB_DATASETFIELD_VARIABLE;
|
|
|
dataSetFieldConfig.field.variable.fieldNameAlias = fieldNameAliases[j];
|
|
@@ -748,33 +752,39 @@ addWriterGroupRepresentation(UA_Server *server, UA_WriterGroup *writerGroup){
|
|
|
writerGroup->linkedConnection.identifier.numeric,
|
|
|
UA_NS0ID_HASCOMPONENT, UA_NS0ID_WRITERGROUPTYPE);
|
|
|
//End lock zone
|
|
|
- UA_NodeId keepAliveNode, publishingIntervalNode, priorityNode, writerGroupIdNode;
|
|
|
- keepAliveNode = findSingleChildNode(server, UA_QUALIFIEDNAME(0, "KeepAliveTime"),
|
|
|
- UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
- UA_NODEID_NUMERIC(0, writerGroup->identifier.identifier.numeric));
|
|
|
- publishingIntervalNode = findSingleChildNode(server, UA_QUALIFIEDNAME(0, "PublishingInterval"),
|
|
|
- UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
- UA_NODEID_NUMERIC(0, writerGroup->identifier.identifier.numeric));
|
|
|
- if (UA_NodeId_equal(&keepAliveNode, &UA_NODEID_NULL) ||
|
|
|
- UA_NodeId_equal(&publishingIntervalNode, &UA_NODEID_NULL)) {
|
|
|
+ UA_NodeId keepAliveNode =
|
|
|
+ findSingleChildNode(server, UA_QUALIFIEDNAME(0, "KeepAliveTime"),
|
|
|
+ UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
+ UA_NODEID_NUMERIC(0, writerGroup->identifier.identifier.numeric));
|
|
|
+ UA_NodeId publishingIntervalNode =
|
|
|
+ findSingleChildNode(server, UA_QUALIFIEDNAME(0, "PublishingInterval"),
|
|
|
+ UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
+ UA_NODEID_NUMERIC(0, writerGroup->identifier.identifier.numeric));
|
|
|
+ if(UA_NodeId_equal(&keepAliveNode, &UA_NODEID_NULL) ||
|
|
|
+ UA_NodeId_equal(&publishingIntervalNode, &UA_NODEID_NULL))
|
|
|
return UA_STATUSCODE_BADNOTFOUND;
|
|
|
- }
|
|
|
- UA_NodePropertyContext * publishingIntervalContext = (UA_NodePropertyContext *) UA_malloc(sizeof(UA_NodePropertyContext));
|
|
|
+
|
|
|
+ UA_NodePropertyContext * publishingIntervalContext = (UA_NodePropertyContext *)
|
|
|
+ UA_malloc(sizeof(UA_NodePropertyContext));
|
|
|
publishingIntervalContext->parentNodeId = writerGroup->identifier;
|
|
|
publishingIntervalContext->parentClassifier = UA_NS0ID_WRITERGROUPTYPE;
|
|
|
publishingIntervalContext->elementClassiefier = UA_NS0ID_WRITERGROUPTYPE_PUBLISHINGINTERVAL;
|
|
|
UA_ValueCallback valueCallback;
|
|
|
valueCallback.onRead = onRead;
|
|
|
valueCallback.onWrite = onWrite;
|
|
|
- retVal |= addVariableValueSource(server, valueCallback, publishingIntervalNode, publishingIntervalContext);
|
|
|
- UA_Server_writeAccessLevel(server, publishingIntervalNode, (UA_ACCESSLEVELMASK_READ ^ UA_ACCESSLEVELMASK_WRITE));
|
|
|
-
|
|
|
- priorityNode = findSingleChildNode(server, UA_QUALIFIEDNAME(0, "Priority"),
|
|
|
- UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
- UA_NODEID_NUMERIC(0, writerGroup->identifier.identifier.numeric));
|
|
|
- writerGroupIdNode = findSingleChildNode(server, UA_QUALIFIEDNAME(0, "WriterGroupId"),
|
|
|
- UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
- UA_NODEID_NUMERIC(0, writerGroup->identifier.identifier.numeric));
|
|
|
+ retVal |= addVariableValueSource(server, valueCallback,
|
|
|
+ publishingIntervalNode, publishingIntervalContext);
|
|
|
+ UA_Server_writeAccessLevel(server, publishingIntervalNode,
|
|
|
+ UA_ACCESSLEVELMASK_READ ^ UA_ACCESSLEVELMASK_WRITE);
|
|
|
+
|
|
|
+ UA_NodeId priorityNode =
|
|
|
+ findSingleChildNode(server, UA_QUALIFIEDNAME(0, "Priority"),
|
|
|
+ UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
+ UA_NODEID_NUMERIC(0, writerGroup->identifier.identifier.numeric));
|
|
|
+ UA_NodeId writerGroupIdNode =
|
|
|
+ findSingleChildNode(server, UA_QUALIFIEDNAME(0, "WriterGroupId"),
|
|
|
+ UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
+ UA_NODEID_NUMERIC(0, writerGroup->identifier.identifier.numeric));
|
|
|
UA_Variant value;
|
|
|
UA_Variant_init(&value);
|
|
|
UA_Variant_setScalar(&value, &writerGroup->config.publishingInterval, &UA_TYPES[UA_TYPES_DURATION]);
|
|
@@ -792,17 +802,18 @@ addWriterGroupRepresentation(UA_Server *server, UA_WriterGroup *writerGroup){
|
|
|
|
|
|
/* Find the variable with the content mask */
|
|
|
|
|
|
- UA_NodeId messageSettingsId = findSingleChildNode(server, UA_QUALIFIEDNAME(0, "MessageSettings"),
|
|
|
- UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
|
|
|
- UA_NODEID_NUMERIC(0, writerGroup->identifier.identifier.numeric));
|
|
|
- UA_NodeId contentMaskId = findSingleChildNode(server,
|
|
|
- UA_QUALIFIEDNAME(0, "NetworkMessageContentMask"),
|
|
|
- UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
|
|
|
- messageSettingsId);
|
|
|
- if (UA_NodeId_equal(&messageSettingsId, &UA_NODEID_NULL) ||
|
|
|
- UA_NodeId_equal(&contentMaskId, &UA_NODEID_NULL)) {
|
|
|
+ UA_NodeId messageSettingsId =
|
|
|
+ findSingleChildNode(server, UA_QUALIFIEDNAME(0, "MessageSettings"),
|
|
|
+ UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
|
|
|
+ UA_NODEID_NUMERIC(0, writerGroup->identifier.identifier.numeric));
|
|
|
+ UA_NodeId contentMaskId =
|
|
|
+ findSingleChildNode(server, UA_QUALIFIEDNAME(0, "NetworkMessageContentMask"),
|
|
|
+ UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY), messageSettingsId);
|
|
|
+ if(UA_NodeId_equal(&messageSettingsId, &UA_NODEID_NULL) ||
|
|
|
+ UA_NodeId_equal(&contentMaskId, &UA_NODEID_NULL)) {
|
|
|
return UA_STATUSCODE_BADNOTFOUND;
|
|
|
}
|
|
|
+
|
|
|
/* Set the callback */
|
|
|
UA_DataSource ds;
|
|
|
ds.read = readContentMask;
|
|
@@ -811,8 +822,8 @@ addWriterGroupRepresentation(UA_Server *server, UA_WriterGroup *writerGroup){
|
|
|
UA_Server_setNodeContext(server, contentMaskId, writerGroup);
|
|
|
|
|
|
/* Make writable */
|
|
|
- UA_Server_writeAccessLevel(server, contentMaskId, UA_ACCESSLEVELMASK_WRITE | UA_ACCESSLEVELMASK_READ);
|
|
|
- // UA_ACCESSLEVELTYPE_CURRENTREAD | UA_ACCESSLEVELTYPE_CURRENTWRITE);
|
|
|
+ UA_Server_writeAccessLevel(server, contentMaskId,
|
|
|
+ UA_ACCESSLEVELMASK_WRITE | UA_ACCESSLEVELMASK_READ);
|
|
|
|
|
|
return retVal;
|
|
|
}
|
|
@@ -928,18 +939,17 @@ addDataSetWriterAction(UA_Server *server,
|
|
|
const UA_NodeId *objectId, void *objectContext,
|
|
|
size_t inputSize, const UA_Variant *input,
|
|
|
size_t outputSize, UA_Variant *output){
|
|
|
- UA_StatusCode retVal = UA_STATUSCODE_GOOD;
|
|
|
UA_DataSetWriterDataType *dataSetWriterDataType = (UA_DataSetWriterDataType *) input[0].data;
|
|
|
|
|
|
UA_NodeId targetPDS = UA_NODEID_NULL;
|
|
|
- for (size_t i = 0; i < server->pubSubManager.publishedDataSetsSize; ++i) {
|
|
|
- if(UA_String_equal(&dataSetWriterDataType->dataSetName, &server->pubSubManager.publishedDataSets[i].config.name)){
|
|
|
+ for(size_t i = 0; i < server->pubSubManager.publishedDataSetsSize; ++i) {
|
|
|
+ if(UA_String_equal(&dataSetWriterDataType->dataSetName,
|
|
|
+ &server->pubSubManager.publishedDataSets[i].config.name)){
|
|
|
targetPDS = server->pubSubManager.publishedDataSets[i].identifier;
|
|
|
}
|
|
|
}
|
|
|
- if(UA_NodeId_isNull(&targetPDS)){
|
|
|
+ if(UA_NodeId_isNull(&targetPDS))
|
|
|
return UA_STATUSCODE_BADPARENTNODEIDINVALID;
|
|
|
- }
|
|
|
|
|
|
UA_NodeId generatedId;
|
|
|
UA_DataSetWriterConfig dataSetWriterConfig;
|
|
@@ -951,7 +961,7 @@ addDataSetWriterAction(UA_Server *server,
|
|
|
|
|
|
UA_Server_addDataSetWriter(server, *objectId, targetPDS, &dataSetWriterConfig, &generatedId);
|
|
|
UA_Variant_setScalarCopy(output, &generatedId, &UA_TYPES[UA_TYPES_NODEID]);
|
|
|
- return retVal;
|
|
|
+ return UA_STATUSCODE_GOOD;
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -1044,7 +1054,8 @@ publishedDataItemsTypeDestructor(UA_Server *server,
|
|
|
const UA_NodeId *sessionId, void *sessionContext,
|
|
|
const UA_NodeId *typeId, void *typeContext,
|
|
|
const UA_NodeId *nodeId, void **nodeContext) {
|
|
|
- UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_USERLAND, "PublishedDataItems destructor called!");
|
|
|
+ UA_LOG_INFO(&server->config.logger, UA_LOGCATEGORY_USERLAND,
|
|
|
+ "PublishedDataItems destructor called!");
|
|
|
void *childContext;
|
|
|
UA_NodeId node = findSingleChildNode(server, UA_QUALIFIEDNAME(0, "PublishedData"),
|
|
|
UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY), *nodeId);
|