LCOV - code coverage report
Current view: top level - AP_ADSB/sagetech-sdk - sgEncodeDataReq.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 11 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 sgEncodeDataReq.c
       5             :  * @author Jacob.Garrison
       6             :  *
       7             :  * @date Feb 23, 2021
       8             :  *
       9             :  * This file receives a populated data request struct and
      10             :  * converts it into a data request message buffer.
      11             :  */
      12             : 
      13             : #include <stdbool.h>
      14             : #include <stdlib.h>
      15             : 
      16             : #include "sg.h"
      17             : #include "sgUtil.h"
      18             : 
      19             : #define SG_PAYLOAD_LEN_DATAREQ SG_MSG_LEN_DATAREQ - 5 /// the payload length.
      20             : 
      21             : #define PBASE 4 /// the payload offset.
      22             : 
      23             : #define OFFSET_REQ_TYPE 0 /// the requested response message type
      24             : #define OFFSET_RSVD_1 1   /// a reserved field
      25             : #define OFFSET_RSVD_2 2   /// a reserved field
      26             : #define OFFSET_RSVD_3 3   /// a reserved field
      27             : 
      28             : /*
      29             :  * Documented in the header file.
      30             :  */
      31           0 : bool sgEncodeDataReq(uint8_t *buffer, sg_datareq_t *data, uint8_t msgId)
      32             : {
      33             :     // populate header
      34           0 :     buffer[0] = SG_MSG_START_BYTE;
      35           0 :     buffer[1] = SG_MSG_TYPE_HOST_DATAREQ;
      36           0 :     buffer[2] = msgId;
      37           0 :     buffer[3] = SG_PAYLOAD_LEN_DATAREQ;
      38             : 
      39             :     // populate Request Type
      40           0 :     buffer[PBASE + OFFSET_REQ_TYPE] = data->reqType;
      41             : 
      42             :     // populate Reserved fields
      43           0 :     buffer[PBASE + OFFSET_RSVD_1] = 0;
      44           0 :     buffer[PBASE + OFFSET_RSVD_2] = 0;
      45           0 :     buffer[PBASE + OFFSET_RSVD_3] = 0;
      46             : 
      47             :     // populate checksum
      48           0 :     appendChecksum(buffer, SG_MSG_LEN_DATAREQ);
      49             : 
      50           0 :     return true;
      51             : }

Generated by: LCOV version 1.14