Line data Source code
1 : #pragma once 2 : 3 : #include <AP_HAL/AP_HAL.h> 4 : 5 : #if CONFIG_HAL_BOARD == HAL_BOARD_SITL 6 : 7 : #include "AP_HAL_SITL.h" 8 : #include "AP_HAL_SITL_Namespace.h" 9 : #include "SITL_State.h" 10 : 11 : class HAL_SITL : public AP_HAL::HAL { 12 : public: 13 : HAL_SITL(); 14 : void run(int argc, char * const argv[], Callbacks* callbacks) const override; 15 : static void actually_reboot(); 16 : 17 2094 : void set_storage_posix_enabled(bool _enabled) { 18 2094 : storage_posix_enabled = _enabled; 19 2094 : } 20 97840 : bool get_storage_posix_enabled() const { return storage_posix_enabled; } 21 2094 : void set_storage_flash_enabled(bool _enabled) { 22 2094 : storage_flash_enabled = _enabled; 23 2094 : } 24 2156 : bool get_storage_flash_enabled() const { return storage_flash_enabled; } 25 2094 : void set_storage_fram_enabled(bool _enabled) { 26 2094 : storage_fram_enabled = _enabled; 27 2094 : } 28 2096 : bool get_storage_fram_enabled() const { return storage_fram_enabled; } 29 : 30 : bool get_dds_use_sim_time() const { return dds_use_sim_time; } 31 : void set_dds_use_sim_time(bool _enabled) { 32 : dds_use_sim_time = _enabled; 33 : } 34 : 35 : /* 36 : instructs the simulation to wipe any storage as it opens it: 37 : */ 38 294 : void set_wipe_storage(bool _wipe_storage) { 39 294 : wipe_storage = _wipe_storage; 40 294 : } 41 8 : bool get_wipe_storage() const { return wipe_storage; } 42 : 43 : uint8_t get_instance() const; 44 : 45 : #if defined(HAL_BUILD_AP_PERIPH) 46 : bool run_in_maintenance_mode() const; 47 : #endif 48 : 49 : uint32_t get_uart_output_full_queue_count() const; 50 : 51 : HALSITL::SITL_State * get_sitl_state() { return _sitl_state; } 52 : 53 : private: 54 : HALSITL::SITL_State *_sitl_state; 55 : 56 : void setup_signal_handlers() const; 57 : static void exit_signal_handler(int); 58 : 59 : bool storage_posix_enabled = true; 60 : bool storage_flash_enabled; 61 : bool storage_fram_enabled; 62 : bool dds_use_sim_time = false; 63 : 64 : // set to true if simulation is to wipe storage as it is opened: 65 : bool wipe_storage; 66 : }; 67 : 68 : #if HAL_NUM_CAN_IFACES 69 : typedef HALSITL::CANIface HAL_CANIface; 70 : #endif 71 : 72 : #endif // CONFIG_HAL_BOARD == HAL_BOARD_SITL