summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-10-30 11:20:44 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-10-30 11:20:44 +0100
commit2575bc521eeb70a6a4f2bb06e408e8160c372320 (patch)
tree04ef6aa0ed286a3bcba73a5463a956c36f06cd53
parent0892b5ea5aae60aa7cbb789de0fa316735344cc0 (diff)
Split files
-rw-r--r--src/acse.erl2
-rw-r--r--src/csta.erl7
-rw-r--r--src/rose.erl5
-rw-r--r--src/status.erl17
4 files changed, 20 insertions, 11 deletions
diff --git a/src/acse.erl b/src/acse.erl
index e8f0d70..90ec592 100644
--- a/src/acse.erl
+++ b/src/acse.erl
@@ -14,7 +14,7 @@ ui() ->
associate() ->
'ACSE-1':encode('ACSE-apdu', {aarq, #'AARQ-apdu'{
- 'protocol-version' = [version1],
+ 'protocol-version' = [version1], % required
'application-context-name' = {1, 3, 12, 0, 218},
'user-information' = [#'EXTERNAL'{
'direct-reference' = {1, 3, 12, 0, 285, 200},
diff --git a/src/csta.erl b/src/csta.erl
index 60aaaee..dbd53b3 100644
--- a/src/csta.erl
+++ b/src/csta.erl
@@ -1,7 +1,6 @@
-module(csta).
-export([lines/1, decode/1, snapshot/1]).
--export([decodeStatus/1, statusOk/0]).
-include("CSTA-escape-service.hrl").
-include("CSTA-snapshot-device.hrl").
@@ -22,12 +21,6 @@ lines(Device) ->
{kmeSystemData, {getSystemData, {request, {deviceList,
{category, {standardDevice, Device}}}}}}}}).
-decodeStatus(Data) ->
- 'CSTA-system-status':decode('SystemStatusArg', Data).
-
-statusOk() ->
- 'CSTA-system-status':encode('SystemStatusRes', {noData, []}).
-
snapshot(Device) ->
'CSTA-snapshot-device':encode('SnapshotDeviceArgument',
#'SnapshotDeviceArgument'{
diff --git a/src/rose.erl b/src/rose.erl
index c720dd8..47a48f2 100644
--- a/src/rose.erl
+++ b/src/rose.erl
@@ -31,9 +31,8 @@ dispatch({invoke, #'Invoke'{invokeId = Id, opcode = Op, argument = Data}}) ->
{local, 74} ->
ok;
{local, 211} ->
- {ok, Status} = csta:decodeStatus(Data),
- io:format("Status: ~p~n", [Status]),
- return(Id, Op, csta:statusOk());
+ io:format("Status: ~p~n", [status:value(Data)]),
+ return(Id, Op, status:encode());
_ ->
error
end;
diff --git a/src/status.erl b/src/status.erl
new file mode 100644
index 0000000..3c419a3
--- /dev/null
+++ b/src/status.erl
@@ -0,0 +1,17 @@
+-module(status).
+
+-export([decode/1, encode/0, value/1]).
+
+-include("CSTA-system-status.hrl").
+
+decode(Data) ->
+ 'CSTA-system-status':decode('SystemStatusArg', Data).
+
+encode() ->
+ 'CSTA-system-status':encode('SystemStatusRes', {noData, []}).
+
+value({ok, #'SystemStatusArg'{systemStatus = Status}}) ->
+ Status;
+
+value(Data) ->
+ value(decode(Data)).