分类: LINUX
2011-03-25 13:33:53
%%File Name:pro_ureq.erl %%Using:This module is used for processing user's request which is "MASTER_VM_START". %%The command is used for select a NC. -module(pro_ureq). -behaviour(gen_fsm). -export([start/1]). -export([message/1]). -export([init/1, nc_unvailable/2, nc_available/2, code_change/4, handle_info/3]). -export([handle_event/3, terminate/3, handle_sync_event/4]). start(AllResource) -> gen_fsm:start_link({local, pro_ureq}, pro_ureq, AllResource, []). message(Msg) -> gen_fsm:send_event(pro_ureq, {button, Msg}). %%%Callback function nc_unvailable({button, Msg}, {_SoFar, AllResource}) -> io:format("~p ~p~n",[AllResource, Msg]), {next_state, nc_available, {[], AllResource}}. nc_available(A, State) -> io:format("ssssssssssssssss~p~n", [A]), {next_state, nc_unvailable, State}. init(AllResource) -> {ok, nc_unvailable, {[], AllResource}}. code_change(_OldVsn, StateName, StateData, _Extra) -> {ok, StateName, StateData}. handle_info(Info, StateName, StateData) -> %%%%return Result {Info, StateName, StateData}. handle_event(Event, StateName, StateData) -> %%%%return Result {Event, StateName, StateData}. terminate(_Reason, _StateName, _StateData) -> ok. handle_sync_event(Event, From, StateName, StateData) -> %%%%return Result {Event, From, StateName, StateData}. |