%%%------------------------------------------------------------------- %%% @author Joe Zhao %%% @copyright (C) 2014, %%% @doc %%% %%% @end %%% Created : 10. May 2014 下午9:20 %%%------------------------------------------------------------------- -module(cmdiface). -author("Joe Zhao"). -compile([debug_info,export_all]). %% API %%-export([]). reg_feedbackOps(Addr,Name,T,MsgReq,MsgRes,To) -> io:format("Logging new command: ~p ~n",[Name]), Init=fun () -> rsbusserv ! {devicemon,Addr,MsgReq} end, Exit= fun () -> rsbusserv ! {devicemon,Addr,[]} end, Pid = spawn(?MODULE,res_manip,[Init,Exit,To]), Call = fun () -> Pid ! rsbusserv:rsbusreq(Addr,MsgRes) end, eventserv:reg_future(Call,T). invoke_cmd(Addr,Name,MsgReq) -> io:format("Command: ~p ~n",[Name]), rsbusserv! {devicemon,comm,Addr,MsgReq}. res_manip(Init,Exit,To) -> Init(), receive Res -> To ! Res end, Exit().