From c5b5e7d8d81c210787a378c7c2d7e30db0305c0b Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Thu, 29 Oct 2015 12:26:38 +0100 Subject: Autocount invoke --- rose.erl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'rose.erl') diff --git a/rose.erl b/rose.erl index 650061c..65aa139 100644 --- a/rose.erl +++ b/rose.erl @@ -1,6 +1,6 @@ -module(rose). --export([decode/1, return/3, invoke/3, dispatch/1]). +-export([decode/1, invoke/2, dispatch/1]). -include("Remote-Operations-Generic-ROS-PDUs.hrl"). @@ -8,15 +8,17 @@ 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, + '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, #'Invoke'{invokeId = Id, opcode = Op, argument = 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; -- cgit v1.2.3