LCOV - code coverage report
Current view: top level - AP_ADSB/sagetech-sdk - sgDecodeFlightId.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 5 0.0 %
Date: 2026-09-09 11:02:08 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /**
       2             :  * @copyright Copyright (c) 2021 Sagetech, Inc. All rights reserved.
       3             :  *
       4             :  * @file sgDecodeFlightId.c
       5             :  * @author Jacob.Garrison
       6             :  *
       7             :  * @date Mar 10, 2021
       8             :  *
       9             :  */
      10             : 
      11             : #include <string.h>
      12             : 
      13             : #include "sg.h"
      14             : #include "sgUtil.h"
      15             : 
      16             : #define SG_ID_LEN 8 // The number of bytes in the flight id field
      17             : 
      18             : typedef struct __attribute__((packed))
      19             : {
      20             :     uint8_t start;
      21             :     uint8_t type;
      22             :     uint8_t id;
      23             :     uint8_t payloadLen;
      24             :     char flightId[SG_ID_LEN];
      25             :     uint8_t rsvd[4];
      26             :     uint8_t checksum;
      27             : } flightid_t;
      28             : 
      29             : /*
      30             :  * Documented in the header file.
      31             :  */
      32           0 : bool sgDecodeFlightId(uint8_t *buffer, sg_flightid_t *id)
      33             : {
      34             :     flightid_t sgId;
      35           0 :     memcpy(&sgId, buffer, sizeof(flightid_t));
      36             : 
      37           0 :     strcpy(id->flightId, sgId.flightId);
      38           0 :     memset(&id->flightId[SG_ID_LEN], '\0', 1); // Ensure flight id is null-terminated
      39             : 
      40           0 :     return true;
      41             : }

Generated by: LCOV version 1.14