gen_fsm_helpers v0.1.0 GenFSMHelpers
Helper library for GenFSM.
Add helper functions to eliminate returning those nasty tuples.
- next_state
- reply
Link to this section Summary
Functions
Return next_state tuple, given a tuple
Return next_state tuple
Return next_state tuple with timeout
Return reply tuple
Return reply tuple with timeout
Link to this section Functions
Return next_state tuple, given a tuple.
Examples
iex> GenFSMHelpers.next_state({:data, :idle})
{:next_state, :idle, :data}
Link to this function
next_state(state_data, timeout)
next_state({any, atom}, integer) :: {:next_state, atom, any, integer}
next_state(any, atom) :: {:next_state, atom, any}
Return next_state tuple.
Examples
iex> GenFSMHelpers.next_state(:data, :active)
{:next_state, :active, :data}
iex> GenFSMHelpers.next_state({:data, :active}, 5000)
{:next_state, :active, :data, 5000}
Link to this function
next_state(state_data, state_name, timeout)
next_state(any, atom, integer) :: {:next_state, atom, any, integer}
Return next_state tuple with timeout.
Examples
iex> GenFSMHelpers.next_state(%{data: true}, :busy, 1000)
{:next_state, :busy, %{data: true}, 1000}
Link to this function
reply(state_data, response, state_name)
reply(any, any, atom) :: {:reply, any, atom, any}
Return reply tuple.
Examples
iex> GenFSMHelpers.reply(%{}, true, :pending)
{:reply, true, :pending, %{}}
Link to this function
reply(state_data, response, state_name, timeout)
reply(any, any, atom, integer) :: {:reply, any, atom, any, integer}
Return reply tuple with timeout.
Examples
iex> GenFSMHelpers.reply(%{}, true, :pending, 5000)
{:reply, true, :pending, %{}, 5000}