From 8346e23acabd2a94dc50fd84316221d6790f7f90 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 11 Nov 2015 14:49:51 +0100 Subject: Event stub --- src/pbx_rose.erl | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/pbx_rose.erl') diff --git a/src/pbx_rose.erl b/src/pbx_rose.erl index 73ec8b0..ab73064 100644 --- a/src/pbx_rose.erl +++ b/src/pbx_rose.erl @@ -1,5 +1,8 @@ -module(pbx_rose). +-behaviour(gen_event). +-export([init/1, handle_event/2, handle_call/2, handle_info/2, + terminate/2, code_change/3]). -export([decode/1, invoke/2]). -include("opcodes.hrl"). @@ -74,3 +77,36 @@ decode(#'ReturnResult_result'{opcode = Op, result = Data}) -> decode(<>) -> {ok, Pdu} = 'Remote-Operations-Generic-ROS-PDUs':decode('ROS', Data), decode(Pdu). + +%%% + +init(_Args) -> + io:format("Init rose~n"), + {ok, []}. + +handle_event({invoke, Invoke = #'Invoke'{}}, State) -> + io:format("Invoke ~p~n", [Invoke]), + {ok, State}; +handle_event({returnResult, ReturnResult = #'ReturnResult'{}}, State) -> + io:format("ReturnResult ~p~n", [ReturnResult]), + {ok, State}; +handle_event({returnError, ReturnError = #'ReturnError'{}}, State) -> + io:format("ReturnError ~p~n", [ReturnError]), + {ok, State}; +handle_event({reject, Reject = #'Reject'{}}, State) -> + io:format("Reject ~p~n", [Reject]), + {ok, State}; +handle_event(_Event, State) -> + {ok, State}. + +handle_call(_Request, State) -> + {ok, ok, State}. + +handle_info(_Info, State) -> + {ok, State}. + +terminate(_Reason, _State) -> + ok. + +code_change(_OldVsn, State, _Extra) -> + {ok, State}. -- cgit v1.2.3