2010-02-03 11:56:30 +00:00
|
|
|
-module({{fsmid}}).
|
|
|
|
-behaviour(gen_fsm).
|
|
|
|
-define(SERVER, ?MODULE).
|
|
|
|
|
|
|
|
%% ------------------------------------------------------------------
|
|
|
|
%% API Function Exports
|
|
|
|
%% ------------------------------------------------------------------
|
|
|
|
|
|
|
|
-export([start_link/0]).
|
|
|
|
|
|
|
|
%% ------------------------------------------------------------------
|
|
|
|
%% gen_fsm Function Exports
|
|
|
|
%% ------------------------------------------------------------------
|
|
|
|
|
2011-07-13 15:59:07 +00:00
|
|
|
-export([init/1, state_name/2, state_name/3, handle_event/3,
|
|
|
|
handle_sync_event/4, handle_info/3, terminate/3,
|
|
|
|
code_change/4]).
|
2010-02-03 11:56:30 +00:00
|
|
|
|
|
|
|
%% ------------------------------------------------------------------
|
|
|
|
%% API Function Definitions
|
|
|
|
%% ------------------------------------------------------------------
|
|
|
|
|
|
|
|
start_link() ->
|
2011-07-13 15:59:07 +00:00
|
|
|
gen_fsm:start_link({local, ?SERVER}, ?MODULE, [], []).
|
2010-02-03 11:56:30 +00:00
|
|
|
|
|
|
|
%% ------------------------------------------------------------------
|
|
|
|
%% gen_fsm Function Definitions
|
|
|
|
%% ------------------------------------------------------------------
|
|
|
|
|
|
|
|
init(_Args) ->
|
2011-07-13 15:59:07 +00:00
|
|
|
{ok, initial_state_name, initial_state}.
|
2010-02-03 11:56:30 +00:00
|
|
|
|
|
|
|
state_name(_Event, State) ->
|
2011-07-13 15:59:07 +00:00
|
|
|
{next_state, state_name, State}.
|
2010-02-03 11:56:30 +00:00
|
|
|
|
|
|
|
state_name(_Event, _From, State) ->
|
2011-07-13 15:59:07 +00:00
|
|
|
{reply, ok, state_name, State}.
|
2010-02-03 11:56:30 +00:00
|
|
|
|
|
|
|
handle_event(_Event, StateName, State) ->
|
2011-07-13 15:59:07 +00:00
|
|
|
{next_state, StateName, State}.
|
2010-02-03 11:56:30 +00:00
|
|
|
|
|
|
|
handle_sync_event(_Event, _From, StateName, State) ->
|
2011-07-13 15:59:07 +00:00
|
|
|
{reply, ok, StateName, State}.
|
2010-02-03 11:56:30 +00:00
|
|
|
|
|
|
|
handle_info(_Info, StateName, State) ->
|
2011-07-13 15:59:07 +00:00
|
|
|
{next_state, StateName, State}.
|
2010-02-03 11:56:30 +00:00
|
|
|
|
|
|
|
terminate(_Reason, _StateName, _State) ->
|
2011-07-13 15:59:07 +00:00
|
|
|
ok.
|
2010-02-03 11:56:30 +00:00
|
|
|
|
|
|
|
code_change(_OldVsn, StateName, State, _Extra) ->
|
2011-07-13 15:59:07 +00:00
|
|
|
{ok, StateName, State}.
|
2010-02-03 11:56:30 +00:00
|
|
|
|
|
|
|
%% ------------------------------------------------------------------
|
|
|
|
%% Internal Function Definitions
|
|
|
|
%% ------------------------------------------------------------------
|
|
|
|
|