/**
 * @file sender_sample_app.h
 *
 * @brief This file contains function prototypes and data definitions that
 * helps to create, send and receive TC TM frames
 */
#ifndef _GS_SAMPLE_APP_H_
#define _GS_SAMPLE_APP_H_

#include "tc_tm_sample.h"

//#define ENBL_DBG_PRNT                              ///< Macro for enabling debug prints

/// TC Socket interface parameter configurations
#define SNDR_TC_SOCKET_IP_ADDR      "192.168.10.2" ///< IP address of socket used for TC transmission
#define SNDR_TC_SOCKET_PORT_ADDR    5003           ///< Port address of socket used for TC transmission

/// TM Socket interface parameter configurations
#define SNDR_TM_SOCKET_IP_ADDR      "192.168.10.2" ///< IP address of socket used for TM reception
#define SNDR_TM_SOCKET_PORT_ADDR    5004           ///< Port address of socket used for TM transmission

/// TC_TM Frame Parameter configurations
#define MAX_TC_BUFF_SIZE            1024           ///< Maximum TC buffer size allocation
#define MAX_TM_BUFF_SIZE            1024           ///< Maximum TM buffer size allocation
#define TC_FRAME_SOF                0xA5           ///< Start of frame definition for TC
#define RECV_SAT_ID                 0x01           ///< Satellite ID value
#define CRYPTO_ENCRYP_ENBL          0x20           ///< Encryption configuration value
#define SOURCE_GROUND_STN_ID        0x01           ///< Ground station ID value
#define TC_QOS_CFG                  0x01           ///< TC_TM Quality of Service configuration value
#define TC_SOURCE_ID                0x01           ///< TC Source ID configuration value
#define TC_DESTINATION_ID           0x01           ///< TC Destination ID configuration value

/**
 * @brief This API creates socket interface to receive Telemetry data
 *
 * @param[in] params    : Unused parameter
 *
 * @return Result of API execution status
 * @retval 0 -> Success / other values -> Error.
 */
void *ft_tm_listener_thread (void * params);

/**
 * @brief This API creates socket interface to send Telecommand data
 *
 * @param[in] params    : Unused parameter
 *
 * @return Result of API execution status
 * @retval 0 -> Success / other values -> Error.
 */
void *ft_tc_send_thread(void *params);

/**
 * @brief This API parses the received Telemetry information
 *
 * @param[in] tm_data   : contains the TM binary data stream
 *
 * @return Result of API execution status
 * @retval 0 -> Success / other values -> Error.
 */
int sndr_tm_parser(uint8 *tm_data);

/**
 * @brief This API validates the sequence number of received TM data
 *
 * @param[in] actual_seq_no    : Sequence number of received TM data frame
 *
 * @return Result of API execution status
 * @retval 0 -> Success / other values -> Error.
 */
void validate_seq_num(uint16 actual_seq_no);

#endif
