README.md 1.28 KB
Newer Older
nickolay.kovalev's avatar
nickolay.kovalev committed
1
2
# erlopen62541

nickolay.kovalev's avatar
nickolay.kovalev committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Erlang port for OPC UA Client functionality based on
[open62541](https://github.com/open62541/open62541) project.

# Compilation

As prerequisite [open62541](https://github.com/open62541/open62541) framework should be installed and
simple example of C++ client/server could be built.

```bash
$ rebar3 clean && rebar3 compile
```

# Basic usage

After successfull compilation shell could be used for easy checking.

NOTE: As this is client functionality, valid and accessible OPC UA server or OPC UA server emulator
is required for completing this step.

Initial version of port has been tested with Prosys OPC Siluation Server.

```bash
$ rebar3 shell
```

```erlang
29
30
31
32
1> % open port
1> f(P), {ok, P} = erlopen62541:start_link().
{ok, <0.137.0>}
2> % connect to server
nickolay.kovalev's avatar
nickolay.kovalev committed
33
34
2> erlopen62541:connect(P, <<"opc.tcp://192.168.1.33:53530/OPCUA/SimulationServer">>).
ok
35
3> % read system namespace values
nickolay.kovalev's avatar
nickolay.kovalev committed
36
37
3> erlopen62541:read_node(P, 0, 2258).
{datetime,<<"25/8/2020 6:21:5.751">>}
38
4> % read user namespace values
nickolay.kovalev's avatar
nickolay.kovalev committed
39
40
erlopen62541:read_node(P, 3, 1001).
{integer,23}
nickolay.kovalev's avatar
nickolay.kovalev committed
41
42
43
44
45
46
47
48
49
50
51
52
```

# Dependency to project

Following setting of rebar simple adds port as dependency to the project:

```erlang
{deps, [
  ...
  {erlopen62541, {git, "https://git.faceplate.io/nickolay.kovalev/erlopen62541.git", {branch, master}}},
  ...
]}.
nickolay.kovalev's avatar
nickolay.kovalev committed
53
```