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
Nikola Balog
osie
Commits
223dc70f
Commit
223dc70f
authored
Apr 20, 2022
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch from int to unsigned int as anywa both values should ahve only positive values.
parent
a98c0ae2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
coupler/opc-ua-server/server.c
coupler/opc-ua-server/server.c
+8
-8
coupler/opc-ua-server/server_subscribe.c
coupler/opc-ua-server/server_subscribe.c
+6
-6
No files found.
coupler/opc-ua-server/server.c
View file @
223dc70f
...
...
@@ -38,7 +38,7 @@
static
int
COUPLER_ID
=
0
;
// global HEART BEATs of coupler
static
int
HEART_BEATS
=
0
;
static
unsigned
int
HEART_BEATS
=
0
;
// the heart beat interval
static
int
HEART_BEAT_INTERVAL
=
250
;
...
...
@@ -139,10 +139,10 @@ void callbackTicHeartBeat()
// set OPC UA's heat_beat node value
UA_NodeId
myIntegerNodeId
=
UA_NODEID_STRING
(
1
,
"heart_beat"
);
UA_Int32
myInteger
=
HEART_BEATS
;
UA_
U
Int32
myInteger
=
HEART_BEATS
;
UA_Variant
myVar
;
UA_Variant_init
(
&
myVar
);
UA_Variant_setScalar
(
&
myVar
,
&
myInteger
,
&
UA_TYPES
[
UA_TYPES_INT32
]);
UA_Variant_setScalar
(
&
myVar
,
&
myInteger
,
&
UA_TYPES
[
UA_TYPES_
U
INT32
]);
UA_Server_writeValue
(
server
,
myIntegerNodeId
,
myVar
);
}
...
...
@@ -259,22 +259,22 @@ int main(int argc, char **argv)
UA_UInt64
callbackId
=
1
;
UA_Server_addRepeatedCallback
(
server
,
callbackTicHeartBeat
,
NULL
,
HEART_BEAT_INTERVAL
,
&
callbackId
);
UA_
Int32
defaultInt32
=
0
;
//XXX: use unsigned int
UA_
Int32
couplerID
=
COUPLER_ID
;
//XXX: use unsigned int
UA_
UInt32
defaultUInt32
=
0
;
UA_
UInt32
couplerID
=
COUPLER_ID
;
const
PublishedVariable
publishedVariableArray
[]
=
{
// representing time in millis since start of process
{
.
name
=
"heart_beat"
,
.
description
=
"Heart beat"
,
.
pdefaultValue
=
&
defaultInt32
,
.
type
=
UA_TYPES_INT32
.
pdefaultValue
=
&
default
U
Int32
,
.
type
=
UA_TYPES_
U
INT32
},
// representing the ID of the coupler
{
.
name
=
"id"
,
.
description
=
"ID"
,
.
pdefaultValue
=
&
couplerID
,
.
type
=
UA_TYPES_INT32
.
type
=
UA_TYPES_
U
INT32
}
};
...
...
coupler/opc-ua-server/server_subscribe.c
View file @
223dc70f
...
...
@@ -28,10 +28,10 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
void
*
monitoredItemContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
UA_UInt32
attributeId
,
const
UA_DataValue
*
var
)
{
if
(
UA_Variant_hasScalarType
(
&
var
->
value
,
&
UA_TYPES
[
UA_TYPES_INT32
]))
{
if
(
UA_Variant_hasScalarType
(
&
var
->
value
,
&
UA_TYPES
[
UA_TYPES_
U
INT32
]))
{
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"Received Notification with value %d"
,
*
(
UA_Int32
*
)
var
->
value
.
data
);
*
(
UA_
U
Int32
*
)
var
->
value
.
data
);
}
}
...
...
@@ -221,17 +221,17 @@ static void fillTestDataSetMetaData(UA_DataSetMetaDataType *pMetaData) {
/* heartbeat */
UA_FieldMetaData_init
(
&
pMetaData
->
fields
[
0
]);
UA_NodeId_copy
(
&
UA_TYPES
[
UA_TYPES_INT32
].
typeId
,
UA_NodeId_copy
(
&
UA_TYPES
[
UA_TYPES_
U
INT32
].
typeId
,
&
pMetaData
->
fields
[
0
].
dataType
);
pMetaData
->
fields
[
0
].
builtInType
=
UA_NS0ID_INT32
;
pMetaData
->
fields
[
0
].
builtInType
=
UA_NS0ID_
U
INT32
;
pMetaData
->
fields
[
0
].
name
=
UA_STRING
(
"Heartbeat (subscribed)"
);
pMetaData
->
fields
[
0
].
valueRank
=
-
1
;
/* scalar */
// ID
UA_FieldMetaData_init
(
&
pMetaData
->
fields
[
1
]);
UA_NodeId_copy
(
&
UA_TYPES
[
UA_TYPES_INT32
].
typeId
,
UA_NodeId_copy
(
&
UA_TYPES
[
UA_TYPES_
U
INT32
].
typeId
,
&
pMetaData
->
fields
[
1
].
dataType
);
pMetaData
->
fields
[
1
].
builtInType
=
UA_NS0ID_INT32
;
pMetaData
->
fields
[
1
].
builtInType
=
UA_NS0ID_
U
INT32
;
pMetaData
->
fields
[
1
].
name
=
UA_STRING
(
"ID (subscribed)"
);
pMetaData
->
fields
[
1
].
valueRank
=
-
1
;
/* scalar */
}
...
...
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