enum state { STATE_CONNECTING, STATE_LOGGED_OUT, STATE_LOGGED_IN, STATE_INPUT_PASSCODE, }; void change_state(enum state new_state); void loop_state();