From 65f8f5577020e965f183a31ba6f9a4d3a567edb4 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 23 Oct 2015 17:22:59 +0200 Subject: Shorter names --- tda.erl | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'tda.erl') diff --git a/tda.erl b/tda.erl index 5d26350..535eb12 100644 --- a/tda.erl +++ b/tda.erl @@ -5,34 +5,29 @@ -export([associate_abort/1]). -export([system_status/1]). --include("ACSE-1.hrl"). --include("CSTA-application-context-information-csta3.hrl"). --include("Remote-Operations-Generic-ROS-PDUs.hrl"). +-include("acse.hrl"). +-include("rose.hrl"). associate_request() -> - Ver = {newDefinition, #'NewACSEUserInformationForCSTA'{ - cSTAVersion = [versionFive]}}, - {ok, Enc} = 'CSTA-application-context-information-csta3':encode( - 'ACSEUserInformationForCSTA', Ver), + Ver = #'NewACSEUserInformationForCSTA'{cSTAVersion = [versionFive]}, + {ok, Enc} = acse:encode('ACSEUserInformationForCSTA', {newDefinition, Ver}), Pdu = #'AARQ-apdu'{'application-context-name' = {1, 3, 12, 0, 218}, 'user-information' = [#'EXTERNAL'{ 'direct-reference' = {1, 3, 12, 0, 285, 200}, - encoding = {'single-ASN1-type', Enc} - }]}, - 'ACSE-1':encode('AARQ-apdu', Pdu). + encoding = {'single-ASN1-type', Enc}}]}, + acse:encode('AARQ-apdu', Pdu). % Accept % <<97,47,128,2,7,128,161,7,6,5,43,12,0,129,90,162,3,2,1,0,163,5,161,3,2,1,1,190,20,40,18,6,7,43,12,0,130,29,129,72,160,7,160,5,3,3,0,8,0>> % Reject % <<97,25,128,2,7,128,161,7,6,5,43,12,0,129,90,162,3,2,1,1,163,5,161,3,2,1,1>> associate_result(Bin) -> - {ok, Pdu} = 'ACSE-1':decode('AARE-apdu', Bin), + {ok, Pdu} = acse:decode('AARE-apdu', Bin), case Pdu#'AARE-apdu'.result of accepted -> [UI] = Pdu#'AARE-apdu'.'user-information', {_, Enc} = UI#'EXTERNAL'.encoding, - {ok, {_, Ver}} = 'CSTA-application-context-information-csta3':decode( - 'ACSEUserInformationForCSTA', Enc), + {ok, {_, Ver}} = acse:decode('ACSEUserInformationForCSTA', Enc), {Pdu#'AARE-apdu'.result, Pdu#'AARE-apdu'.'result-source-diagnostic', Ver#'NewACSEUserInformationForCSTA'.cSTAVersion}; @@ -45,14 +40,14 @@ associate_result(Bin) -> end. release_request() -> - 'ACSE-1':encode('RLRQ-apdu', #'RLRQ-apdu'{}). + acse:encode('RLRQ-apdu', #'RLRQ-apdu'{}). release_result(Bin) -> - 'ACSE-1':decode('RLRE-apdu', Bin). + acse:decode('RLRE-apdu', Bin). % <<100,3,128,1,0>> associate_abort(Bin) -> - {ok, Pdu} = 'ACSE-1':decode('ABRT-apdu', Bin), + {ok, Pdu} = acse:decode('ABRT-apdu', Bin), Pdu#'ABRT-apdu'.'abort-source'. % <<161,12,2,1,1,2,2,0,211,48,3,10,1,2>> @@ -60,7 +55,7 @@ associate_abort(Bin) -> system_status(Bin) -> Inv = #'Invoke'{invokeId = 1, opcode = {local, 211}}, io:format("~p~n", [Inv]), - case 'Remote-Operations-Generic-ROS-PDUs':encode('Invoke', Inv) of + case rose:encode('Invoke', Inv) of {ok, Invoke} -> Invoke; {error, Reason} -> Reason end. -- cgit v1.2.3