LCOV - code coverage report
Current view: top level - AP_Frsky_Telem - AP_Frsky_Telem.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 5 6 83.3 %
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             : #pragma once
      16             : 
      17             : #include "AP_Frsky_config.h"
      18             : 
      19             : #if AP_FRSKY_TELEM_ENABLED
      20             : 
      21             : #include "AP_Frsky_Backend.h"
      22             : #include "AP_Frsky_SPort.h"
      23             : 
      24             : class AP_Frsky_Parameters;
      25             : 
      26             : class AP_Frsky_Telem {
      27             : 
      28             : public:
      29             :     AP_Frsky_Telem();
      30             : 
      31             :     ~AP_Frsky_Telem();
      32             : 
      33             :     /* Do not allow copies */
      34             :     CLASS_NO_COPY(AP_Frsky_Telem);
      35             : 
      36             :     // init - perform required initialisation
      37             :     bool init(bool use_external_data=false);
      38             : 
      39      262928 :     static AP_Frsky_Telem *get_singleton(void) {
      40      262928 :         return singleton;
      41             :     }
      42             : 
      43             :     // get next telemetry data for external consumers of SPort data
      44             :     static bool get_telem_data(AP_Frsky_Backend::sport_packet_t* packet_array, uint8_t &packet_count, const uint8_t max_size);
      45             : #if HAL_WITH_FRSKY_TELEM_BIDIRECTIONAL
      46             :     // set telemetry data from external producer of SPort data
      47             :     static bool set_telem_data(const uint8_t frame,const uint16_t appid, const uint32_t data);
      48             : #endif
      49             : 
      50         164 :     void queue_message(MAV_SEVERITY severity, const char *text) {
      51         164 :         if (_backend == nullptr) {
      52           0 :             return;
      53             :         }
      54         164 :         return _backend->queue_text_message(severity, text);
      55             :     }
      56             : 
      57             : private:
      58             : 
      59             :     AP_Frsky_Backend *_backend;
      60             :     AP_Frsky_Parameters* _frsky_parameters;
      61             : 
      62             :     // get next telemetry data for external consumers of SPort data (internal function)
      63             :     bool _get_telem_data(AP_Frsky_Backend::sport_packet_t* packet_array, uint8_t &packet_count, const uint8_t max_size);
      64             : #if HAL_WITH_FRSKY_TELEM_BIDIRECTIONAL
      65             :     // set telemetry data from external producer of SPort data (internal function)
      66             :     bool _set_telem_data(const uint8_t frame, const uint16_t appid, const uint32_t data);
      67             : #endif
      68             :     static void try_create_singleton_for_external_data(void);
      69             :     static AP_Frsky_Telem *singleton;
      70             : 
      71             : };
      72             : 
      73             : namespace AP {
      74             :     AP_Frsky_Telem *frsky_telem();
      75             : };
      76             : 
      77             : #endif  // AP_FRSKY_TELEM_ENABLED

Generated by: LCOV version 1.14