Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Manchev
osie
Commits
3f9b1c53
Commit
3f9b1c53
authored
Oct 05, 2021
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup unused code.
parent
e59409b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
51 deletions
+1
-51
coupler/opc-ua-server/server.c
coupler/opc-ua-server/server.c
+1
-51
No files found.
coupler/opc-ua-server/server.c
View file @
3f9b1c53
...
@@ -87,35 +87,6 @@ addVariable(UA_Server *server) {
...
@@ -87,35 +87,6 @@ addVariable(UA_Server *server) {
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_BASEDATAVARIABLETYPE
),
attr
,
NULL
,
NULL
);
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_BASEDATAVARIABLETYPE
),
attr
,
NULL
,
NULL
);
}
}
static
void
addMatrixVariable
(
UA_Server
*
server
)
{
UA_VariableAttributes
attr
=
UA_VariableAttributes_default
;
attr
.
displayName
=
UA_LOCALIZEDTEXT
(
"en-US"
,
"Double Matrix"
);
attr
.
accessLevel
=
UA_ACCESSLEVELMASK_READ
|
UA_ACCESSLEVELMASK_WRITE
;
/* Set the variable value constraints */
attr
.
dataType
=
UA_TYPES
[
UA_TYPES_DOUBLE
].
typeId
;
attr
.
valueRank
=
UA_VALUERANK_TWO_DIMENSIONS
;
UA_UInt32
arrayDims
[
2
]
=
{
2
,
2
};
attr
.
arrayDimensions
=
arrayDims
;
attr
.
arrayDimensionsSize
=
2
;
/* Set the value. The array dimensions need to be the same for the value. */
UA_Double
zero
[
4
]
=
{
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
};
UA_Variant_setArray
(
&
attr
.
value
,
zero
,
4
,
&
UA_TYPES
[
UA_TYPES_DOUBLE
]);
attr
.
value
.
arrayDimensions
=
arrayDims
;
attr
.
value
.
arrayDimensionsSize
=
2
;
UA_NodeId
myIntegerNodeId
=
UA_NODEID_STRING
(
1
,
"double.matrix"
);
UA_QualifiedName
myIntegerName
=
UA_QUALIFIEDNAME
(
1
,
"double matrix"
);
UA_NodeId
parentNodeId
=
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_OBJECTSFOLDER
);
UA_NodeId
parentReferenceNodeId
=
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_ORGANIZES
);
UA_Server_addVariableNode
(
server
,
myIntegerNodeId
,
parentNodeId
,
parentReferenceNodeId
,
myIntegerName
,
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_BASEDATAVARIABLETYPE
),
attr
,
NULL
,
NULL
);
}
/**
/**
* Now we change the value with the write service. This uses the same service
* Now we change the value with the write service. This uses the same service
* implementation that can also be reached over the network by an OPC UA client.
* implementation that can also be reached over the network by an OPC UA client.
...
@@ -151,26 +122,6 @@ writeVariable(UA_Server *server) {
...
@@ -151,26 +122,6 @@ writeVariable(UA_Server *server) {
UA_Server_write
(
server
,
&
wv
);
UA_Server_write
(
server
,
&
wv
);
}
}
/**
* Note how we initially set the DataType attribute of the variable node to the
* NodeId of the Int32 data type. This forbids writing values that are not an
* Int32. The following code shows how this consistency check is performed for
* every write.
*/
static
void
writeWrongVariable
(
UA_Server
*
server
)
{
UA_NodeId
myIntegerNodeId
=
UA_NODEID_STRING
(
1
,
"the.answer"
);
/* Write a string */
UA_String
myString
=
UA_STRING
(
"test"
);
UA_Variant
myVar
;
UA_Variant_init
(
&
myVar
);
UA_Variant_setScalar
(
&
myVar
,
&
myString
,
&
UA_TYPES
[
UA_TYPES_STRING
]);
UA_StatusCode
retval
=
UA_Server_writeValue
(
server
,
myIntegerNodeId
,
myVar
);
printf
(
"Writing a string returned statuscode %s
\n
"
,
UA_StatusCode_name
(
retval
));
}
/** It follows the main server code, making use of the above definitions. */
/** It follows the main server code, making use of the above definitions. */
static
volatile
UA_Boolean
running
=
true
;
static
volatile
UA_Boolean
running
=
true
;
...
@@ -204,9 +155,8 @@ int main(void) {
...
@@ -204,9 +155,8 @@ int main(void) {
#endif
#endif
addVariable
(
server
);
addVariable
(
server
);
addMatrixVariable
(
server
);
writeVariable
(
server
);
writeVariable
(
server
);
writeWrongVariable
(
server
);
//
writeWrongVariable(server);
UA_StatusCode
retval
=
UA_Server_run
(
server
,
&
running
);
UA_StatusCode
retval
=
UA_Server_run
(
server
,
&
running
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment