From f116b791d5ba5d6d65aba816e94569e69292a3ee Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Thu, 29 Oct 2015 07:29:56 +0100 Subject: Request ext/co --- Makefile | 2 +- csta.erl | 6 +++++- rose.erl | 28 +++++++++++++++++++--------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 0e0f345..6499554 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ ASN1 = ACSE-1.asn1 \ CSTA-monitor-start.asn1 \ CSTA-status-reporting.asn1 \ Remote-Operations-Generic-ROS-PDUs.asn1 \ + Remote-Operations-Information-Objects.asn1 \ KME-specific-types.asn1 \ CSTA-device-identifiers.asn1 \ CSTA-call-connection-identifiers.asn1 \ @@ -18,7 +19,6 @@ all: $(SRCS) %.erl: lib/%.asn1 erlc $< - erlc $@ clean: rm -f $(SRCS) $(HDRS) *.beam *.asn1db diff --git a/csta.erl b/csta.erl index c47b78c..306851c 100644 --- a/csta.erl +++ b/csta.erl @@ -1,8 +1,12 @@ -module(csta). --export([co_lines/0, ext_lines/0]). +-export([co_lines/0, ext_lines/0, decode/1]). -include("CSTA-escape-service.hrl"). +-include("CSTA-extension-types.hrl"). + +decode(Data) -> + 'CSTA-escape-service':decode('EscapeArgument', Data). co_lines() -> 'CSTA-escape-service':encode('EscapeArgument', #'EscapeArgument'{ diff --git a/rose.erl b/rose.erl index c00db2f..a367ee0 100644 --- a/rose.erl +++ b/rose.erl @@ -4,22 +4,32 @@ -include("Remote-Operations-Generic-ROS-PDUs.hrl"). -decode(Data) -> 'Remote-Operations-Generic-ROS-PDUs':decode('ROS', Data). +decode(Data) -> + 'Remote-Operations-Generic-ROS-PDUs':decode('ROS', Data). -return(Id, Op, {ok, Data}) -> 'Remote-Operations-Generic-ROS-PDUs':encode('ROS', +return(Id, Op, {ok, Data}) -> + 'Remote-Operations-Generic-ROS-PDUs':encode('ROS', {returnResult, #'ReturnResult'{invokeId = Id, result = #'ReturnResult_result'{opcode = Op, result = Data}}}). -invoke(Id, Op, {ok, Data}) -> 'Remote-Operations-Generic-ROS-PDUs':encode('ROS', +invoke(Id, Op, {ok, Data}) -> + 'Remote-Operations-Generic-ROS-PDUs':encode('ROS', {invoke, #'Invoke'{invokeId = Id, opcode = Op, argument = Data}}). -dispatch({invoke, #'Invoke'{invokeId = Id, opcode = Op}}) -> +dispatch({invoke, #'Invoke'{invokeId = Id, opcode = Op, argument = Data}}) -> case Op of - {local, 21} -> ok; - {local, 51} -> ok; - {local, 71} -> ok; - {local, 211} -> return(Id, Op, status:status()); - _ -> error + {local, 21} -> + ok; + {local, 51} -> + {ok, Esc} = csta:decode(Data), + io:format("Esc ~p~n", [Esc]), + ok; + {local, 71} -> + ok; + {local, 211} -> + return(Id, Op, status:status()); + _ -> + error end; dispatch({returnResult, #'ReturnResult'{result = Data}}) -> -- cgit v1.2.3