|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
The OTA listener. More...
#include <STAR_EthernetOTA.h>
Public Types | |
| using | StartCallback = void (*)(void* user_data, uint32_t image_bytes) |
| using | ProgressCallback |
| using | EndCallback = void (*)(void* user_data, Result result) |
Public Member Functions | |
| Server (uint16_t port=STAR_OTA_DEFAULT_PORT) | |
| void | begin () |
| Start listening. | |
| bool | clientWaiting () |
| Is a client waiting? | |
| Result | poll () |
| Accept a waiting client and run the transfer to completion. | |
| Result | handleClient (EthernetClient &client) |
| Run the transfer on a client you accepted yourself. | |
| Result | lastResult () const |
| Result of the last attempt that was not Idle. | |
| void | onStart (StartCallback cb, void *user_data=nullptr) |
| Called once the size header is in, before any flash write. | |
| void | onProgress (ProgressCallback cb, void *user_data=nullptr) |
| Called every STAR_OTA_CHUNK_SIZE-ish bytes. | |
| void | onEnd (EndCallback cb, void *user_data=nullptr) |
| Called on both success and failure, before any reboot. | |
Public Attributes | |
| Config | config |
Private Member Functions | |
| Result | transfer (EthernetClient &client) |
| Result | fail (EthernetClient &client, Result r, const char *why) |
| bool | readSize (EthernetClient &client, uint32_t &size_out) |
Private Attributes | |
| PortableServer | server_ |
| Result | last_result_ = Result::Idle |
| StartCallback | on_start_ = nullptr |
| void * | on_start_data_ = nullptr |
| ProgressCallback | on_progress_ = nullptr |
| void * | on_progress_data_ = nullptr |
| EndCallback | on_end_ = nullptr |
| void * | on_end_data_ = nullptr |
The OTA listener.
One per board.
Callbacks let a board react without this library having to know about it — the hotfire boards use onStart() to suspend DHCP lease renewal, so their address cannot move mid-flash.
Definition at line 132 of file STAR_EthernetOTA.h.
| using StarOTA::Server::EndCallback = void (*)(void* user_data, Result result) |
Definition at line 137 of file STAR_EthernetOTA.h.
Definition at line 135 of file STAR_EthernetOTA.h.
| using StarOTA::Server::StartCallback = void (*)(void* user_data, uint32_t image_bytes) |
Definition at line 134 of file STAR_EthernetOTA.h.
|
explicit |
Definition at line 46 of file STAR_EthernetOTA.cpp.
| void StarOTA::Server::begin | ( | ) |
| bool StarOTA::Server::clientWaiting | ( | ) |
Is a client waiting?
Cheap; safe to call every loop.
Definition at line 75 of file STAR_EthernetOTA.cpp.
References server_.
|
private |
Definition at line 109 of file STAR_EthernetOTA.cpp.
Referenced by transfer().
| Result StarOTA::Server::handleClient | ( | EthernetClient & | client | ) |
Run the transfer on a client you accepted yourself.
poll() is what you want; this exists for boards that own their own listening socket (and for the legacy hotfire_ota.h shim). Blocks for the duration of the transfer, replies "OK" and reboots on success.
Definition at line 87 of file STAR_EthernetOTA.cpp.
References config, delay(), ESP, last_result_, on_end_, on_end_data_, r, Serial, StarOTA::Success, and transfer().
Referenced by hotfire_handleOTA(), and poll().
|
inline |
Result of the last attempt that was not Idle.
Definition at line 164 of file STAR_EthernetOTA.h.
References last_result_.
| void StarOTA::Server::onEnd | ( | EndCallback | cb, |
| void * | user_data = nullptr ) |
Called on both success and failure, before any reboot.
Definition at line 70 of file STAR_EthernetOTA.cpp.
References on_end_, and on_end_data_.
| void StarOTA::Server::onProgress | ( | ProgressCallback | cb, |
| void * | user_data = nullptr ) |
Called every STAR_OTA_CHUNK_SIZE-ish bytes.
Definition at line 65 of file STAR_EthernetOTA.cpp.
References on_progress_, and on_progress_data_.
| void StarOTA::Server::onStart | ( | StartCallback | cb, |
| void * | user_data = nullptr ) |
Called once the size header is in, before any flash write.
Definition at line 60 of file STAR_EthernetOTA.cpp.
References on_start_, and on_start_data_.
| Result StarOTA::Server::poll | ( | ) |
Accept a waiting client and run the transfer to completion.
Returns Idle immediately when no client is waiting, so this is the only call most boards need in loop().
Definition at line 80 of file STAR_EthernetOTA.cpp.
References handleClient(), StarOTA::Idle, and server_.
|
private |
Definition at line 118 of file STAR_EthernetOTA.cpp.
References config, delay(), millis(), and start().
Referenced by transfer().
|
private |
Definition at line 133 of file STAR_EthernetOTA.cpp.
References StarOTA::BadSize, StarOTA::BeginFailed, config, StarOTA::DataTimeout, delay(), StarOTA::EndFailed, fail(), StarOTA::HeaderTimeout, millis(), on_progress_, on_progress_data_, on_start_, on_start_data_, readSize(), Serial, STAR_OTA_CHUNK_SIZE, StarOTA::Success, Update, and StarOTA::WriteFailed.
Referenced by handleClient().
| Config StarOTA::Server::config |
Definition at line 175 of file STAR_EthernetOTA.h.
Referenced by engine.layerx.card.EngineSampler::__call__(), engine.core.chamber_solver.ChamberSolver::_accel_chamber_pc(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver::_advance_walls(), combined_gui.ConfigManager::_backfill_role_names(), solenoid_characterization_gui.ConfigManager::_backfill_role_names(), engine.pipeline.cea_cache.CEACache::_build_cache(), engine.pipeline.cea_cache.CEACache::_build_cache_parallel(), engine.pipeline.cea_cache.CEACache::_build_cache_sequential(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver::_build_walls(), calibration_robustness.BackupManager::_cleanup_old_backups(), engine.core.chamber_solver.ChamberSolver::_compute_cooling_efficiency(), engine.core.chamber_solver.ChamberSolver::_evaluate_cooling_models(), engine.core.runner.PintleEngineRunner::_evaluate_internal(), engine.core.chamber_solver.ChamberSolver::_fluid_props(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver::_geometry(), engine.core.runner.PintleEngineRunner::_get_ambient_pressure(), engine.core.chamber_solver.ChamberSolver::_get_chamber_geometry(), engine.core.runner.PintleEngineRunner::_get_elevation(), engine.core.chamber_solver.ChamberSolver::_get_fuel_props(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver::_graphite_layers(), engine.core.chamber_solver.ChamberSolver::_infer_injector_diameter(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver::_insert_backing(), engine.core.chamber_solver.ChamberSolver::_liner_end(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver::_liner_layers(), engine.pipeline.cea_cache.CEACache::_load_cache(), engine.core.chamber_solver.ChamberSolver::_raise_supply_exceeds_demand(), engine.core.chamber_solver.ChamberSolver::_rupe_R_opt(), engine.pipeline.cea_cache.CEACache::_save_cache(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver::_station_loads(), engine.core.chamber_solver.ChamberSolver::_wall_contour(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver::_wall_report(), engine.pipeline.cea_cache.CEACache::aux(), calibration_robustness.BackupManager::backup_calibration_state(), begin(), engine.pipeline.system_diagnostics.SystemDiagnostics::diagnose_all(), engine.pipeline.cea_cache.CEACache::eval(), engine.pipeline.cea_cache.CEACache::eval_cf_vac(), combined_gui.ConfigManager::get_actuator_abbrev_to_role(), combined_fsw_gui.ConfigManager::get_actuator_label(), combined_gui.ConfigManager::get_actuator_label(), solenoid_characterization_gui.ConfigManager::get_actuator_label(), combined_gui.ConfigManager::get_actuator_role(), solenoid_characterization_gui.ConfigManager::get_actuator_role(), combined_gui.ConfigManager::get_actuator_role_names(), solenoid_characterization_gui.ConfigManager::get_actuator_role_names(), combined_gui.ConfigManager::get_actuator_type(), combined_gui.ConfigManager::get_actuator_type_by_id(), solenoid_characterization_gui.ConfigManager::get_actuator_type_by_id(), combined_gui.ConfigManager::get_num_actuators(), solenoid_characterization_gui.ConfigManager::get_num_actuators(), combined_gui.ConfigManager::get_num_connectors(), solenoid_characterization_gui.ConfigManager::get_num_connectors(), combined_gui.ConfigManager::get_pt_calibration_csv_paths(), solenoid_characterization_gui.ConfigManager::get_pt_calibration_csv_paths(), combined_fsw_gui.ConfigManager::get_sensor_label(), combined_gui.ConfigManager::get_sensor_label(), solenoid_characterization_gui.ConfigManager::get_sensor_label(), combined_gui.ConfigManager::get_sensor_role(), combined_gui.ConfigManager::get_sensor_role_names(), solenoid_characterization_gui.ConfigManager::get_sensor_role_names(), combined_gui.ConfigManager::get_state_machine_csv_path(), combined_gui.ConfigManager::get_state_transitions_csv_path(), handleClient(), backend.state.AppState::has_config(), calibration_robustness.HealthMonitor::is_healthy(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver::liner_end(), combined_fsw_gui.ConfigManager::load(), combined_gui.ConfigManager::load(), solenoid_characterization_gui.ConfigManager::load(), readSize(), engine.core.chamber_solver.ChamberSolver::residual(), combined_fsw_gui.ConfigManager::save(), combined_gui.ConfigManager::save(), solenoid_characterization_gui.ConfigManager::save(), Server(), combined_fsw_gui.ConfigManager::set_actuator_label(), combined_gui.ConfigManager::set_actuator_role(), backend.state.AppState::set_config(), combined_fsw_gui.ConfigManager::set_sensor_label(), combined_gui.ConfigManager::set_sensor_role(), calibration_robustness.BackupManager::should_backup(), backend.state.AppState::snapshot(), engine.core.chamber_solver.ChamberSolver::solve(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver::solve_time_step(), board_simulator.SimulatedBoard::start(), test_robust_ddp_constraints.TestConstraints::test_all_constraints_safe(), test_robust_ddp_engine_wrapper.TestEngineWrapper::test_cache_stats(), test_robust_ddp_engine_wrapper.TestEngineWrapper::test_caching(), test_robust_ddp_engine_wrapper.TestEngineWrapper::test_clear_cache(), test_robust_ddp_constraints.TestConstraints::test_constraint_summary(), test_robust_ddp_engine_wrapper.TestEngineWrapper::test_convenience_function(), test_robust_ddp_constraints.TestConstraints::test_copv_minimum_constraint(), test_robust_ddp_constraints.TestConstraints::test_edge_cases(), test_robust_ddp_engine_wrapper.TestEngineWrapper::test_estimate_error_handling(), test_robust_ddp_engine_wrapper.TestEngineWrapper::test_estimate_from_pressures_mock(), test_robust_ddp_engine_wrapper.TestEngineWrapper::test_estimate_without_stability(), test_robust_ddp_constraints.TestConstraints::test_headroom_constraints(), test_robust_ddp_constraints.TestConstraints::test_injector_stiffness_constraints(), test_robust_ddp_constraints.TestConstraints::test_mixture_ratio_constraints(), test_robust_ddp_robustness.TestRobustness::test_multiple_updates_convergence(), test_robust_ddp_constraints.TestConstraints::test_multiple_violations(), test_robust_ddp_constraints.TestConstraints::test_nan_handling(), test_robust_ddp_dynamics.TestDynamics::test_regulator_behavior(), test_robust_ddp_robustness.TestRobustness::test_tube_propagate_basic(), test_robust_ddp_robustness.TestRobustness::test_tube_propagate_validation(), test_robust_ddp_robustness.TestRobustness::test_tube_propagate_widens(), test_robust_ddp_robustness.TestRobustness::test_tube_propagate_with_large_w_bar(), test_robust_ddp_constraints.TestConstraints::test_ullage_maximum_constraints(), test_robust_ddp_robustness.TestRobustness::test_update_bounds_basic(), test_robust_ddp_robustness.TestRobustness::test_update_bounds_beta(), test_robust_ddp_robustness.TestRobustness::test_update_bounds_ema_behavior(), test_robust_ddp_robustness.TestRobustness::test_update_bounds_inflation(), test_robust_ddp_robustness.TestRobustness::test_update_bounds_requires_mass_flow(), test_robust_ddp_robustness.TestRobustness::test_update_bounds_residual_spike(), test_robust_ddp_robustness.TestRobustness::test_update_bounds_with_engine_wrapper(), test_robust_ddp_engine_wrapper.TestEngineWrapper::test_wrapper_initialization(), transfer(), calibration_robustness.CalibrationValidator::validate_calibration_coefficients(), calibration_robustness.CalibrationValidator::validate_consensus_state(), calibration_robustness.CalibrationValidator::validate_covariance_matrix(), calibration_robustness.CalibrationValidator::validate_pressure(), calibration_robustness.CalibrationValidator::validate_uncertainty(), and calibration_robustness.CalibrationValidator::validate_voltage().
|
private |
Definition at line 183 of file STAR_EthernetOTA.h.
Referenced by handleClient(), and lastResult().
|
private |
Definition at line 189 of file STAR_EthernetOTA.h.
Referenced by handleClient(), and onEnd().
|
private |
Definition at line 190 of file STAR_EthernetOTA.h.
Referenced by handleClient(), and onEnd().
|
private |
Definition at line 187 of file STAR_EthernetOTA.h.
Referenced by onProgress(), and transfer().
|
private |
Definition at line 188 of file STAR_EthernetOTA.h.
Referenced by onProgress(), and transfer().
|
private |
Definition at line 185 of file STAR_EthernetOTA.h.
Referenced by onStart(), and transfer().
|
private |
Definition at line 186 of file STAR_EthernetOTA.h.
Referenced by onStart(), and transfer().
|
private |
Definition at line 182 of file STAR_EthernetOTA.h.
Referenced by begin(), clientWaiting(), poll(), and Server().