/**
 * @file ft_sender.h
 *
 * @brief This file contains function prototypes of TCTM encoding and decoding function
 *
 * @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 _OTSU_INC_OTSU_TCTM_MAN_H_
#define _OTSU_INC_OTSU_TCTM_MAN_H_

#include "stdint.h"
#include "otsu_tctm_msg_def.h"



/*
 * @brief TCTM send enum
 */
typedef enum
{
	TM_RES_NOT_REQ,
	TM_RES_REQ
}tm_resp_enable_option;


/******************************************************************************/
/*               Declaration of global function prototypes                    */
/******************************************************************************/

/**
 * @brief This function used to decode the OTSU telecommand message
 * This telecommand used to set firmware update configuration params.
 * Also it contains request to read software version and firmware update configuration params
 *
 * @param[in]  tc_data : telecommand message data buffer contains GS message
 * @param[in]  tc_len : length of input frame
 *
 * @return none
 * @retval void : none
 */
void otsu_decode_tc (uint16_t tc_id, uint8_t *tc_data, uint8_t tc_len);


/**
 * @brief This function used to encode the OTSU telecommand message
 * This telecommand used to encode software version and firmware update configuration params
 *
 * @param[in]  response : type of response
 * @param[in]  sw_ver : software version to encode
 *
 * @return none
 * @retval void : none
 */
void otsu_encode_tm(uint16_t tm_id, uint8_t response, uint16_t option);


/**
 * @brief This function used to process the firmware update configuration
 * params, it will trigger firmware update options like scheduled boot and boot now
 *
 * @param[in]  gs_send : option to encode response frame
 *
 * @return none
 * @retval void : none
 */
void configure_reboot_schedule(tm_resp_enable_option gs_send);

/**
* @brief This function used to enable internal RTC to test the scheduled boot feature
* (for only testing purpose)
*
* @param[in]  gs_send : option to encode response frame
*
* @return none
* @retval void : none
*/
void otsu_setalarm(void);


uint64_t calculate_eppoc_time_otsu(s_time_set_def *utc_time, s_date_set_def *utc_date);


void otsu_stop_schduled_boot_timer(void);


#endif /* _OTSU_INC_OTSU_TCTM_MAN_H_ */
