Commit 89c27b4e authored by nickolay.kovalev's avatar nickolay.kovalev
Browse files

open_port by default

parent c589054f
......@@ -26,7 +26,7 @@ $ rebar3 shell
```
```erlang
1> % open port
1> % open port explicitly
1> f(P), P = erlopen62541:open_port(<<"/home/<user>/erlopen62541/priv/">>).
#Port<0.10>
2> % connecting to server
......
......@@ -8,7 +8,7 @@
%% General API
-export([
open_port/1,
open_port/0, open_port/1,
connect/2,
disconnect/1,
read_node/3
......@@ -38,11 +38,18 @@
%%==============================================================================
%% General API
%%==============================================================================
%% @doc Opens erlang port either binary location to C++ port
%% @doc Opens erlang port either by default priv folder or explicit
%% binary location to C++ port
%%------------------------------------------------------------------------------
-spec open_port(Location :: binary()) -> opc_ua_connection().
-spec open_port() -> opc_ua_connection().
%%------------------------------------------------------------------------------
open_port() ->
PrivDir = code:priv_dir(erlopen62541),
erlang:open_port({spawn_executable, PrivDir ++ "/" ++ ?PORT_NAME}, ?PORT_OPTS).
%%------------------------------------------------------------------------------
-spec open_port(Location :: binary()) -> opc_ua_connection().
%%------------------------------------------------------------------------------
open_port(Location) when is_binary(Location) ->
LocationStr = erlang:binary_to_list(Location),
erlang:open_port({spawn_executable, LocationStr ++ ?PORT_NAME}, ?PORT_OPTS).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment