summaryrefslogtreecommitdiff
path: root/tda.erl
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-10-27 18:58:48 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-10-27 18:58:48 +0100
commitdfdff99cd81b8a1d644b871967f35f57474a89db (patch)
tree834675f3fd22be653a6c33f6aae4eb9fbfa3ccde /tda.erl
parent895f2d9af2f4b7abe0d72811731328b1ccbc8db9 (diff)
Add more response types
Diffstat (limited to 'tda.erl')
-rw-r--r--tda.erl24
1 files changed, 17 insertions, 7 deletions
diff --git a/tda.erl b/tda.erl
index 2a38d89..293fb32 100644
--- a/tda.erl
+++ b/tda.erl
@@ -1,6 +1,7 @@
-module(tda).
-export([start/0, client/1, stop/0]).
+-export([ext/0]).
-define(TIMEOUT, 300000).
-define(CONNECT_TIMEOUT, 3000).
@@ -10,6 +11,7 @@
start() -> register(tda_client, spawn(?MODULE, client, [{dial, ?HOST, ?PORT}])).
stop() -> tda_client ! {logout}.
+ext() -> tda_client ! {ext}.
client({dial, Host, Port}) ->
io:format("Dial ~p:~p~n", [Host, Port]),
@@ -39,6 +41,12 @@ loop(Sock) ->
{ok, Bye} = acse:release_request(),
gen_tcp:send(Sock, Bye),
loop(Sock);
+ {ext} ->
+ io:format("Request Ext lines~n", []),
+ {ok, Ext} = csta:ext_lines(),
+ {ok, Rq} = rose:encode({present, 10}, {local, 51}, Ext),
+ gen_tcp:send(Sock, Rq),
+ loop(Sock);
{tcp, Sock, Msg} ->
io:format("Reply ~p~n", [Msg]),
case decode(Sock, Msg) of
@@ -69,11 +77,13 @@ decode(Sock, Msg) ->
dispatch(<<Head:8,_/binary>>) ->
case Head of
- 96 -> acse;
- 97 -> acse;
- 98 -> acse;
- 99 -> acse;
- 100 -> acse;
- 161 -> rose;
- 162 -> rose
+ 96 -> acse; % aarq
+ 97 -> acse; % aare
+ 98 -> acse; % rlrq
+ 99 -> acse; % rlre
+ 100 -> acse; % abrt
+ 161 -> rose; % invoke
+ 162 -> rose; % returnResult
+ 163 -> rose; % returnError
+ 164 -> rose % reject
end.