Line data Source code
1 : #pragma once 2 : 3 : #include <AP_Baro/AP_Baro.h> 4 : 5 : #include <AP_Logger/LogStructure.h> 6 : 7 : class AP_DAL_Baro { 8 : public: 9 : // methods so we look like AP_Baro: 10 84265483 : uint8_t get_primary() const { 11 84265483 : return _RBRH.primary; 12 : } 13 46472 : uint8_t num_instances() const { 14 46472 : return _RBRH.num_instances; 15 : } 16 27764 : bool healthy(uint8_t sensor_id) const { 17 27764 : return _RBRI[sensor_id].healthy; 18 : } 19 26376536 : uint32_t get_last_update(uint8_t sensor_id) const { 20 26376536 : return _RBRI[sensor_id].last_update_ms; 21 : } 22 3864234 : uint32_t get_last_update() const { 23 3864234 : return get_last_update(get_primary()); 24 : } 25 3461777 : float get_altitude(uint8_t sensor_id) const { 26 3461777 : return _RBRI[sensor_id].altitude; 27 : } 28 616346 : float get_altitude() const { 29 616346 : return get_altitude(get_primary()); 30 : } 31 : 32 : // update_calibration is a no-op in Replay as it simply modifies the data 33 : // which we'll be logging for input to the EKF. 34 : void update_calibration(); 35 : 36 : // methods for being part of AP_DAL: 37 : AP_DAL_Baro(); 38 : 39 : void start_frame(); 40 : 41 : void handle_message(const log_RBRH &msg) { 42 : _RBRH = msg; 43 : } 44 : void handle_message(const log_RBRI &msg) { 45 : _RBRI[msg.instance] = msg; 46 : } 47 : 48 : private: 49 : 50 : struct log_RBRH _RBRH; 51 : struct log_RBRI _RBRI[BARO_MAX_INSTANCES]; 52 : }; 53 :