#ifndef STATE_TRACKING_H #define STATE_TRACKING_H #include #include "esp_vfs_fat.h" /// @brief Registers function to be called on replay. /// @param replay_callback A function to call to playback the event. void register_replay_fn(void (*replay_fn)(const char*, const char*)); // TODO: add one for generically responding to all events. /// @brief Call this to indicate that the bomb state has transitioned. /// @param name The name of the event that has occured. /// @param arg The serialized data associated with the event. /// This must not contain newline characters such as '\n' or '\r' void event_occured(const char* name, const char* arg); /// @brief Sets the recording source. /// @param stream The stream to record to. /// @param should_close whether or not the stream should be closed when finished. /// @return true if the source was updated. bool set_recording_source(FILE* stream, bool should_close); /// @brief Sets the playback source. /// @param stream The stream to playback from. /// @param should_close whether or not the stream should be closed when finished. /// @return true if the source was updated. bool set_playback_source(FILE* stream, bool should_close); /// @brief Starts recording to the stream specified by `set_recording_source()`. /// @return true if starting recording is successful. bool start_recording(); /// @brief Stops recording the state. /// @return true if stopping the recording is successful. bool stop_recording(); /// @brief Starts playing back the recording specified by `set_playback_source()`. /// @return true if starting playback is successful. bool start_playback(); /// @brief Stops playing back the recording. /// @return true if stopping the playback is successful. bool stop_playback(); /// @brief Gets weather or not we are tracking the state /// This can be helpful to conditionally do extra computation only /// when we are tracking the state. /// @return bool is_state_tracking(); #endif /* STATE_TRACKING_H */