Changeset View
Changeset View
Standalone View
Standalone View
src/eimap.erl
Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | idle({ data, _Data }, State) -> | ||||
{ next_state, idle, State }; | { next_state, idle, State }; | ||||
idle(Command, State) when is_record(Command, command) -> | idle(Command, State) when is_record(Command, command) -> | ||||
%%lager:info("Idling"), | %%lager:info("Idling"), | ||||
NewState = send_command(Command, State), | NewState = send_command(Command, State), | ||||
{ next_state, wait_response, NewState }; | { next_state, wait_response, NewState }; | ||||
idle(_Event, State) -> | idle(_Event, State) -> | ||||
{ next_state, idle, State }. | { next_state, idle, State }. | ||||
next_state_after_emptied_queue(#state{ passthrough = true }) -> | |||||
gen_fsm:send_event(self(), flush_passthrough_buffer), | |||||
passthrough; | |||||
next_state_after_emptied_queue(_State) -> | next_state_after_emptied_queue(_State) -> | ||||
idle. | idle. | ||||
%%TODO a variant that checks "#command{ from = undefined }" to avoid parsing responses which will go undelivered? | %%TODO a variant that checks "#command{ from = undefined }" to avoid parsing responses which will go undelivered? | ||||
wait_response(Command, State) when is_record(Command, command) -> | wait_response(Command, State) when is_record(Command, command) -> | ||||
{ next_state, wait_response, enque_command(Command, State) }; | { next_state, wait_response, enque_command(Command, State) }; | ||||
wait_response({ data, _Data }, #state{ current_command = #command{ parse_state = undefined } } = State) -> | wait_response({ data, _Data }, #state{ current_command = #command{ parse_state = undefined } } = State) -> | ||||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |