/**
 * @file get_input.h
 *
 * @brief This file contains function prototypes and data definitions that
 * helps to collect input required for file transfer and initiate file transfer by invoking FTCI frame prepare
*/

#ifndef GET_INPUT_H_
#define GET_INPUT_H_
#include "string.h"

#include "data_type.h"
#include "tc_tm_sample.h"



/* enumeration for transfer control request */
typedef enum ft_request
{
	Start_Transmission_rqst, 		// a.	Start File transfer process
	Suspend_Timeout_Mode_rqst, 		// b.	Suspend ongoing transfer process with timeout value
	Resume_Timeout_Mode_rqst, 		// c.	Resume ongoing transfer process
	Terminate_Transmission_rqst, 	// d.	Terminate ongoing transfer process
	Suspend_Savecontext_Mode_rqst, 	// e.	Suspend & Save context of ongoing transfer process
	Suspend_Savecontext_ack_rqst, 	// f.	Suspend & Save context acknowledged
	Suspend_Savecontext_nack_rqst, 	// g.	Suspend & Save context not acknowledged
	Resume_Savecontext_nack_rqst, 	// h.	Resume & Save context not acknowledged
	T_SuspendTimeout, 				// i.	Not applicable for App usage
	T_Txnode, 						// j.	Not applicable for App usage
	T_Rxnode, 						// k.	Not applicable for App usage
	Suspend_Savecontext_Auto_rqst   // l.   Suspend & Save context mode enabled by FTM during SBAND failure

}ft_request;


extern char* input_file_name;



/*!
 * @brief This API configure the mode of FT operation
 * options: file mode or Bulk data mode
 *
 */
uint8_t ft_mode_select(uint8_t mode);



/*!
 * @brief This API configure input file name
 *
 */
uint8_t ft_get_sender_file_name_path(char name_and_path[]);

/*!
 * @brief This API configure input bulk data buffer with length
 *
 */
uint8_t ft_get_bulk_data_input_buffer(uint8_t *buffer, uint16_t buf_length);

/*!
 * @brief This API configure receiver side folder path and file name
 *
 */
uint8_t ft_get_receiver_file_name_path(char name_and_path[]);



/*!
 * @brief This API configure receiver side storage address if bulk data transfer mode was chosen
 *
 */
uint8_t ft_get_receiver_node_storage_address(uint64_t mem_address);



/*!
 * @brief This API configure MTU size
 *
 */
uint8_t ft_get_mtu_size(uint16_t size);



/*!
 * @brief This API control all FT operation
 * 1. Start transmission
 * 2. Terminate transmission
 * 3. Resume transmission
 * 4. Suspend transmission - timeout mode
 * 5. Suspend transmission - save context mode
 * 6. Store context ack 
 */
uint8_t ft_transfer_request(ft_request, uint16);



/*!
 * @brief This API configure APP id
 *
 */
uint8_t ft_get_app_id(uint16 app_id);



/*!
 * @brief This API used to resume transmission by save context mode
 *
 */
uint8_t ft_resume_context(uint8_t *save_info, uint16_t size);


/*!
 * @brief This API used to read APP id
 *
 */
uint16_t ft_read_app_id_tx(void);

/*
 * @breief This API is used to configure sequence loss detection for this current session
 */
uint8_t ft_sequenceLoss_mode_select(uint8_t mode);


/*
 * This API is used to assign ID for each file transfered
 * this is useful to identify the multiple file sent to same app
 */
void ft_config_file_id(uint8_t f_id);

/*
*   This API is used to configure timeout value for connection failure for receiver side.
*   Receiver node will terminate the transmission if communication with sender is not restored in timeout value
*   This timeout value should be greater than 44 seconds and multiples of 15 such as 45, 60, 75, 300 are some valid timeout value can be used.
*/
void ft_config_rx_node_conn_failure_time(uint16_t conn_fail_time);
/*
 * @brief This API use to get memory address for uploading data using 
 * Bulk data transfer mode
 */
uint8_t ft_get_bulk_data_rec_store_address(uint64_t mem_address);

/* internal FT functions */
//void debug_select_mode(void);
//void debug_inputHandler(void);

#endif /*GET_INPUT_H_ */
