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
1
Merge Requests
1
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
nexedi
osie
Commits
a5ef183a
Commit
a5ef183a
authored
Oct 28, 2021
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add last relay.
parent
be726700
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
coupler/opc-ua-server/server.c
coupler/opc-ua-server/server.c
+36
-0
No files found.
coupler/opc-ua-server/server.c
View file @
a5ef183a
...
@@ -163,6 +163,19 @@ static void addVariable(UA_Server *server) {
...
@@ -163,6 +163,19 @@ static void addVariable(UA_Server *server) {
UA_Server_addVariableNode
(
server
,
myIntegerNodeId6
,
parentNodeId
,
UA_Server_addVariableNode
(
server
,
myIntegerNodeId6
,
parentNodeId
,
parentReferenceNodeId
,
myIntegerName6
,
parentReferenceNodeId
,
myIntegerName6
,
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_BASEDATAVARIABLETYPE
),
attr6
,
NULL
,
NULL
);
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_BASEDATAVARIABLETYPE
),
attr6
,
NULL
,
NULL
);
// I2C1 / relay 3
UA_VariableAttributes
attr7
=
UA_VariableAttributes_default
;
UA_Variant_setScalar
(
&
attr7
.
value
,
&
myInteger
,
&
UA_TYPES
[
UA_TYPES_INT32
]);
attr7
.
description
=
UA_LOCALIZEDTEXT
(
"en-US"
,
"I2C1 / Relay 3"
);
attr7
.
displayName
=
UA_LOCALIZEDTEXT
(
"en-US"
,
"I2C1 / Relay 3"
);
attr7
.
dataType
=
UA_TYPES
[
UA_TYPES_INT32
].
typeId
;
attr7
.
accessLevel
=
UA_ACCESSLEVELMASK_READ
|
UA_ACCESSLEVELMASK_WRITE
;
UA_NodeId
myIntegerNodeId7
=
UA_NODEID_STRING
(
1
,
"i2c1.relay3"
);
UA_QualifiedName
myIntegerName7
=
UA_QUALIFIEDNAME
(
1
,
"I2C1 / Relay 3"
);
UA_Server_addVariableNode
(
server
,
myIntegerNodeId7
,
parentNodeId
,
parentReferenceNodeId
,
myIntegerName7
,
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_BASEDATAVARIABLETYPE
),
attr7
,
NULL
,
NULL
);
}
}
...
@@ -299,6 +312,22 @@ static void afterWriteTimeI2C1_2(UA_Server *server,
...
@@ -299,6 +312,22 @@ static void afterWriteTimeI2C1_2(UA_Server *server,
}
}
}
}
static
void
afterWriteTimeI2C1_3
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
)
{
if
(
data
->
value
.
type
==
&
UA_TYPES
[
UA_TYPES_INT32
])
{
UA_Int32
hrValue
=
*
(
UA_Int32
*
)
data
->
value
.
data
;
if
(
hrValue
>
0
){
I2C_1_RELAYS_STATE
|=
1UL
<<
3
;
setRelayState
(
I2C_1_RELAYS_STATE
,
I2C_1_ADDR
);
}
else
{
I2C_1_RELAYS_STATE
&=
~
(
1UL
<<
3
);
setRelayState
(
I2C_1_RELAYS_STATE
,
I2C_1_ADDR
);
}
}
}
static
void
addValueCallbackToCurrentTimeVariable
(
UA_Server
*
server
)
{
static
void
addValueCallbackToCurrentTimeVariable
(
UA_Server
*
server
)
{
// I2C0
// I2C0
...
@@ -352,6 +381,13 @@ static void addValueCallbackToCurrentTimeVariable(UA_Server *server) {
...
@@ -352,6 +381,13 @@ static void addValueCallbackToCurrentTimeVariable(UA_Server *server) {
callback6
.
onWrite
=
afterWriteTimeI2C1_2
;
callback6
.
onWrite
=
afterWriteTimeI2C1_2
;
UA_Server_setVariableNode_valueCallback
(
server
,
currentNodeId6
,
callback6
);
UA_Server_setVariableNode_valueCallback
(
server
,
currentNodeId6
,
callback6
);
// relay 2
UA_NodeId
currentNodeId7
=
UA_NODEID_STRING
(
1
,
"i2c1.relay3"
);
UA_ValueCallback
callback7
;
callback7
.
onRead
=
beforeReadTime
;
callback7
.
onWrite
=
afterWriteTimeI2C1_3
;
UA_Server_setVariableNode_valueCallback
(
server
,
currentNodeId7
,
callback7
);
}
}
...
...
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