From fc86381ccac10fa30aefe76996a716ae1d677f5b Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Thu, 29 Oct 2015 14:00:41 +0100 Subject: Prepare for rebar --- rose.erl | 64 ---------------------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 rose.erl (limited to 'rose.erl') diff --git a/rose.erl b/rose.erl deleted file mode 100644 index c720dd8..0000000 --- a/rose.erl +++ /dev/null @@ -1,64 +0,0 @@ --module(rose). - --export([decode/1, invoke/2, dispatch/1]). - --include("Remote-Operations-Generic-ROS-PDUs.hrl"). - -decode(Data) -> - 'Remote-Operations-Generic-ROS-PDUs':decode('ROS', Data). - -return(Id, Op, {ok, Data}) -> - 'Remote-Operations-Generic-ROS-PDUs':encode('ROS', {returnResult, - #'ReturnResult'{invokeId = Id, - result = #'ReturnResult_result'{opcode = Op, result = Data}}}). - -invoke(Op, {ok, Data}) -> - Id = counter:next(), - 'Remote-Operations-Generic-ROS-PDUs':encode('ROS', {invoke, - #'Invoke'{invokeId = Id, opcode = Op, argument = Data}}). - -dispatch({invoke, #'Invoke'{invokeId = Id, opcode = Op, argument = Data}}) -> - counter:set(Id), - case Op of - {local, 21} -> - ok; - {local, 51} -> - {ok, Esc} = csta:decode(Data), - io:format("Esc ~p~n", [Esc]), - ok; - {local, 71} -> - ok; - {local, 74} -> - ok; - {local, 211} -> - {ok, Status} = csta:decodeStatus(Data), - io:format("Status: ~p~n", [Status]), - return(Id, Op, csta:statusOk()); - _ -> - error - end; - -dispatch({returnResult, #'ReturnResult'{invokeId = Id, result = Data}}) -> - counter:set(Id), - dispatch(Data); - -dispatch({returnError, #'ReturnError'{invokeId = Id, errcode = Code, parameter = Par}}) -> - counter:set(Id), - io:format("Err: ~p ~p~n", [Code, Par]), - error; - -dispatch({reject, #'Reject'{invokeId = Id, problem = Problem}}) -> - counter:set(Id), - io:format("Problem: ~p~n", [Problem]), - error; - -dispatch(#'ReturnResult_result'{opcode = Op, result = Data}) -> - case Op of - {local, 74} -> - {ok, Status} = 'CSTA-snapshot-device':decode( - 'SnapshotDeviceResult', Data), - io:format("Result: ~p~n", [Status]); - _ -> - io:format("Result: ~p~n", [Data]) - end, - ok. -- cgit v1.2.3