LCOV - code coverage report
Current view: top level - SITL - SIM_SerialBeacon.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 2 2 100.0 %
Date: 2026-09-09 11:02:08 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :    This program is free software: you can redistribute it and/or modify
       3             :    it under the terms of the GNU General Public License as published by
       4             :    the Free Software Foundation, either version 3 of the License, or
       5             :    (at your option) any later version.
       6             : 
       7             :    This program is distributed in the hope that it will be useful,
       8             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
       9             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      10             :    GNU General Public License for more details.
      11             : 
      12             :    You should have received a copy of the GNU General Public License
      13             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      14             :  */
      15             : /*
      16             :   Base class for serially-attached simulated positioning beacons
      17             : */
      18             : 
      19             : #pragma once
      20             : 
      21             : #include "SIM_config.h"
      22             : 
      23             : #if AP_SIM_NOOPLOOP_ENABLED  // currently the only serial beacon
      24             : 
      25             : #include "SIM_SerialDevice.h"
      26             : 
      27             : #include <AP_Math/AP_Math.h>
      28             : 
      29             : namespace SITL {
      30             : 
      31             : class SerialBeacon : public SerialDevice {
      32             : public:
      33             : 
      34           1 :     SerialBeacon() {}
      35             : 
      36             :     // update; works out the vehicle's position relative to the beacon
      37             :     // origin and sends beacon data to the autopilot:
      38             :     void update();
      39             : 
      40             : protected:
      41             : 
      42             :     // send beacon data describing the supplied vehicle position (in NED
      43             :     // metres relative to the beacon origin); implemented per beacon type:
      44             :     virtual void send_data(const Vector3f &pos_ned) = 0;
      45             : 
      46      137493 :     virtual uint16_t reading_interval_ms() const { return 200; } // 5Hz default
      47             : 
      48             : private:
      49             : 
      50             :     uint32_t last_sent_ms;
      51             : };
      52             : 
      53             : }
      54             : 
      55             : #endif  // AP_SIM_NOOPLOOP_ENABLED

Generated by: LCOV version 1.14