Skip to content
okebkal edited this page Apr 1, 2016 · 16 revisions

MODULE

fsm

MODULE SUMMARY

Generic fsm behaviour

DESCRIPTION

DATA TYPES

  time() = {s, integer() > 0} | {ms, integer() > 0} | {us, integer() > 0}

  trans() =

  cb() =  

  at() = 

EXPORTS

clear_timeout(SM, Event) -> Result

Types

  SM = sm()
  Event = atom()
  Result = sm()
clear_timeouts(SM) -> Result

Types

  SM = sm()
  Result = sm()
clear_timeouts(SM, EventList) -> Result

Types

  SM = sm()
  EventList = [atom()]
  Result = sm()
set_timeout(SM, Time, Event) -> Result

Types

  SM = sm()
  Time = time()
  Event = atom()
  Result = sm()
check_timeout(SM, Event) -> Result

Types

  SM = sm()
  Event = atom()
  Result = true | false
set_event(SM, Event) -> Result

Types

  SM = sm()
  Event = atom()
  Result = sm()
run_event(MiddleMan, SM, Term) -> Result

Types

  MiddleMan = mm()
  SM = sm()
  Term = any()
  Result = sm()
send_at_command(SM, AT) -> Result

Types

  SM = sm()
  AT = at()
  Result = sm()
broadcast(SM, Target, Term) -> Result

Types

  SM = sm()
  Target = atom()
  Term = any()
  Result = sm()
cast(CB, Term) -> ok

Types

  CB = cb()
  Term = any()
cast(SM, Target, Term) -> Result

Types

  SM = sm()
  Target = atom()
  Term = any()
  Result = sm()

= cast(SM, MM, EOpts, Term, Condition) -> Result

Types

  SM = sm()
  MiddleMan = mm()
  EOpts = any()
  Term = any()
  Condition = fun((MiddleMan, Role :: atom(), EOpts) -> true | false)
  Result = sm()

= role_available(SM, Target) -> Result

Types

  SM = sm()
  Target = atom()
  Result = true | false

CALLBACK FUNCTIONS

The following functions must be exported from a fsm callback module.

EXPORTS

Module:start_link(SM) -> Result

Types

  SM = sm()
  Result = {ok,pid()} | ignore | {error,any()}
Module:init(SM) -> Result

Types

  SM = sm()
  Result = sm()

= Module:stop(SM) -> ok

Types

  SM = sm()
Module:handle_event(MM, SM, Term) -> Result =

Types

  SM = sm()
  MM = mm()
  Term = any()
  Result = sm()
trans() -> Result

Types

  Result = trans()
final() -> Result

Types

  Result = [atom()]
init_event() -> Result

Types

  Result = atom()

SEE ALSO

role_worker, fsm_worker