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
nexedi
osie
Commits
7e67e1f3
Commit
7e67e1f3
authored
Oct 28, 2021
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename.
parent
f541b4bb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
coupler/opc-ua-server/server.c
coupler/opc-ua-server/server.c
+10
-10
No files found.
coupler/opc-ua-server/server.c
View file @
7e67e1f3
...
...
@@ -18,8 +18,8 @@
#include <open62541/server_config_default.h>
// global relay state
uint8_t
I2C_0_RELAYS_STATE
=
0
;
// state of 4 relays at
MOD-IO
0
uint8_t
I2C_1_RELAYS_STATE
=
0
;
// state of 4 relays at
MOD-IO
1
uint8_t
I2C_0_RELAYS_STATE
=
0
;
// state of 4 relays at
I2C slave
0
uint8_t
I2C_1_RELAYS_STATE
=
0
;
// state of 4 relays at
I2C slave
1
// the default addresses of MOD-IOs
const
int
I2C_0_ADDR
=
0x58
;
...
...
@@ -139,7 +139,7 @@ static void beforeReadTime(UA_Server *server,
// XXX: having afterWriteTime{0..3} is not needed and maybe with introspection of context we can
// write only one callback function
static
void
afterWriteTime0
(
UA_Server
*
server
,
static
void
afterWriteTime
I2C0_
0
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
)
{
...
...
@@ -156,7 +156,7 @@ static void afterWriteTime0(UA_Server *server,
}
}
static
void
afterWriteTime1
(
UA_Server
*
server
,
static
void
afterWriteTime
I2C0_
1
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
)
{
...
...
@@ -173,7 +173,7 @@ static void afterWriteTime1(UA_Server *server,
}
}
static
void
afterWriteTime2
(
UA_Server
*
server
,
static
void
afterWriteTime
I2C0_
2
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
)
{
...
...
@@ -190,7 +190,7 @@ static void afterWriteTime2(UA_Server *server,
}
}
static
void
afterWriteTime3
(
UA_Server
*
server
,
static
void
afterWriteTime
I2C0_
3
(
UA_Server
*
server
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
)
{
...
...
@@ -212,28 +212,28 @@ static void addValueCallbackToCurrentTimeVariable(UA_Server *server) {
UA_NodeId
currentNodeId0
=
UA_NODEID_STRING
(
1
,
"i2c0.relay0"
);
UA_ValueCallback
callback0
;
callback0
.
onRead
=
beforeReadTime
;
callback0
.
onWrite
=
afterWriteTime0
;
callback0
.
onWrite
=
afterWriteTime
I2C0_
0
;
UA_Server_setVariableNode_valueCallback
(
server
,
currentNodeId0
,
callback0
);
// relay 1
UA_NodeId
currentNodeId1
=
UA_NODEID_STRING
(
1
,
"i2c0.relay1"
);
UA_ValueCallback
callback1
;
callback1
.
onRead
=
beforeReadTime
;
callback1
.
onWrite
=
afterWriteTime1
;
callback1
.
onWrite
=
afterWriteTime
I2C0_
1
;
UA_Server_setVariableNode_valueCallback
(
server
,
currentNodeId1
,
callback1
);
// relay 2
UA_NodeId
currentNodeId2
=
UA_NODEID_STRING
(
1
,
"i2c0.relay2"
);
UA_ValueCallback
callback2
;
callback2
.
onRead
=
beforeReadTime
;
callback2
.
onWrite
=
afterWriteTime2
;
callback2
.
onWrite
=
afterWriteTime
I2C0_
2
;
UA_Server_setVariableNode_valueCallback
(
server
,
currentNodeId2
,
callback2
);
// relay 3
UA_NodeId
currentNodeId3
=
UA_NODEID_STRING
(
1
,
"i2c0.relay3"
);
UA_ValueCallback
callback3
;
callback3
.
onRead
=
beforeReadTime
;
callback3
.
onWrite
=
afterWriteTime3
;
callback3
.
onWrite
=
afterWriteTime
I2C0_
3
;
UA_Server_setVariableNode_valueCallback
(
server
,
currentNodeId3
,
callback3
);
}
...
...
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