From dfdff99cd81b8a1d644b871967f35f57474a89db Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 27 Oct 2015 18:58:48 +0100 Subject: Add more response types --- tda.erl | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'tda.erl') 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(<>) -> 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. -- cgit v1.2.3