/**
 * @file segmentation.h
 *
 * @brief This file contains function prototypes and data definitions that
 * helps to process file data into segments and  frame FTDS frame
 *
 */

#ifndef SEGMENTATION_H_
#define SEGMENTATION_H_

#include "data_type.h"
#include "ftci.h"
#include "message_frame_def.h"
#include "tc_tm_sample.h"

typedef struct segment_info
{
	uint32_t current_seg;
	uint32_t next_seg;
	uint32_t resend_pckt_list[100];
	uint32_t total_resend_seq_ID;
	uint8_t * ftds_buf_ptr;
	uint16_t packet_buf_length;
	uint8_t resend_rqst;
	uint8_t rx_ping_count;
	uint16_t ping_fail_cnt;
}

s_segment_info;



void segmentation_handler(void);
void init_seg(void);
void segmentation(void);
uint16_t preapre_frame_ftds(void);
void sequence_num_set(uint32_t set);
uint8_t ft_file_reopen_upload(void);
uint8_t ft_file_reopen_download(void);

#ifndef FT_OBC
void ft_file_close(FILE * fptr, uint8_t *file_open_sts, uint8_t tx_mode);
#endif

extern s_segment_info seg_info;

#endif /*SEGMENTATION_H_ */
