/**
 * @file upload_def.h
 *
 * @brief This file contains typedef of Sender side node
 *
 * @copyright Copyright 2023 Antaris, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _INC_UPLOAD_DEF_H_
#define _INC_UPLOAD_DEF_H_


/******************************************************************************/
/*         Definition of exported types (typedef, enum, struct, union)        */
/******************************************************************************/

#define FT_FTSR_RECEIVER_READY                           1
#define FT_FTSR_RECEIVER_READY_NOT_RECEIVED              0

/**
 * @brief Sender Side file upload handling info
 */
typedef struct transfer_info
{
#ifndef FT_OBC
	FILE * fptr;
#endif
	uint8_t *mptr;							///< memory pointer to transfer if DATA mode is chosen
	uint32_t size; 							///< file or memory size
	uint32_t total_pckts;					///< segmented total packet count
	uint32_t pckt_seq_num;					///< Current sequence number
	uint32_t checksum;						///< calculated checksum
	uint32_t mem_address;					///< memory address in hex to transfer if DATA mode is chosen
	uint16_t packet_data_size;				///< Sequence data buffer length
	uint16_t packet_data_size_copy;			///< 2nd copy of sequence data buffer length
	uint16_t final_packet_data_size;		///< Last sequence data buffer length
	uint16_t mtu_size; /*MTU size */		///< MTU size
	uint8_t unit;							///< Unit of file size; 0 -> in bytes , 1 -> in kilobytes
	uint8_t tx_mode;						///< Transmission mode; 1-> data mode , 0 -> file mode
	uint8_t file_format;					///< Format of input file
	uint16_t app_id;						///< Application ID of current session
	uint8_t file_opened;					///< Status of file open / close
	uint8_t file_name_size;					///< FIle name string length
	uint8_t resume_ctxt_mode;				///< Resume context mode
	uint8_t seq_loss_detect_enable;			///< Sequence loss enable flag
    uint8_t session_id;
    uint8_t receiver_is_ready;				///< this flag is used to confirm receiver accepted session
    uint8_t file_id;						///< file identification number
    uint16_t rx_node_conn_fail_timeout;
}

s_transfer_info;


#endif /* FILE_TRANS_REL_V1_SAMPLE_APPS_SENDER_SAMPLE_APP_INC_UPLOAD_DEF_H_ */
