/**
 * @file adcs_vapi.c
 *
 * @brief This file contains abstracted functions for Cube ADCS telecommand
 * and telemetries
 *
 * @copyright Copyright 2023 Antaris, Inc.
 */
/*********************************************************************/

#include "adcs_vapi.h"
#include "adcs_bsk_sim.h"
#include "adcs_vapi_common.h"
#include "adcs_vapi_fw.h"

int8 adcs_get_tc_size(uint8 tc_id)
{
    switch(tc_id)
    {
    case TC_SET_ADCS_RESET:
        return 1;
    case TC_SET_ADCS_UTC:
        return 6;
    case TC_SET_ADCS_CLEAR_ERROR:
        return 0;
    case TC_SET_ADCS_SAVE_ORBIT:
        return 0;
    case TC_SET_ADCS_TLE:
        return 64;
    case TC_SET_ADCS_MOI:
        return 24;
    case TC_SET_ADCS_PWR:
        return 3;
    case TC_SET_ADCS_MAGMTR_MODE_OPER:
        return 1;
    case TC_SET_ADCS_GYRO_CFG:
        return 10;
    case TC_SET_ADCS_CSS_CFG:
        return 21;
    case TC_SET_ADCS_STAR_TRAC_CFG:
        return 53;
    case TC_SET_ADCS_MAGMTR_CFG:
        return 30;
    case TC_SET_ADCS_REDUN_MAGMTR_CFG:
        return 30;
    case TC_SET_ADCS_MAG_BOOM:
        return 1;
    case TC_SET_ADCS_MGNTRQR_OUT:
        return 6;
    case TC_SET_ADCS_RW_SPEED:
        return 6;
    case TC_SET_ADCS_MGNTRQR_CFG:
        return 3;
    case TC_SET_ADCS_RW_CFG:
        return 4;
    case TC_SET_ADCS_CTRL_MODE:
        return 3;
    case TC_SET_ADCS_DETUMBLE_CTRL:
        return 14;
    case TC_SET_ADCS_Y_RW_CTRL:
        return 20;
    case TC_SET_ADCS_RW_CTRL:
        return 13;
    case TC_SET_ADCS_TRCK_CTRL_GAIN:
        return 13;
    case TC_SET_ADCS_ATTITUDE_ANGL:
        return 6;
    case TC_SET_ADCS_TRCK_TARGET:
        return 12;
    case TC_SET_ADCS_INRTL_REF:
        return 6;
    case TC_SET_ADCS_EST_MODE:
        return 1;
    case TC_SET_ADCS_EST_PARAM:
        return 31;
    case TC_SET_ADCS_FSS_CFG:
    case TC_SET_ADCS_NADIR_CFG:
        return 112;
    case TC_SET_ADCS_BOOT_INDEX:
        return 1;
    case TC_SET_ADCS_RUN_SEL_PROG:
        return 0;
    case TC_SET_ADCS_READ_PROG_INFO:
        return 1;
    case TC_SET_ADCS_COPY_PROG_TO_INT_FLASH:
        return 2;
    case TC_SET_ADCS_RESET_LOG_PTR:
        return 0;
    case TC_SET_ADCS_ADVANCE_LOG_PTR:
        return 0;
    case TC_SET_ADCS_RESET_BOOT_REG:
        return 0;
    case TC_SET_ADCS_FORMAT_SD_CARD:
        return 1;
    case TC_SET_ADCS_ERASE_FILE:
        return 3;
    case TC_SET_ADCS_LOAD_FILE_DWNLD_BLK:
        return 8;
    case TC_SET_ADCS_ADVANCE_FILE_LIST:
        return 0;
    case TC_SET_ADCS_INIT_FILE_UPLD:
        return 2;
    case TC_SET_ADCS_FILE_UPLD_PKT:
        return 22;
    case TC_SET_ADCS_FLZE_UPLD_BLK:
        return 7;
    case TC_SET_ADCS_RESET_UPLD_BLK:
        return 0;
    case TC_SET_ADCS_RST_FILE_LIST_PTR:
        return 0;
    case TC_SET_ADCS_INIT_DWNLD_BURST:
        return 2;
    case TC_SET_ADCS_RUN_MODE: // 2
        return 2;
    case TC_SET_ADCS_TRIG_LOOP: // 1
        return 1;
    case TC_SET_ADCS_TRIG_SIMU_SNS: // 128
        return 128;
    case TC_SET_ADCS_ASGP4_RUN: // 2
        return 2;
    case TC_SET_ADCS_ASGP4_TRIG: //1
        return 1;
    case TC_SET_ADCS_CONV_JPG: // 4
        return 4;
    case TC_SET_ADCS_SAVE_IMG: // 3
        return 3;
    case TC_SET_ADCS_SAVE_CFG: //1
        return 1;
    case TC_SET_ADCS_CACHE_CMD:
        return 2;
    case TC_SET_ADCS_SRAM_SCRUB:
        return 3;
    case TC_SET_ADCS_UTC_FLASH:
        return 3;
    case TC_SET_ADCS_ASGP4_PARAM:
        return 31;
    case TC_SET_ADCS_USER_CTRLR_EST:
        return 97;
    case TC_SET_ADCS_SD_LOG1_CFG_CFG:
        return 14;
    case TC_SET_ADCS_SD_LOG2_CFG_CFG:
        return 14;
    case TC_SET_ADCS_UART_LOG_CFG:
        return 13;
    case TC_SET_ADCS_HOLE_MAP1:
        return 17;
    case TC_SET_ADCS_HOLE_MAP2:
        return 17;
    case TC_SET_ADCS_HOLE_MAP3:
        return 17;
    case TC_SET_ADCS_HOLE_MAP4:
        return 17;
    case TC_SET_ADCS_HOLE_MAP5:
        return 17;
    case TC_SET_ADCS_HOLE_MAP6:
        return 17;
    case TC_SET_ADCS_HOLE_MAP7:
        return 17;
    case TC_SET_ADCS_HOLE_MAP8:
        return 17;
    }
    return 0;
}

/**
 * @brief Function Returns the length of telemetry by Id.
 */
int16_t bsk_get_tlm_len(uint8_t tlm_id)
{
    int16_t length = 0;
    switch(tlm_id)
    {
    case API_RESP_ID:                // Get Identification
    {
        length = sizeof(s_adcs_id);
    }
    break;
    case API_RESP_STATE:             // Get ADCS state
    {
        length = sizeof(s_adcs_state);
    }
    break;
    case API_RESP_TLE:               // Get TLE
    {
        length = sizeof(s_adcs_tle);
    }
    break;
    case API_RESP_MOI:               // Get moment of inetria
    {
        length = sizeof(s_adcs_moi);
    }
    break;
    case API_RESP_PWR:               // Get power configuration
    {
        length = sizeof(s_adcs_pwr_cmd);
    }
    break;
    case API_RESP_MAG_FIELD_VEC:     // Get magnetic field vector
    {
        length = sizeof(s_adcs_mag_vector);
    }
    break;
    case API_RESP_CSS_VEC:           // Get CSS vector
    {
        length = sizeof(s_adcs_sun_vector);
    }
    break;
    case API_RESP_FSS_VEC:           // Get FSS vector
    {
        length = sizeof(s_adcs_sun_vector);
    }
    break;
    case API_RESP_NADIR_VEC:         // Get nadir vector
    {
        length = sizeof(s_adcs_nadir_vector);
    }
    break;
    case API_RESP_SENSOR_RATE:       // Get sensor rate
    {
        length = sizeof(s_adcs_rate_sens);
    }
    break;
    case API_RESP_STAR_TRKR_BVEC:    // Get star tracker body vector
    {
        length = sizeof(s_adcs_star_trkr_body);
    }
    break;
    case API_RESP_STAR_TRKR_OVEC:    // Get star trackere orbit vector
    {
        length = sizeof(s_adcs_star_trkr_orbit);
    }
    break;
    case API_RESP_RAW_NADIR_SEN:     // Get raw nadir sensor meaurement
    {
        length = sizeof(s_adcs_nadir_sens);
    }
    break;
    case API_RESP_RAW_FSS_SEN:  // Get raw fine sun sensor measurement
    {
        length = sizeof(s_adcs_fss_sens);
    }
    break;
    case API_RESP_RAW_MAGMTR:   // Get raw magnetometer measurement
    {
        length = sizeof(s_adcs_raw_mgmtr);
    }
    break;
    case API_RESP_RAW_GPS_STS:       // Get raw GPS staus
    {
        length = sizeof(s_adcs_gps_s);
    }
    break;
    case API_RESP_RAW_GPS_TIME:      // Get raw GPS time
    {
        length = sizeof(s_adcs_gps_time);
    }
    break;
    case API_RESP_RAW_GPS_X:         // Get raw GPS X axis
    {
        length = sizeof(s_adcs_gps_x);
    }
    break;
    case API_RESP_RAW_GPS_Y:         // Get raw GPS Y axis
    {
        length = sizeof(s_adcs_gps_y);
    }
    break;
    case API_RESP_RAW_GPS_Z:         // Get raw GPS Z axis
    {
        length = sizeof(s_adcs_gps_z);
    }
    break;
    case API_RESP_STAR_MAG:          // Get star magnitude
    {
        length = sizeof(s_adcs_star_trkr_mag);
    }
    break;
    case API_RESP_STAR_PERFORM:      // Get star performance
    {
        length = sizeof(s_adcs_star_trkr_perform);
    }
    break;
    case API_RESP_STAR_TIMING:       // Get star timing
    {
        length = sizeof(s_adcs_star_trkr_timing);
    }
    break;
    case API_RESP_RAW_SENS:          // Get raw sensor measurement
    {
        length = sizeof(s_adcs_raw_sensor);
    }
    break;
    case API_RESP_RAW_GPS:           // Get raw GPS measurement
    {
        length = sizeof(s_adcs_raw_gps);
    }
    break;
    case API_RESP_RAW_STAR_TRAC:    // Get raw star tracker measurement
    {
        length = sizeof(s_adcs_raw_star_trkr);
    }
    break;
    case API_RESP_STAR_RDATA:        // Get raw star tracker data
    {
        length = sizeof(s_adcs_raw_star_trkr_data);
    }
    break;
    case API_RESP_RAW_SEC_MAGMTR:    // Get raw secondary magnetometer
    {
        length = sizeof(s_adcs_raw_mgmtr);
    }
    break;
    case API_RESP_RAW_SENS_RATE:     // Get raw sensor rates
    {
        length = sizeof(s_adcs_raw_rate_sens);
    }
    break;
    case API_RESP_STAR_EST_RATE:    // Get star tracker estimation rate
    {
        length = sizeof(s_adcs_star_est_rate);
    }
    break;
    case API_RESP_SENS_CUR:          // Get sensor current
    {
        length = sizeof(s_adcs_sens_cur);
    }
    break;
    case API_RESP_CON_CUR:  // Get adcs consumed current measurement
    {
        length = sizeof(s_adcs_current);
    }
    break;
    case API_RESP_RW_CUR:            // Get reaction wheel current
    {
        length = sizeof(s_adcs_rw_cur);
    }
    break;
    case API_RESP_TEMP:              // Get adcs temperature
    {
        length = sizeof(s_adcs_temperature);
    }
    break;
    case API_RESP_SENS_RATE_TEMP:    // Get rate sensor temperature
    {
        length = sizeof(s_adcs_rate_temperature);
    }
    break;
    case API_RESP_POW_TEMP:     // Get power and temperature measurement
    {
        length = sizeof(s_adcs_cur_temp);
    }
    break;
    case API_RESP_GYRO_CFG:          // Get gyro configuration
    {
        length = sizeof(s_adcs_gyro_cfg);
    }
    break;
    case API_RESP_STAR_TRAC_CFG:     // Get star tracker configuration
    {
        length = sizeof(s_adcs_star_trkr_cfg);
    }
    break;
    case API_RESP_MAGMTR_CFG:        // Get magnetometer configuration
    {
        length = sizeof(s_adcs_mgmtr_cfg);
    }
    break;
    case API_RESP_CSS_CFG:           // Get CSS configuration
    {
        length = sizeof(s_adcs_css_cfg);
    }
    break;
    case API_RESP_FSS_CFG:           // Get FSS configuration
    {
        length = sizeof(s_adcs_fss_cfg);
    }
    break;
    case API_RESP_NADIR_CFG:         // Get Nadir configuration
    {
        length = sizeof(s_adcs_nadir_cfg);
    }
    break;
    case API_RESP_RED_MAGMTR_CFG:    // Get Redudant magnetometer
    {
        length = sizeof(s_adcs_mgmtr_cfg);
    }
    break;
    case API_RESP_MGNTRQR_CFG:       // Get magnetorquer configuration
    {
        length = sizeof(s_adcs_mgntrqr_cfg);
    }
    break;
    case API_RESP_RW_CFG:           // Get reaction wheel configuration
    {
        length = sizeof(s_adcs_rw_cfg);
    }
    break;
    case API_RESP_DETUMBLE_CTRL:     // Get detumble parameters
    {
        length = sizeof(s_adcs_detumble_ctrl);
    }
    break;
    case API_RESP_Y_RW_CTRL:         // Get Y reaction wheel control
    {
        length = sizeof(s_adcs_y_rw_ctrl);
    }
    break;
    case API_RESP_RW_CTRL:           // Get reaction wheel control
    {
        length = sizeof(s_adcs_rw_ctrl);
    }
    break;
    case API_RESP_TRCK_CTRL_GAIN:    // Get tracking control gain
    {
        length = sizeof(s_adcs_trck_ctrl_gain);
    }
    break;
    case API_RESP_ATTITUDE_ANGL:     // Get attitude angle
    {
        length = sizeof(s_adcs_attitude_angl);
    }
    break;
    case API_RESP_TRCK_TARGET:       // Get target tracking parameters
    {
        length = sizeof(s_adcs_trck_target);
    }
    break;
    case API_RESP_INRTL_REF:         // Get inertial reference
    {
        length = sizeof(s_adcs_inrt_ref);
    }
    break;
    case API_RESP_EST_PARAM:         // Get estimation paremeters
    {
        length = sizeof(s_adcs_est_param);
    }
    break;
    case API_RESP_POS_ECI:           // Get sattelite position ECI
    {
        length = sizeof(s_adcs_eci_position);
    }
    break;
    case API_RESP_VEL:               // Get sattelite velocity
    {
        length = sizeof(s_adcs_eci_velocity);
    }
    break;
    case API_RESP_POS_LLH:           // Get sattelte position LLH
    {
        length = sizeof(s_adcs_trck_target);
    }
    break;
    case API_RESP_EST_RATE:          // Get estimation rates
    {
        length = sizeof(s_adcs_est_rate);
    }
    break;
    case API_RESP_EST_QUTRN:         // Get estimated quaternion
    {
        length = sizeof(s_adcs_est_qutrn);
    }
    break;
    case API_RESP_ECEF_POS:          // Get ECEF sattelite position
    {
        length = sizeof(s_adcs_eci_position);
    }
    break;
    case API_RESP_MODL_MAG:     // Get moduled magnetic field vector
    {
        length = sizeof(s_adcs_mag_vector);
    }
    break;
    case API_RESP_MODL_SUN:          // Get moduled sun vector
    {
        length = sizeof(s_adcs_sun_vector);
    }
    break;
    case API_RESP_EST_GYRO:          // Get estimated gyro measurement
    {
        length = sizeof(s_adcs_est_gyro);
    }
    break;
    case API_RESP_EST_INNOVN:        // Get estimation innovation
    {
        length = sizeof(s_adcs_est_innovn);
    }
    break;
    case API_RESP_QUTR_ERROR:        // Get quaternion error vector
    {
        length = sizeof(s_adcs_qutr_error);
    }
    break;
    case API_RESP_QUTR_COVR:         // Get quaternion covariance
    {
        length = sizeof(s_adcs_qutr_covr);
    }
    break;
    case API_RESP_ANGL_COVR:         // Get angular rate covariance
    {
        length = sizeof(s_adcs_angl_rate_covr);
    }
    break;
    case TM_GET_ADCS_CTRL_MODE:
    {
        length = sizeof(uint8) + sizeof(u_control_mode_param);
    }
    break;
    case TM_GET_ADCS_RW_SPEED:
    case TM_GET_ADCS_RW_SPEED_MEASURE:
    {
        length = sizeof(s_adcs_rw_speed);
    }
    break;
    case TM_GET_ADCS_BOOT_RUNG_PRGRM_STS:
    {
        length = sizeof(s_adcs_b_run_prog_sts);
    }
    break;
    case TM_GET_ADCS_BOOT_INDX_STS:
    {
        length = sizeof(s_adcs_b_index_sts);
    }
    break;
    case TM_GET_ADCS_LST_LGGD_EVNT:
    {
        length = sizeof(s_adcs_last_log_evnt);
    }
    break;
    case TM_GET_ADCS_SRAM_LATCHUP_CNTR:
    {
        length = sizeof(s_adcs_latchup_cntr);
    }
    break;
    case TM_GET_ADCS_EDAC_ERR_CNTR:
    {
        length = sizeof(s_adcs_edac_err_cntr);
    }
    break;
    case TM_GET_ADCS_COMM_STS:
    {
        length = sizeof(s_adcs_comm_sts);
    }
    break;
    case TM_GET_ADCS_FRMT_PRGRS:
    {
        length = sizeof(s_adcs_erase_prgrs);
    }
    break;
    case TM_GET_ADCS_TC_ACK:
    {
        length = sizeof(s_adcs_tc_ack);
    }
    break;
    case TM_GET_ADCS_FILE_DWNLD_CNTNT:
    {
        length = sizeof(s_adcs_file_dwnld_buffer);
    }
    break;
    case TM_GET_ADCS_DWNLD_BLCK_RDY:
    {
        length = sizeof(s_adcs_dwnld_blck_ready);
    }
    break;
    case TM_GET_ADCS_FILE_INFO:
    {
        length = sizeof(s_adcs_file_info);
    }
    break;
    case TM_GET_ADCS_INITLZE_UPLD_CMPLT:
    {
        length = sizeof(s_adcs_init_upld);
    }
    break;
    case TM_GET_ADCS_UPLD_BLCK_CMPLT:
    {
        length = sizeof(s_adcs_upld_blck_cmplt);
    }
    break;
    case TM_GET_ADCS_BLCK_CRC:
    {
        length = sizeof(s_adcs_blck_crc);
    }
    break;
    case TM_GET_ADCS_BTLR_STATE:
    {
        length = sizeof(s_adcs_btlr_state);
    }
    break;
    case TM_GET_ADCS_PRGRM_INFO:
    {
        length = sizeof(s_adcs_prgm_info);
    }
    break;
    case TM_GET_ADCS_CPY_INTRNL_FLSH_PRGRS:
    {
        length = sizeof(s_adcs_cpy_intrnl_flsh_prgrs);
    }
    break;
    case TM_GET_ADCS_JPG_CNVRSN_PRGRS:
    {
        length = sizeof(s_adcs_jpg_cnvrsn_prgrs);
    }break;
    case TM_GET_ADCS_EXECN_TIME:
    {
        length = sizeof(s_adcs_exec_time);
    }break;
    case TM_GET_ADCS_EXECN_STATE:
    {
        length = sizeof(s_adcs_exec_state);
    }break;
    case TM_GET_ADCS_IMG_CPTR_SAVE_OPR_STS:
    {
        length = sizeof(s_adcs_img_sv_sts);
    }break;
    case TM_GET_ADCS_MGNTRQR_CMD:
    {
        length = sizeof(s_adcs_mgntrqr_out);
    }break;
    case TM_GET_ADCS_ACTUATOR_CMD:
    {
        length = sizeof(s_adcs_actuator_cmd);
    }break;
    case TM_GET_ADCS_EST_DATA:
    {
        length = sizeof(s_adcs_estmiation_data);
    }break;
    case TM_GET_STAR_EST_QUTRN:
    {
        length = sizeof(s_adcs_qutr_attitude);
    }break;
    case TM_GET_FINE_EST_RATE:
    {
        length = sizeof(s_adcs_star_trckr_est_rates);
    }break;
    case TM_GET_ADCS_MEASUREMENT:
    {
        length = sizeof(s_adcs_measurement);
    }break;
    case TM_GET_ADCS_CACHE_CMD:
    {
        length = sizeof(s_adcs_cache_cmd);
    }break;
    case TM_GET_ADCS_SRAM_SCRUB:
    {
        length = sizeof(s_adcs_sram_scrub);
    }break;
    case TM_GET_ADCS_UTC_FLASH:
    {
        length = sizeof(s_adcs_utc_flash);
    }break;
    case TM_GET_ADCS_ASGP4_PARAM:
    {
        length = sizeof(s_adcs_asgp4_param);
    }break;
    case TM_GET_ADCS_USER_CTRLR_EST:
    {
        length = sizeof(s_adcs_user_ctrlr_est_sett);
    }break;
    case TM_GET_ADCS_SDLOG1_CFG:
    {
        length = sizeof(s_adcs_sdlog_cfg);
    }break;
    case TM_GET_ADCS_SDLOG2_CFG:
    {
        length = sizeof(s_adcs_sdlog_cfg);
    }break;
    case TM_GET_ADCS_UART_LOG_CFG:
    {
        length = sizeof(s_adcs_uart_log_cfg);
    }break;
    case TM_GET_ADCS_HOLE_MAP1:
    {
        length = sizeof(s_adcs_holemap);
    }break;
    case TM_GET_ADCS_HOLE_MAP2:
    {
        length = sizeof(s_adcs_holemap);
    }break;
    case TM_GET_ADCS_HOLE_MAP3:
    {
        length = sizeof(s_adcs_holemap);
    }break;
    case TM_GET_ADCS_HOLE_MAP4:
    {
        length = sizeof(s_adcs_holemap);
    }break;
    case TM_GET_ADCS_HOLE_MAP5:
    {
        length = sizeof(s_adcs_holemap);
    }break;
    case TM_GET_ADCS_HOLE_MAP6:
    {
        length = sizeof(s_adcs_holemap);
    }break;
    case TM_GET_ADCS_HOLE_MAP7:
    {
        length = sizeof(s_adcs_holemap);
    }break;
    case TM_GET_ADCS_HOLE_MAP8:
    {
        length = sizeof(s_adcs_holemap);
    }break;
    case TM_GET_ADCS_CRNT_UTC:
    {
        length = sizeof(s_adcs_time);
    }break;
    case TM_GET_ADCS_EST_ATTITUDE_ANGL:
    {
        length = sizeof(s_adcs_attitude_angl);
    }break;
    case TM_GET_ADCS_MISC_CUR:
    {
        length = sizeof(s_adcs_misc_cur);
    }break;
    case TM_GET_ADCS_ASGP4_TLE:
    {
        length = sizeof(s_adcs_asgp4_tle);
    }break;
    case TM_GET_ADCS_STAR_PERFORM2:
    {
        length = sizeof(s_adcs_star_perform2);
    }break;
    case TM_GET_ADCS_EST_MODE:
    {
        length = sizeof(uint8);
    }
    break;
    case TM_GET_ADCS_SENSORS_CFG:
    {
        length = sizeof(uint16) + sizeof(u_adcs_sensor_config);
    }
    break;
    case TM_GET_ADCS_ACTUATORS_CFG:
    {
        length = sizeof(uint16) + sizeof(u_adcs_acutator_config);
    }
    break;
    case TM_GET_ADCS_RAW_CSS:
    {
        length = sizeof(s_adcs_raw_css);
    }
    break;
    case ADCS_INTERFACE_CFG:
    {
        length = 1;
    }
    break;
    case TM_GET_ADCS_STATE_CFG:
    {
        length = 2;
    }
    break;
    default:
    {
        length = 0;
    }
    break;
    }
    return length;
}

/**
 * @brief Abstracted function for reset command
 */
e_adcs_status adcs_vapi_set_reset(s_adcs_ctx *adcs_ctx,\
        s_adcs_reset *reset_params)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_RESET) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != reset_params)
        {
            data_len = COMMON_FormatResetCmd(data_buffer, reset_params->magic);
            data_len = data_len - 1;

            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1], \
                                                                data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for current time to ADCS
 */
e_adcs_status adcs_vapi_set_utc_time(s_adcs_ctx *adcs_ctx, \
                                        s_adcs_time *utc_time)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_UTC) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != utc_time)
        {
            data_len = COMMON_FormatUnixTimeCmd(&data_buffer[0], \
                            utc_time->utc_time, utc_time->milli_sec);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for clear error command
 */
e_adcs_status adcs_vapi_set_clear_error(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_CLEAR_ERROR) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        data_len = BOOTLOADER_FormatClearErrorsCmd(&data_buffer[0]);
        data_len = data_len - 1;

        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for reset log pointer.
 */
e_adcs_status adcs_vapi_set_reset_log_ptr(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_RESET_LOG_PTR) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        data_len = COMMON_FormatResetLogPtrCmd(data_buffer);
        data_len = data_len - 1;

        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for advance log pointer
 */
e_adcs_status adcs_vapi_set_advance_log_ptr(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_ADVANCE_LOG_PTR) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        data_len = COMMON_FormatAdvanceLogPtrCmd(data_buffer);
        data_len = data_len - 1;

        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for reset boot register
 */
e_adcs_status adcs_vapi_set_reset_boot_reg(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_RESET_BOOT_REG) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        data_len = COMMON_FormatResetBootRegistersCmd(data_buffer);
        data_len = data_len - 1;

        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for format SD Card
 */
e_adcs_status adcs_vapi_set_format_sd_card(s_adcs_ctx *adcs_ctx,\
        uint8 formatmagic)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_FORMAT_SD_CARD) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        data_len = COMMON_FormatFormatSdCmd(data_buffer, formatmagic);
        data_len = data_len - 1;

        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/** 
 * @brief Abstracted function for erase file
 */
e_adcs_status adcs_vapi_set_erase_file(s_adcs_ctx *adcs_ctx,\
        s_adcs_erasefile *erasefile)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_ERASE_FILE) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != erasefile)
        {
            data_len = COMMON_FormatEraseFileCmd(data_buffer,\
                    erasefile->filetype, erasefile->file_ctr, \
                                erasefile->eraseall);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1], \
                                                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for load file download block
 */
e_adcs_status adcs_vapi_set_load_file_dwnld_blk(s_adcs_ctx *adcs_ctx,\
        s_adcs_load_dwnld_blk *loadfile)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_LOAD_FILE_DWNLD_BLK) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != loadfile)
        {
            data_len = COMMON_FormatLoadDownloadBlockCmd(data_buffer,\
                    loadfile->filetype, loadfile->ctr, loadfile->offset,\
                                                loadfile->len);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                                                    data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for advance file list read pointer
 */
e_adcs_status adcs_vapi_set_advance_file_list(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_ADVANCE_FILE_LIST) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        data_len = COMMON_FormatAdvanceFileListPtrCmd(data_buffer);
        data_len = data_len - 1;
        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for initiate file upload
 */
e_adcs_status adcs_vapi_set_init_file_upld(s_adcs_ctx *adcs_ctx,\
        s_adcs_init_file_upld *init_file_upld)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_INIT_FILE_UPLD) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != init_file_upld)
        {
            if(init_file_upld->upld_prtl)
            {
                /*
                 * Firmware Uploaded via FTM
                 */
                status = adcs_firmware_upload(&init_file_upld->dest);
            }
            else
            {
                data_len = COMMON_FormatInitiateFileUploadCmd(data_buffer,\
                        init_file_upld->dest, init_file_upld->blk_size);
                data_len = data_len - 1;
                if(data_len > 0)
                {
                    // Transmit data to ADCS
                    status = adcs_send_cmd(data_buffer[0], &data_buffer[1], \
                            data_len);
                }
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for file upload packet
 */
e_adcs_status adcs_vapi_set_file_upld_pkt(s_adcs_ctx *adcs_ctx,\
        s_adcs_final_upld_pkt *file_upld_pkt)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_FILE_UPLD_PKT) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != file_upld_pkt)
        {
            data_len = COMMON_FormatFileUploadCmd(data_buffer,\
                    file_upld_pkt->pkt_no, file_upld_pkt->filebytes);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1], \
                                                    data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for finalize upload block
 */
e_adcs_status adcs_vapi_set_flze_upld_blk(s_adcs_ctx *adcs_ctx,\
        s_adcs_flze_upld_blk *fupld_blk)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_FLZE_UPLD_BLK) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != fupld_blk)
        {
            data_len = COMMON_FormatFinalizeUploadBlockCmd(data_buffer,\
                    fupld_blk->dest, fupld_blk->offset, fupld_blk->blk_len);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1], \
                                                            data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for reset upload block
 */
e_adcs_status adcs_vapi_set_reset_upld_blk(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_RESET_UPLD_BLK) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        data_len = COMMON_FormatResetUploadBlockCmd(data_buffer);
        data_len = data_len - 1;

        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for Reset File List Read Pointer
 */
e_adcs_status adcs_vapi_set_rstfile_listrd_ptr(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_RST_FILE_LIST_PTR) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        data_len = COMMON_FormatResetFileListPtrCmd(data_buffer);
        data_len = data_len - 1;

        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);


        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for initiate download burst
 */
e_adcs_status adcs_vapi_set_init_dwnld_burst(s_adcs_ctx *adcs_ctx,\
        s_adcs_init_dwnld_burst *init_dwnld_burst)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_INIT_DWNLD_BURST) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != init_dwnld_burst)
        {
            data_len = COMMON_FormatDownloadBurstCmd(data_buffer,\
                    init_dwnld_burst->msg_len, \
                    init_dwnld_burst->ignore_holemap);
            data_len = data_len - 1;

            if(data_len > 0)
            {
                // Transmit data to ADCS
#ifndef LINUX_TEMP_PORT
                status = adcs_downldburst(&data_buffer[1], NULL, data_len,
                        &data_len);
#endif
            }
        }
        else
        {
            // No Action Retun failure
        }

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set select program to boot
 */
e_adcs_status adcs_vapi_set_boot_index(s_adcs_ctx *adcs_ctx,\
        s_adcs_boot_index* boot_index)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    BOOTLOADER_BootSetProgramsList_t programindex;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_BOOT_INDEX) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        programindex = boot_index->boot_index;
        data_len = BOOTLOADER_FormatBootIndexCmd(&data_buffer[0],programindex);
        data_len = data_len - 1;
        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for run selected program
 */
e_adcs_status adcs_vapi_set_run_sel_prog(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_RUN_SEL_PROG) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        data_len = BOOTLOADER_FormatRunSelectedProgramCmd(&data_buffer[0]);
        data_len = data_len - 1;
        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for read program information
 */
e_adcs_status adcs_vapi_set_readprog_info(s_adcs_ctx *adcs_ctx,\
        s_adcs_read_prog* prog_list)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    BOOTLOADER_ProgramsList_t programIndex;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_READ_PROG_INFO) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        programIndex = prog_list->prog_list;
        data_len = BOOTLOADER_FormatReadProgramInfoCmd(&data_buffer[0],\
                programIndex);
        data_len = data_len - 1;
        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for copy program to internal flash
 */
e_adcs_status adcs_vapi_copy_prog_to_interflash(s_adcs_ctx *adcs_ctx,\
        s_adcs_copy_p_to_interflash *copy_prog_t)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_COPY_PROG_TO_INT_FLASH) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        data_len = BOOTLOADER_FormatCopyToInternalFlashCmd(&data_buffer[0],\
                copy_prog_t->prog_list, copy_prog_t->btlder_overw_flag);
        data_len = data_len - 1;
        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for ADCS Run Mode
 */
e_adcs_status adcs_vapi_set_run_mode(s_adcs_ctx *adcs_ctx,\
        e_adcs_run_mode run_mode)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_RUN_MODE) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame

        data_len = CUBEACP_FormatAdcsEnabledCmd(data_buffer, \
                (CUBEACP_AdcsRunMode_t)run_mode);
        data_len = data_len - 1;
        if(data_len > 0)
        {
            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Trigger ADCS Loop
 */
e_adcs_status adcs_vapi_set_trig_adcs_loop(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_TRIG_SIMU_SNS) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        data_len = CUBEACP_FormatTriggerAdcsCmd(data_buffer);
        data_len = data_len - 1;

        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);


        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}


/**
 * @brief Abstracted function for Trigger ADCS Loop With Simulated Sensor Data
 */
e_adcs_status adcs_vapi_set_trig_simu_sns(s_adcs_ctx *adcs_ctx,\
        s_adcs_simu_sns_data *simu_sns)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_TriggerAdcsSensor_t setval = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_TRIG_SIMU_SNS) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != simu_sns)
        {
            os_memcpy(&setval, simu_sns, sizeof(CUBEACP_TriggerAdcsSensor_t));

            data_len = CUBEACP_FormatTriggerAdcsSensorCmd(data_buffer, &setval);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1], \
                                                            data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for ASGP4 Run Mode
 */
e_adcs_status adcs_vapi_set_asgp4_run_mode(s_adcs_ctx *adcs_ctx,\
        e_adcs_asgp4_run_mode asgp4_run_mode)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_ASGP4_RUN) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        data_len = CUBEACP_FormatAsgp4ModeCmd(data_buffer,\
                (CUBEACP_Asgp4ModeSelect_t)asgp4_run_mode);
        data_len = data_len - 1;
        if(data_len > 0)
        {
            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for convert to JPG File
 */
e_adcs_status adcs_vapi_set_conv_to_jpg(s_adcs_ctx *adcs_ctx,\
        s_adcs_con_to_jpg *con_jpg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_CONV_JPG) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != con_jpg)
        {
            data_len = CUBEACP_FormatConvertCmd(data_buffer, \
                    con_jpg->srs_file_str, con_jpg->qlty_fac, \
                                            con_jpg->white_bal);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for ASGP4 Trigger command
 */
e_adcs_status adcs_vapi_set_asgp4_trig(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_ASGP4_TRIG) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        data_len = CUBEACP_FormatAsgp4TriggerCmd(data_buffer);
        data_len = data_len - 1;
        if(data_len >= 0)
        {
            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for save image
 */
e_adcs_status adcs_vapi_set_save_image(s_adcs_ctx *adcs_ctx,\
        s_adcs_save_img *save_img)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_SaveImage_t setval = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_SAVE_IMG) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != save_img)
        {
            setval.cameraSelect = save_img->cam_sel;
            setval.imageSize = save_img->imsize;

            data_len = CUBEACP_FormatSaveImageCmd(data_buffer, &setval);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}



/**
 * @brief Abstracted function for clear error command
 */
e_adcs_status adcs_vapi_set_save_orbit(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_SAVE_ORBIT) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        data_len = CUBEACP_FormatSaveOrbitParamsCmd(&data_buffer[0]);
        data_len = data_len - 1;

        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for save configuration
 */
e_adcs_status adcs_vapi_set_save_cfg(s_adcs_ctx *adcs_ctx)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_SAVE_CFG) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        data_len = CUBEACP_FormatSaveConfigCmd(data_buffer);
        data_len = data_len - 1;
        if(data_len >= 0)
        {
            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to set TLE parameter
 */
e_adcs_status adcs_vapi_set_tle_params(s_adcs_ctx *adcs_ctx,\
        s_adcs_tle *tle_params)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_OrbitParameters_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_TLE) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != tle_params)
        {
            setVal.inclination = tle_params->inclination;
            setVal.eccentricity = tle_params->eccentricity;
            setVal.raan = tle_params->raan;
            setVal.argPerigee = tle_params->arg_perigee;
            setVal.bstar = tle_params->b_star;
            setVal.meanMotion = tle_params->mean_motion;
            setVal.meanAnomaly = tle_params->mean_anomaly;
            setVal.epoch = tle_params->epoch;

            // To verify valid payload present before copying to frame
            data_len = CUBEACP_FormatOrbitParametersCmd(&data_buffer[0], \
                                                                    &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for moment of inertia
 */
e_adcs_status adcs_vapi_set_mom_interia(s_adcs_ctx *adcs_ctx,\
        s_adcs_moi *moi_params)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_MOI) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != moi_params)
        {

            setVal.ixx = moi_params->mom_iner_xx;
            setVal.iyy = moi_params->mom_iner_yy;
            setVal.izz = moi_params->mom_iner_zz;
            setVal.ixy = moi_params->prod_iner_xy;
            setVal.ixz = moi_params->prod_iner_xz;
            setVal.iyz = moi_params->prod_iner_yz;
            // Copy data to data_buffer
            data_len = CUBEACP_FormatMoICmd(&data_buffer[0], &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to config power status of sensors & actuators
 */
e_adcs_status adcs_vapi_power_on(s_adcs_ctx *adcs_ctx,
        s_adcs_pwr_cmd *pwr_on_off_req)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_PWR) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != pwr_on_off_req)
        {
            // Copy data to data_buffer
            data_buffer[0] = 11;
            os_memcpy(&data_buffer[1], &pwr_on_off_req->pwr_source, 3);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
/**
 * @brief Abstracted function for Magnetometer mode
 */
e_adcs_status adcs_vapi_set_magnetometer_mode(s_adcs_ctx *adcs_ctx,\
        uint8_t magmtr_mode)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_MAGMTR_MODE_OPER) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // Copy data to data_buffer
        data_len = CUBEACP_FormatMagModeCmd(&data_buffer[0], \
                (CUBEACP_MagModeVal_t)magmtr_mode);
        data_len = data_len - 1;

        // Transmit data to ADCS
        status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Gyro configuration
 */
e_adcs_status adcs_vapi_set_gyro_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_gyro_cfg *gyro_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal ={0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_GYRO_CFG) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != gyro_param)
        {

            setVal.gyro1Conf = gyro_param->gyro_conf_1;
            setVal.gyro2Conf = gyro_param->gyro_conf_2;
            setVal.gyro3Conf = gyro_param->gyro_conf_3;
            setVal.xRateOffset = gyro_param->x_rate_offset;
            setVal.yRateOffset = gyro_param->y_rate_offset;
            setVal.zRateOffset = gyro_param->z_rate_offset;
            setVal.rateSensorMult = gyro_param->rate_sensor_mult;

            // Copy data to data_buffer
            data_len = CUBEACP_FormatGyroConfigCmd(&data_buffer[0], &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to set CSS configuration
 */
e_adcs_status adcs_vapi_set_css_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_css_cfg *css_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_CSS_CFG) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        os_memset(data_buffer, 0, data_len);

        // To verify valid payload present before copying to frame
        if(NULL != css_param)
        {
            setVal.css1Conf = css_param->css_conf;
            setVal.css1Scale = css_param->css_scale;
            setVal.cssMinimum = css_param->css_min;
            data_len = CUBEACP_FormatCssConfigCmd(data_buffer, &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Star Tracker configuration
 */
e_adcs_status adcs_vapi_set_star_trkr_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_star_trkr_cfg *star_trkr_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_STAR_TRAC_CFG) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != star_trkr_param)
        {

            setVal.starAngle1 = star_trkr_param->angle_1;
            setVal.starAngle2 = star_trkr_param->angle_2;
            setVal.starAngle3 = star_trkr_param->angle_3;
            setVal.starExposure = star_trkr_param->exposure;
            setVal.starGain = star_trkr_param->gain;
            setVal.detectionThreshold = star_trkr_param->detection_threshold;
            setVal.starThreshold = star_trkr_param->threshold;
            setVal.maxStarMatched = star_trkr_param->max_star_matched;
            setVal.starTimeoutTime = star_trkr_param->timeout_time;
            setVal.maxStarPixel = star_trkr_param->max_star_pixel;
            setVal.minStarPixel = star_trkr_param->min_star_pixel;
            setVal.starErrorMargin = star_trkr_param->error_margin;
            setVal.starDelayTime = star_trkr_param->delay_time;
            setVal.starCentX = star_trkr_param->cent_x;
            setVal.starCentY = star_trkr_param->cent_y;
            setVal.starFocal = star_trkr_param->focal;
            setVal.starLensK1 = star_trkr_param->lens_k1;
            setVal.starLensK2 = star_trkr_param->lens_k2;
            setVal.starLensP1 = star_trkr_param->lens_p1;
            setVal.starLensP2 = star_trkr_param->lens_p2;
            setVal.starWindowWidth = star_trkr_param->window_width;
            setVal.starTrackingMargin = star_trkr_param->tracking_margin;
            setVal.starValidationMargin = star_trkr_param->validation_margin;
            setVal.starSearchWidth = star_trkr_param->search_width;

            // Copy data to data_buffer
            data_len = CUBEACP_FormatStarConfigCmd(&data_buffer[0], &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Magnetometer configuration
 */
e_adcs_status adcs_vapi_set_mgmtr_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_mgmtr_cfg *mgmtr_cfg_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_MAGMTR_CFG) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != mgmtr_cfg_param)
        {

            setVal.magmAngle1 = mgmtr_cfg_param->angle_1;
            setVal.magmAngle2 = mgmtr_cfg_param->angle_2;
            setVal.magmAngle3 = mgmtr_cfg_param->angle_3;
            setVal.magmOffset1 = mgmtr_cfg_param->offset_1;
            setVal.magmOffset2 = mgmtr_cfg_param->offset_2;
            setVal.magmOffset3 = mgmtr_cfg_param->offset_3;
            setVal.magmSens11 = mgmtr_cfg_param->sens_11;
            setVal.magmSens22 = mgmtr_cfg_param->sens_22;
            setVal.magmSens33 = mgmtr_cfg_param->sens_33;
            setVal.magmSens12 = mgmtr_cfg_param->sens_12;
            setVal.magmSens13 = mgmtr_cfg_param->sens_13;
            setVal.magmSens21 = mgmtr_cfg_param->sens_21;
            setVal.magmSens23 = mgmtr_cfg_param->sens_23;
            setVal.magmSens31 = mgmtr_cfg_param->sens_31;
            setVal.magmSens32 = mgmtr_cfg_param->sens_32;

            // Copy data to data_buffer
            data_len = CUBEACP_FormatMagConfigCmd(&data_buffer[0], &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Redundant Magnetometer configuration
 */
e_adcs_status adcs_vapi_set_red_mgmtr_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_mgmtr_cfg *red_mgmtr_cfg_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_REDUN_MAGMTR_CFG) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != red_mgmtr_cfg_param)
        {

            setVal.mredAngle1 = red_mgmtr_cfg_param->angle_1;
            setVal.mredAngle2 = red_mgmtr_cfg_param->angle_2;
            setVal.mredAngle3 = red_mgmtr_cfg_param->angle_3;
            setVal.mredOffset1 = red_mgmtr_cfg_param->offset_1;
            setVal.mredOffset2 = red_mgmtr_cfg_param->offset_2;
            setVal.mredOffset3 = red_mgmtr_cfg_param->offset_3;
            setVal.mredSens11 = red_mgmtr_cfg_param->sens_11;
            setVal.mredSens22 = red_mgmtr_cfg_param->sens_22;
            setVal.mredSens33 = red_mgmtr_cfg_param->sens_33;
            setVal.mredSens12 = red_mgmtr_cfg_param->sens_12;
            setVal.mredSens13 = red_mgmtr_cfg_param->sens_13;
            setVal.mredSens21 = red_mgmtr_cfg_param->sens_21;
            setVal.mredSens23 = red_mgmtr_cfg_param->sens_23;
            setVal.mredSens31 = red_mgmtr_cfg_param->sens_31;
            setVal.mredSens32 = red_mgmtr_cfg_param->sens_32;

            // Copy data to data_buffer
            data_len = CUBEACP_FormatRedMagConfigCmd(&data_buffer[0], &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Magnetometer boom
 */
e_adcs_status adcs_vapi_set_mgmtr_boom(s_adcs_ctx *adcs_ctx,\
        s_adcs_mgmtr_boom *mgmtr_boom_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_MAG_BOOM) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != mgmtr_boom_param)
        {
            // Copy data to data_buffer
            data_len = CUBEACP_FormatDeployMagnetometerCmd(&data_buffer[0],\
                                        mgmtr_boom_param->time_out);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Magnetorquer output
 */
e_adcs_status adcs_vapi_set_mgntrqr_out(s_adcs_ctx *adcs_ctx,\
        s_adcs_mgntrqr_out *mgntrqr_out_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_TorquerCmd_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_MGNTRQR_OUT) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != mgntrqr_out_param)
        {
            setVal.torquerX = mgntrqr_out_param->torquer_cmd_x/1000.0;
            setVal.torquerY = mgntrqr_out_param->torquer_cmd_y/1000.0;
            setVal.torquerZ = mgntrqr_out_param->torquer_cmd_z/1000.0;

            // Copy data to data_buffer
            data_len = CUBEACP_FormatTorquerCmdCmd(&data_buffer[0], &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Reaction wheel speed
 */
e_adcs_status adcs_vapi_set_rw_speed(s_adcs_ctx *adcs_ctx,\
        uint8 rw_id, s_adcs_rw_speed *rw_speed)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_WheelSpeedCmd_t setVal = {0};
    s_adcs_rw_speed rw_cmd[R_WHEEL_3] = {0};
    // To verify valid payload present before copying to frame
    if(NULL != adcs_ctx && NULL != rw_speed && R_WHEEL_3 >= rw_id)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(SpeedCmd);

        // Request Telemetry data
        status = adcs_requesttlm(SpeedCmd,\
                (uint8_t*)rw_cmd, data_len);
        // Verify Statua was success
        if(OPERATION_SUCCESS == status)
        {
            // Assign reaction speed based on RW instance Id
            switch(rw_id)
            {
            case R_WHEEL_1:
            {
                rw_cmd[0].rw_speed = rw_speed->rw_speed;
            }
            break;
            case R_WHEEL_2:
            {
                rw_cmd[1].rw_speed = rw_speed->rw_speed;
            }
            break;
            case R_WHEEL_3:
            {
                rw_cmd[2].rw_speed = rw_speed->rw_speed;
            }
            break;
            }

            // Copy data to data_buffer
            setVal.wheelX  = rw_cmd[0].rw_speed;
            setVal.wheelY  = rw_cmd[1].rw_speed;
            setVal.wheelZ  = rw_cmd[2].rw_speed;

            // value assignment to variables
            data_len = adcs_get_tc_size(TC_SET_ADCS_RW_SPEED) + 1;

            // Memory allocation for payload
            data_buffer = (uint8*) os_malloc_eram(data_len);

            data_len = CUBEACP_FormatWheelSpeedCmdCmd(&data_buffer[0], \
                    &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);

            // Free allocated memory
            os_free(data_buffer);
        }
        else
        {
            // No Action Retun failure
        }
    }
    else
    {
        status = TC_TM_ERROR;
    }

    return status;
}

/**
 * @brief Function to set Magnetorquer configuration
 */
e_adcs_status adcs_vapi_set_mgntrqr_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_mgntrqr_cfg *mgntrqr_cfg_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_MGNTRQR_CFG) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != mgntrqr_cfg_param)
        {
            setVal.magtorq1 = mgntrqr_cfg_param->mgntrqr_axis;
            setVal.magtorq2 = mgntrqr_cfg_param->mgntrqr_axis;
            setVal.magtorq3 = mgntrqr_cfg_param->mgntrqr_axis;
            data_len = CUBEACP_FormatMagtorqConfigCmd(data_buffer, &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to set Reaction wheel configuration
 */
e_adcs_status adcs_vapi_set_rw_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_rw_cfg *rw_cfg_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_RW_CFG) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != rw_cfg_param)
        {
            data_buffer[0] = 22;
            data_buffer[1] = (rw_cfg_param->rw_conf << 0);
            data_buffer[2] = (rw_cfg_param->rw_conf << 0);
            data_buffer[3] = (rw_cfg_param->rw_conf << 0);
            data_buffer[4] = (rw_cfg_param->rw_conf << 0);
            // Copy data to data_buffer
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for control mode parameters
 */
e_adcs_status adcs_vapi_set_ctrl_mode(s_adcs_ctx *adcs_ctx,
        s_adcs_ctrl_mode *ctrl_mode_param,\
        u_control_mode_param *ctrl_cfg_parm)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_ControlMode_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        data_len = adcs_get_tc_size(TC_SET_ADCS_CTRL_MODE) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != ctrl_mode_param)
        {
            switch(ctrl_mode_param->ctrl_mode)
            {
            case ADCS_CTRL_MODE_THREE_AXIS:         // 3axis stabilization
            {
                setVal.controlModeSelection = ConModeSelect_ConXYZwheel;
                status = adcs_vapi_set_attitude_angle(adcs_ctx,\
                        (s_adcs_attitude_angl*)&ctrl_cfg_parm->attitude_ctrl);
                status = OPERATION_SUCCESS;
            }
            break;
            case ADCS_CTRL_MODE_TARGET_TRACKING:    // Target tracking
            {
                setVal.controlModeSelection = ConModeSelect_ConRWTargetTrack;
                status = adcs_vapi_set_trgt_trck(adcs_ctx,\
                        (s_adcs_trck_target*)&ctrl_cfg_parm->target_track_ctrl);
                status = OPERATION_SUCCESS;
            }
            break;
            case ADCS_CTRL_MODE_NADIR_POINTING:     // Nadir pointing
            {
                setVal.controlModeSelection = ConModeSelect_ConXYZwheel;
                status = OPERATION_SUCCESS;
            }
            break;
            case ADCS_CTRL_MODE_NONE:                   // No control mode
            {
                setVal.controlModeSelection = ConModeSelect_ConNone;
                status = OPERATION_SUCCESS;
            }
            break;
            case ADCS_CTRL_MODE_DETUMBLING:             // Detumbling
            {
                setVal.controlModeSelection = ConModeSelect_ConBdot;
                status = OPERATION_SUCCESS;
            }
            break;
            case ADCS_CTRL_MODE_Y_SPIN_STABILIZATION:   // Y Spin Stabilization
            {
                setVal.controlModeSelection = ConModeSelect_ConYspin;
                status = OPERATION_SUCCESS;
            }
            break;
            case ADCS_CTRL_MODE_Z_SPIN_STABILIZATION:   // Z Spin Stabilization
            {
                // TODO
            }
            break;
            case ADCS_CTRL_MODE_SUN_POINTING:          // Sun pointing
            {
                setVal.controlModeSelection = ConModeSelect_ConRWSunTrack;
                ctrl_mode_param->time_out = 0;      //Set timeout is 0
                status = OPERATION_SUCCESS;
            }
            break;
            default:                        // Custom Control Mode selected
            {
                setVal.controlModeSelection = ctrl_mode_param->ctrl_mode & 0x0f;
                status = OPERATION_SUCCESS;
            }
            break;
            }
            if(status == OPERATION_SUCCESS)
            {
                setVal.timeout = ctrl_mode_param->time_out;

                // Copy control mode data to data_buffer
                data_len = CUBEACP_FormatControlModeCmd(&data_buffer[0], \
                        &setVal);
                data_len = data_len - 1;

                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1], \
                        data_len);
            }
            DEBUG_CPRINT(("Cube Space Control Mode:- %d Timeout:- %d\n",
                    setVal.controlModeSelection,setVal.timeout));
        }
        else
        {
            // No Action Retun failure
        }

        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Detumble control parameters
 */
e_adcs_status adcs_vapi_set_detumble_ctrl(s_adcs_ctx *adcs_ctx,\
        s_adcs_detumble_ctrl *detumble_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_DETUMBLE_CTRL) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != detumble_param)
        {
            setVal.ks = detumble_param->spin_gain;
            setVal.kd = detumble_param->damping_gain;
            setVal.wy_ref = detumble_param->rw_ref_spin_rate;
            setVal.kdf = detumble_param->f_bdot_gain;
            // Copy data to data_buffer
            data_len =  CUBEACP_FormatDetumbleParamsCmd(&data_buffer[0],\
                                        &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Y axis Reaction wheel control
 */
e_adcs_status adcs_vapi_set_y_rw_ctrl(s_adcs_ctx *adcs_ctx,\
        s_adcs_y_rw_ctrl *y_rw_ctrl)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_Y_RW_CTRL) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != y_rw_ctrl)
        {
            setVal.kh = y_rw_ctrl->ctrl_gain;
            setVal.kn = y_rw_ctrl->nutation_damp_gain;
            setVal.kp1 = y_rw_ctrl->prop_gain;
            setVal.kd1 = y_rw_ctrl->derv_gain;
            setVal.h_ref = y_rw_ctrl->ref_rw_mom;

            // Copy data to data_buffer
            data_len =  CUBEACP_FormatYWheelParamsCmd(&data_buffer[0], \
                                                    &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Reaction wheel control
 */
e_adcs_status adcs_vapi_set_rw_ctrl(s_adcs_ctx *adcs_ctx,\
        s_adcs_rw_ctrl *rw_ctrl)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_RW_CTRL) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != rw_ctrl)
        {
            setVal.kp2 = rw_ctrl->rw_prop_gain;
            setVal.kd2 = rw_ctrl->rw_derv_gain;
            setVal.h_bias = rw_ctrl->y_rw_bias;
            setVal.sunPointFacet = rw_ctrl->sun_point_facet;
            setVal.wheelErrorHandling = rw_ctrl->rw_error_handling;

            // Copy data to data_buffer
            data_len =  CUBEACP_FormatRWheelParamsCmd(&data_buffer[0], \
                                                        &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for tracking control gain
 */
e_adcs_status adcs_vapi_set_trck_ctrl_gain(s_adcs_ctx *adcs_ctx,\
        s_adcs_trck_ctrl_gain *trck_ctrl_gain)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_TRCK_CTRL_GAIN) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != trck_ctrl_gain)
        {
            setVal.kp3 = trck_ctrl_gain->prop_gain;
            setVal.kd3 = trck_ctrl_gain->derv_gain;
            setVal.ki3 = trck_ctrl_gain->integ_gain;
            // Copy data to data_buffer
            data_len =  CUBEACP_FormatTrackingParamsCmd(&data_buffer[0], \
                                                                &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for attitude angle parameters
 */
e_adcs_status adcs_vapi_set_attitude_angle(s_adcs_ctx *adcs_ctx,\
        s_adcs_attitude_angl *att_angle)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_CmdAttitude_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(API_REQ_ATTITUDE_ANGL) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != att_angle)
        {
            setVal.pitch = att_angle->pitch;
            setVal.roll = att_angle->roll;
            setVal.yaw = att_angle->yaw;
            // Copy data to data_buffer
            data_len =  CUBEACP_FormatCmdAttitudeCmd(&data_buffer[0], &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to set target tracking parameters
 */
e_adcs_status adcs_vapi_set_trgt_trck(s_adcs_ctx *adcs_ctx,\
        s_adcs_trck_target *trck_trgt_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_TRCK_TARGET) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != trck_trgt_param)
        {
            // Copy data to data_buffer
            data_buffer[0] = 55;
            os_memcpy(&data_buffer[1], trck_trgt_param, \
                    sizeof(s_adcs_trck_target));
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to set inertial reference
 */
e_adcs_status adcs_vapi_set_inrt_ref(s_adcs_ctx *adcs_ctx,\
        s_adcs_inrt_ref *inrt_ref_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_InertialPointReference_t setval = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_INRTL_REF) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != inrt_ref_param)
        {
            setval.inertialRefX = inrt_ref_param->iner_ref_x/10000.0;
            setval.inertialRefY= inrt_ref_param->iner_ref_y/10000.0;
            setval.inertialRefZ = inrt_ref_param->iner_ref_z/10000.0;

            // Copy data to data_buffer
            data_len = CUBEACP_FormatInertialPointReferenceCmd(&data_buffer[0],\
                    setval.inertialRefX, setval.inertialRefY,\
                    setval.inertialRefZ);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to set estimation mode
 */
e_adcs_status adcs_vapi_set_est_mode(s_adcs_ctx *adcs_ctx,\
        s_adcs_est_mode *est_mode)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        CUBEACP_EstimModeSelect_t mode = 0;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_EST_MODE) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != est_mode)
        {
            switch(est_mode->est_mode)
            {
            case ADCS_EST_NONE:
            {
                mode = EstimModeSelect_EstNone;
            }
            break;
            case ADCS_EST_MEMS_RATE:
            {
                mode = EstimModeSelect_EstMemsRate;
            }
            break;
            case ADCS_EST_GYRO_EKF:
            {
                mode = EstimModeSelect_EstGyroEkf;
            }
            break;
            default:
            {
                mode = est_mode->est_mode & 0x0f;
            }
            break;
            }
            // Copy data to data_buffer
            CUBEACP_FormatEstimModeCmd(&data_buffer[0], mode);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to set estimation parameters
 */
e_adcs_status adcs_vapi_set_est_param(s_adcs_ctx *adcs_ctx,\
        s_adcs_est_param *est_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_EST_PARAM) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != est_param)
        {
            setVal.magRateNoise = est_param->mag_rate_noise;
            setVal.ekfSysNoise = est_param->ekf_sys_noise;
            setVal.cssNoise = est_param->css_noise;
            setVal.sunNoise = est_param->sun_noise;
            setVal.nadirNoise = est_param->nadir_noise;
            setVal.magNoise = est_param->mag_noise;
            setVal.starNoise = est_param->star_noise;
            setVal.useSunEst = est_param->use_sun_est;
            setVal.useNadirEst = est_param->use_nadir_est;
            setVal.useCssEst = est_param->use_css_est;
            setVal.terminatorCheck = est_param->nadir_terminator_check;
            setVal.autoRecoverMtm = est_param->auto_recover_mtm;
            setVal.magMode = est_param->mag_mode;
            setVal.cam1Cam2Period =
                        (est_param->fss_period<<4)|est_param->nadir_period;

            // Copy data to data_buffer
            data_len = CUBEACP_FormatEstimParamsCmd(&data_buffer[0], &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to set adcs sensors parameter
 */
e_adcs_status adcs_vapi_set_sensor_params(s_adcs_ctx *adcs_ctx,\
        e_adcs_sensor_type sensor_type,uint8_t sensor_id,\
        u_adcs_sensor_config *sensor_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint8 *data_buffer = NULL;
        uint16 data_len = 0;

        switch(sensor_type) // Selecting Specific sensor for its payload length
        {
        case ADCS_MAG:          // Magnetometer
        {
            status = adcs_vapi_set_mgmtr_cfg(adcs_ctx, \
                        (s_adcs_mgmtr_cfg*)&sensor_cfg->magetometer_config);
        }
        break;
        case ADCS_COARSE_SUN:   // Coarse momentum sensor
        {
            // value assignment to variables
            data_len = adcs_get_tlm_size(CssConfig) + 1;
            data_buffer = (uint8*) os_malloc_eram(data_len);
            adcs_requesttlm(CssConfig,&data_buffer[1], data_len - 1);
            data_buffer[0] = 24;
            data_buffer[sensor_id + 1] = sensor_cfg->corase_config.css_conf;
            data_buffer[sensor_id + 11] =
                    (uint8) round(sensor_cfg->corase_config.css_scale * 100.0);
            data_buffer[sensor_id + 21] = sensor_cfg->corase_config.css_min;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], \
                                        data_len - 1);
            os_free(data_buffer);
        }
        break;
        case ADCS_NADIR_SENS:   // Nadir pointing sensor
        {
            status = adcs_vapi_set_nadir_cfg(adcs_ctx,\
                               (s_adcs_nadir_cfg*)&sensor_cfg->nadir_config);
        }
        break;
        case ADCS_RED_MAG:      // Redundant Magnetometer
        {
            status = adcs_vapi_set_red_mgmtr_cfg(adcs_ctx, \
                    (s_adcs_mgmtr_cfg*)&sensor_cfg->red_magetometer_config);
        }
        break;
        case ADCS_FINE_SUN:     // Fine momentum sensor
        {
            status = adcs_vapi_set_fss_cfg(adcs_ctx,\
                    (s_adcs_fss_cfg*)&sensor_cfg->fss_config);
        }
        break;
        case ADCS_STAR_SENS:    // Star tracking sensor
        {
            status = adcs_vapi_set_star_trkr_cfg(adcs_ctx, \
            (s_adcs_star_trkr_cfg*)&sensor_cfg->star_trkr_config);
        }
        break;
        default:                // Invalid type selected
        {
            data_len = 0;
        }
        break;
        }
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to set adcs acutator parameter
 */
e_adcs_status adcs_vapi_set_actuator_params(s_adcs_ctx *adcs_ctx,\
        e_adcs_actuator_type actuator_type,uint8_t actuator_id,\
        u_adcs_acutator_config *actuator_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint8 *data_buffer = NULL;
        uint16 data_len = 0;

        // Selecting Specific actuator for its payload length
        switch(actuator_type)
        {
        case ADCS_WHEEL:        // Reaction Wheel
        {
            // value assignment to variables
            data_len = adcs_get_tlm_size(WheelConfig) + 1;

            data_buffer = os_malloc_eram(data_len);
            // Request Telemetry data
            status = adcs_requesttlm(WheelConfig,\
                    &data_buffer[1], data_len - 1);
            data_buffer[0] = 22;
            data_buffer[actuator_id] = actuator_cfg->rwheel_config.rw_conf;
            // Copy data to data_buffer
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        break;
        case ADCS_MAG_TORQUER:  // Magnetorquer
        {
            data_len = adcs_get_tc_size(TC_SET_ADCS_MGNTRQR_CFG) + 1;
            data_buffer = os_malloc_eram(data_len);
            adcs_requesttlm(MagtorqConfig,&data_buffer[1], data_len - 1);
            data_buffer[0] = 21;
            data_buffer[actuator_id + 1] =
                               actuator_cfg->magnotorque_config.mgntrqr_axis;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], \
                                                            data_len - 1);
            os_free(data_buffer);
        }
        break;
        case ADCS_THRUSTER:     // Thruster
        {
            /*
             * TODO Currently Thruster not yet planned will be updated in
             * future
             */
            data_len = 0;
        }
        break;
        default:                // Invalid type selected
        {
            data_len = 0;
        }
        break;
        }
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Fine sun sensor configuration
 */
e_adcs_status adcs_vapi_set_fss_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_fss_cfg *fss_cfg_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_FSS_CFG) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != fss_cfg_param)
        {

            adcs_requesttlm(CubeSenseConfig,data_buffer,data_len-1);
            CUBEACP_ExtractCubeSenseConfigTlm(data_buffer,&setVal);

            // Copy data to data_buffer
            setVal.cam1Angle1 = fss_cfg_param->angle_1;
            setVal.cam1Angle2 = fss_cfg_param->angle_2;
            setVal.cam1Angle3 = fss_cfg_param->angle_3;
            setVal.cam1AutoAdj = fss_cfg_param->auto_adj;
            setVal.cam1BoreX = fss_cfg_param->bore_x;
            setVal.cam1BoreY = fss_cfg_param->bore_y;
            setVal.cam1Exposure = fss_cfg_param->exposure;
            setVal.cam1MaskArea1Xmax = fss_cfg_param->mask_area_1_x_max;
            setVal.cam1MaskArea1Xmin = fss_cfg_param->mask_area_1_x_min;
            setVal.cam1MaskArea2Xmax = fss_cfg_param->mask_area_2_x_max;
            setVal.cam1MaskArea2Xmin = fss_cfg_param->mask_area_2_x_min;
            setVal.cam1MaskArea3Xmax = fss_cfg_param->mask_area_3_x_max;
            setVal.cam1MaskArea3Xmin = fss_cfg_param->mask_area_3_x_min;
            setVal.cam1MaskArea4Xmax = fss_cfg_param->mask_area_4_x_max;
            setVal.cam1MaskArea4Xmin = fss_cfg_param->mask_area_4_x_min;
            setVal.cam1MaskArea5Xmax = fss_cfg_param->mask_area_5_x_max;
            setVal.cam1MaskArea5Xmin = fss_cfg_param->mask_area_5_x_min;
            setVal.cam1MaskArea1Ymax = fss_cfg_param->mask_area_1_y_max;
            setVal.cam1MaskArea1Ymin = fss_cfg_param->mask_area_1_y_min;
            setVal.cam1MaskArea2Ymax = fss_cfg_param->mask_area_2_y_max;
            setVal.cam1MaskArea2Ymin = fss_cfg_param->mask_area_2_y_min;
            setVal.cam1MaskArea3Ymax = fss_cfg_param->mask_area_3_y_max;
            setVal.cam1MaskArea3Ymin = fss_cfg_param->mask_area_3_y_min;
            setVal.cam1MaskArea4Ymax = fss_cfg_param->mask_area_4_y_max;
            setVal.cam1MaskArea4Ymin = fss_cfg_param->mask_area_4_y_min;
            setVal.cam1MaskArea5Ymax = fss_cfg_param->mask_area_5_y_max;
            setVal.cam1MaskArea5Ymin = fss_cfg_param->mask_area_5_y_min;
            setVal.cam1Threshold = fss_cfg_param->threshold;

            os_memset(data_buffer, 0, data_len);
            data_len = CUBEACP_FormatCubeSenseConfigCmd(&data_buffer[0], \
                    &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for Nadir configuration
 */
e_adcs_status adcs_vapi_set_nadir_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_nadir_cfg *nadir_cfg_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setVal = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_NADIR_CFG) + 1;

        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != nadir_cfg_param)
        {

            adcs_requesttlm(CubeSenseConfig,data_buffer,data_len-1);
            CUBEACP_ExtractCubeSenseConfigTlm(data_buffer,&setVal);

            // Copy data to data_buffer
            setVal.cam2Angle1 = nadir_cfg_param->angle_1;
            setVal.cam2Angle2 = nadir_cfg_param->angle_2;
            setVal.cam2Angle3 = nadir_cfg_param->angle_3;
            setVal.cam2AutoAdj = nadir_cfg_param->auto_adj;
            setVal.cam2BoreX = nadir_cfg_param->bore_x;
            setVal.cam2BoreY = nadir_cfg_param->bore_y;
            setVal.cam2Exposure = nadir_cfg_param->exposure;
            setVal.cam2MaskArea1Xmax = nadir_cfg_param->mask_area_1_x_max;
            setVal.cam2MaskArea1Xmin = nadir_cfg_param->mask_area_1_x_min;
            setVal.cam2MaskArea2Xmax = nadir_cfg_param->mask_area_2_x_max;
            setVal.cam2MaskArea2Xmin = nadir_cfg_param->mask_area_2_x_min;
            setVal.cam2MaskArea3Xmax = nadir_cfg_param->mask_area_3_x_max;
            setVal.cam2MaskArea3Xmin = nadir_cfg_param->mask_area_3_x_min;
            setVal.cam2MaskArea4Xmax = nadir_cfg_param->mask_area_4_x_max;
            setVal.cam2MaskArea4Xmin = nadir_cfg_param->mask_area_4_x_min;
            setVal.cam2MaskArea5Xmax = nadir_cfg_param->mask_area_5_x_max;
            setVal.cam2MaskArea5Xmin = nadir_cfg_param->mask_area_5_x_min;
            setVal.cam2MaskArea1Ymax = nadir_cfg_param->mask_area_1_y_max;
            setVal.cam2MaskArea1Ymin = nadir_cfg_param->mask_area_1_y_min;
            setVal.cam2MaskArea2Ymax = nadir_cfg_param->mask_area_2_y_max;
            setVal.cam2MaskArea2Ymin = nadir_cfg_param->mask_area_2_y_min;
            setVal.cam2MaskArea3Ymax = nadir_cfg_param->mask_area_3_y_max;
            setVal.cam2MaskArea3Ymin = nadir_cfg_param->mask_area_3_y_min;
            setVal.cam2MaskArea4Ymax = nadir_cfg_param->mask_area_4_y_max;
            setVal.cam2MaskArea4Ymin = nadir_cfg_param->mask_area_4_y_min;
            setVal.cam2MaskArea5Ymax = nadir_cfg_param->mask_area_5_y_max;
            setVal.cam2MaskArea5Ymin = nadir_cfg_param->mask_area_5_y_min;
            setVal.cam2Threshold = nadir_cfg_param->threshold;
            setVal.nadirMaxBadEdges = nadir_cfg_param->max_bad_edges;
            setVal.nadirMaxDeviationPercentage = 
                nadir_cfg_param->max_deviation_pct;
            setVal.nadirMaxRadius = nadir_cfg_param->max_radius;
            setVal.nadirMinRadius = nadir_cfg_param->min_radius;

            os_memset(data_buffer, 0, data_len);
            data_len = CUBEACP_FormatCubeSenseConfigCmd(&data_buffer[0], \
                    &setVal);
            data_len = data_len - 1;

            // Transmit data to ADCS
            status = adcs_send_cmd(data_buffer[0], &data_buffer[1], data_len);
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set cache command
 */
e_adcs_status adcs_vapi_set_cache_cmd(s_adcs_ctx *adcs_ctx,\
        s_adcs_cache_cmd *cache)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_CACHE_CMD) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != cache)
        {
            data_len = COMMON_FormatCacheCmd(data_buffer, cache->enabled);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}


/**
 * @brief Abstracted function for set sram scrub settings
 */
e_adcs_status adcs_vapi_set_sram_scrub(s_adcs_ctx *adcs_ctx,\
        s_adcs_sram_scrub *sram_scrub)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_SRAM_SCRUB) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != sram_scrub)
        {
            data_len = COMMON_FormatSramScrubSettingsCmd(data_buffer,
                    (uint16_t)sram_scrub->scrub_size);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set unix time save to flash memory
 */
e_adcs_status adcs_vapi_set_utc_flash(s_adcs_ctx *adcs_ctx,\
        s_adcs_utc_flash *utc_flash)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_UTC_FLASH) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != utc_flash)
        {
            data_len = COMMON_FormatUnixTimeSaveCmd(data_buffer, \
                    utc_flash->save_now, utc_flash->save_on_upt, \
                    utc_flash->save_periodic, utc_flash->period);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set ASGP4 Params command
 */
e_adcs_status adcs_vapi_set_asgp4_param(s_adcs_ctx *adcs_ctx,\
        s_adcs_asgp4_param *asgp4_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t retval = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_ASGP4_PARAM) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != asgp4_param)
        {
            retval.aInclCoeff = asgp4_param->ainclcoeff;
            retval.aRaanCoeff = asgp4_param->araancoeff;
            retval.aEccCoeff = asgp4_param->aecccoeff;
            retval.aArgPerCoeff = asgp4_param->aargpercoeff;
            retval.aTimeCoeff = asgp4_param->atimecoeff;
            retval.aPosCoeff = asgp4_param->aposcoeff;
            retval.asgp4MaxPosError = asgp4_param->asgp4maxposerror;
            retval.asgp4Filter = asgp4_param->asgp4filter;
            retval.asgp4Xp = asgp4_param->asgp4xp;
            retval.asgp4Yp = asgp4_param->asgp4yp;
            retval.asgp4GpsRollover = asgp4_param->asgp4gpsrollover;
            retval.asgp4PosSdTh = asgp4_param->asgp4possdth;
            retval.asgp4VelSdTh = asgp4_param->asgp4velsdth;
            retval.asgp4MinSat = asgp4_param->asgp4minsat;
            retval.asgp4TimeGain = asgp4_param->asgp4timegain;
            retval.asgp4MaxLag = asgp4_param->asgp4maxlag;
            retval.asgp4MinSamples = asgp4_param->asgp4minsamples;

            data_len = CUBEACP_FormatASgp4ParamsCmd(data_buffer, &retval);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set user-coded controller and
 *   estimator parameters command to the cubeacp
 */
e_adcs_status adcs_vapi_set_user_ctrlr_est_sett(s_adcs_ctx *adcs_ctx,\
        s_adcs_user_ctrlr_est_sett *user_ctrlr_est)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t retval = {0};
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_USER_CTRLR_EST) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != user_ctrlr_est)
        {
            memcpy(retval.userConSettings, user_ctrlr_est->user_ctrlr_sett, \
                                    sizeof(retval.userConSettings));
            memcpy(retval.userEstSettings, user_ctrlr_est->user_est_sett, \
                                    sizeof(retval.userConSettings));

            data_len = CUBEACP_FormatUserConEstParamsCmd(data_buffer, &retval);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set SD Log1 Configuration.
 */
e_adcs_status adcs_vapi_set_sdlog1_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_sdlog_cfg *sd_log1_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_SD_LOG1_CFG_CFG) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != sd_log1_cfg)
        {
            data_len = CUBEACP_FormatLogSdConfig1Cmd(data_buffer, \
                    sd_log1_cfg->log_sel, sd_log1_cfg->period, \
                                    sd_log1_cfg->dest);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set SD Log2 Configuration.
 */
e_adcs_status adcs_vapi_set_sdlog2_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_sdlog_cfg *sd_log2_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_SD_LOG2_CFG_CFG) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != sd_log2_cfg)
        {
            data_len = CUBEACP_FormatLogSdConfig2Cmd(data_buffer, \
                sd_log2_cfg->log_sel, sd_log2_cfg->period, sd_log2_cfg->dest);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}


/**
 * @brief Abstracted function for set UART log configuration
 */
e_adcs_status adcs_vapi_set_uart_log(s_adcs_ctx *adcs_ctx,\
        s_adcs_uart_log_cfg *uart_log_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_UART_LOG_CFG) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != uart_log_cfg)
        {
            data_len = CUBEACP_FormatLogUartConfigCmd(data_buffer, \
                    uart_log_cfg->selection, uart_log_cfg->period);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set Hole Map 1 command
 */
e_adcs_status adcs_vapi_set_hole_map1(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap1)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_HOLE_MAP1) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != holemap1)
        {
            data_len = COMMON_FormatHoleMap1Cmd(data_buffer, \
                    (uint8_t*)&holemap1->holemap);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}


/**
 * @brief Abstracted function for set Hole Map 2 command
 */
e_adcs_status adcs_vapi_set_hole_map2(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap2)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_HOLE_MAP2) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != holemap2)
        {
            data_len = COMMON_FormatHoleMap2Cmd(data_buffer, \
                    (uint8_t*)&holemap2->holemap);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set Hole Map 3 command
 */
e_adcs_status adcs_vapi_set_hole_map3(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap3)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_HOLE_MAP3) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != holemap3)
        {
            data_len = COMMON_FormatHoleMap3Cmd(data_buffer, \
                    (uint8_t*)&holemap3->holemap);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set Hole Map 4 command
 */
e_adcs_status adcs_vapi_set_hole_map4(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap4)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_HOLE_MAP4) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != holemap4)
        {
            data_len = COMMON_FormatHoleMap4Cmd(data_buffer, \
                    (uint8_t*)&holemap4->holemap);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set Hole Map 5 command
 */
e_adcs_status adcs_vapi_set_hole_map5(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap5)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_HOLE_MAP5) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != holemap5)
        {
            data_len = COMMON_FormatHoleMap5Cmd(data_buffer, \
                    (uint8_t*)&holemap5->holemap);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set Hole Map 6 command
 */
e_adcs_status adcs_vapi_set_hole_map6(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap6)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_HOLE_MAP6) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != holemap6)
        {
            data_len = COMMON_FormatHoleMap6Cmd(data_buffer, \
                    (uint8_t*)&holemap6->holemap);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set Hole Map 7 command
 */
e_adcs_status adcs_vapi_set_hole_map7(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap7)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_HOLE_MAP7) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != holemap7)
        {
            data_len = COMMON_FormatHoleMap7Cmd(data_buffer, \
                    (uint8_t*)&holemap7->holemap);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function for set Hole Map 8 command
 */
e_adcs_status adcs_vapi_set_hole_map8(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap8)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        // value assignment to variables
        data_len = adcs_get_tc_size(TC_SET_ADCS_HOLE_MAP8) + 1;
        // Memory allocation for payload
        data_buffer = (uint8*) os_malloc_eram(data_len);
        // To verify valid payload present before copying to frame
        if(NULL != holemap8)
        {
            data_len = COMMON_FormatHoleMap8Cmd(data_buffer, \
                    (uint8_t*)&holemap8->holemap);
            data_len = data_len - 1;
            if(data_len > 0)
            {
                // Transmit data to ADCS
                status = adcs_send_cmd(data_buffer[0], &data_buffer[1],\
                        data_len);
            }
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Identification
 */
e_adcs_status adcs_vapi_get_id(s_adcs_ctx *adcs_ctx,\
        s_adcs_id *id_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    COMMON_Identification_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(Identification);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != id_param)
        {
            // Request Telemetry data
            status = adcs_requesttlm(Identification, (uint8_t*)data_buffer,\
                    data_len);
            COMMON_ExtractIdentificationTlm(data_buffer, &returnVal);
            id_param->id = returnVal.nodeType;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get TLE Configuration
 */
e_adcs_status adcs_vapi_get_tle(s_adcs_ctx *adcs_ctx,\
        s_adcs_tle *tle_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(OrbitParameters);

        // To verify valid payload present before copying to frame
        if(NULL != tle_param)
        {
            // Request Telemetry data
            status = adcs_requesttlm(OrbitParameters, (uint8_t*)tle_param,\
                    data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Moment of inertia Matrix
 */
e_adcs_status adcs_vapi_get_moi(s_adcs_ctx *adcs_ctx,\
        s_adcs_moi *moi_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(MoI);

        // To verify valid payload present before copying to frame
        if(NULL != moi_param)
        {
            // Request Telemetry data
            status = adcs_requesttlm(MoI, (uint8_t*)moi_param,\
                    data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get power configuration
 */
e_adcs_status adcs_vapi_get_power(s_adcs_ctx *adcs_ctx,\
        s_adcs_pwr_cmd *pwr_cmd)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(AdcsPower);

        // To verify valid payload present before copying to frame
        if(NULL != pwr_cmd)
        {
            pwr_cmd->pwr_source = 0;
            // Request Telemetry data
            status = adcs_requesttlm(AdcsPower, (uint8_t*)&pwr_cmd->pwr_source,\
                    data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get magnetic field vector
 */
e_adcs_status adcs_vapi_get_mag_vector(s_adcs_ctx *adcs_ctx,\
        s_adcs_mag_vector *mag_vector)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(MagField);

        // To verify valid payload present before copying to frame
        if(NULL != mag_vector)
        {
            // Request Telemetry data
            status = adcs_requesttlm(MagField,\
                    (uint8_t*)mag_vector, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get CSS vector
 */
e_adcs_status adcs_vapi_get_css_sun_vector(s_adcs_ctx *adcs_ctx,\
        s_adcs_sun_vector *css_sun)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(CoarseSunVec);

        // To verify valid payload present before copying to frame
        if(NULL != css_sun)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CoarseSunVec, (uint8_t*)css_sun,\
                    data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get FSS vector
 */
e_adcs_status adcs_vapi_get_fss_sun_vector(s_adcs_ctx *adcs_ctx,\
        s_adcs_sun_vector *fss_sun)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(FineSunVec);

        // To verify valid payload present before copying to frame
        if(NULL != fss_sun)
        {
            // Request Telemetry data
            status = adcs_requesttlm(FineSunVec, (uint8_t*)fss_sun,\
                    data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Nadir vector
 */
e_adcs_status adcs_vapi_get_nadir_vector(s_adcs_ctx *adcs_ctx,\
        s_adcs_nadir_vector *nadir_vec)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(NadirVec);

        // To verify valid payload present before copying to frame
        if(NULL != nadir_vec)
        {
            // Request Telemetry data
            status = adcs_requesttlm(NadirVec, (uint8_t*)nadir_vec,\
                    data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Sensor rate
 */
e_adcs_status adcs_vapi_get_sensor_rate(s_adcs_ctx *adcs_ctx,\
        s_adcs_rate_sens *sens_rate)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsMeasure_t returnVal = {0};
    uint8 *data_buffer = NULL;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RateSensor);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != sens_rate)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RateSensor,\
                    data_buffer, data_len);
            CUBEACP_ExtractRateSensorTlm(data_buffer, &returnVal);
            sens_rate->rate_x = returnVal.rateX;
            sens_rate->rate_y = returnVal.rateY;
            sens_rate->rate_z = returnVal.rateZ;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get star tracker body vector
 */
e_adcs_status adcs_vapi_get_star_body(s_adcs_ctx *adcs_ctx, uint8_t star_id,\
        s_adcs_star_trkr_body *star_body)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(Star1Body + star_id);

        // To verify valid payload present before copying to frame
        if(NULL != star_body)
        {
            // Request Telemetry data
            status = adcs_requesttlm(Star1Body + star_id,\
                    (uint8_t*)star_body, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get star trackere orbit vector
 */
e_adcs_status adcs_vapi_get_star_orbit(s_adcs_ctx *adcs_ctx, uint8_t star_id,\
        s_adcs_star_trkr_orbit *star_orbit)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(Star1Orbit + star_id);

        // To verify valid payload present before copying to frame
        if(NULL != star_orbit)
        {
            // Request Telemetry data
            status = adcs_requesttlm(Star1Orbit + star_id,\
                    (uint8_t*)star_orbit, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw nadir sensor meaurement
 */
e_adcs_status adcs_vapi_get_raw_nadir(s_adcs_ctx *adcs_ctx,\
        s_adcs_nadir_sens *raw_nadir)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawCam2Sens);

        // To verify valid payload present before copying to frame
        if(NULL != raw_nadir)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawCam2Sens,\
                    (uint8_t*)raw_nadir, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw fine sun sensor measurement
 */
e_adcs_status adcs_vapi_get_raw_fss(s_adcs_ctx *adcs_ctx,\
        s_adcs_fss_sens *raw_fss)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawCam1Sens);

        // To verify valid payload present before copying to frame
        if(NULL != raw_fss)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawCam1Sens,\
                    (uint8_t*)raw_fss, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw magnetometer measurement
 */
e_adcs_status adcs_vapi_get_raw_magmtr(s_adcs_ctx *adcs_ctx,\
        s_adcs_raw_mgmtr *raw_mgmtr)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawMagnetometer);

        // To verify valid payload present before copying to frame
        if(NULL != raw_mgmtr)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawMagnetometer,\
                    (uint8_t*)raw_mgmtr, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw GPS staus
 */
e_adcs_status adcs_vapi_get_raw_gps_status(s_adcs_ctx *adcs_ctx,\
        s_adcs_gps_s *raw_gps)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    uint8 *data_buffer = NULL;
    CUBEACP_RawGPS_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawGpsStatus);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != raw_gps)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawGpsStatus,\
                    data_buffer, data_len);
            CUBEACP_ExtractRawGpsStatusTlm(data_buffer, &returnVal);

            raw_gps->gps_num_sats_sol = returnVal.gpsNumSatsSolution;
            raw_gps->gps_num_sats_tracked = returnVal.gpsNumSatsTracked;
            raw_gps->gps_sol_sts = returnVal.gpsSolutionStatus;
            raw_gps->gps_xyz_log_ctr = returnVal.gpsXYZLogCtr;
            raw_gps->gps_range_log_ctr = returnVal.gpsRangeLogCtr;
            raw_gps->gps_response = returnVal.gpsResponse;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw GPS time
 */
e_adcs_status adcs_vapi_get_raw_gps_time(s_adcs_ctx *adcs_ctx,\
        s_adcs_gps_time *raw_gps_time)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawGpsTime);

        // To verify valid payload present before copying to frame
        if(NULL != raw_gps_time)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawGpsTime,\
                    (uint8_t*)raw_gps_time, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw GPS X axis
 */
e_adcs_status adcs_vapi_get_raw_gps_x(s_adcs_ctx *adcs_ctx,\
        s_adcs_gps_x *raw_gps_x)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawGpsX);

        // To verify valid payload present before copying to frame
        if(NULL != raw_gps_x)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawGpsX,\
                    (uint8_t*)raw_gps_x, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw GPS Y axis
 */
e_adcs_status adcs_vapi_get_raw_gps_y(s_adcs_ctx *adcs_ctx,\
        s_adcs_gps_y *raw_gps_y)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawGpsY);

        // To verify valid payload present before copying to frame
        if(NULL != raw_gps_y)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawGpsY,\
                    (uint8_t*)raw_gps_y, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw GPS Z axis
 */
e_adcs_status adcs_vapi_get_raw_gps_z(s_adcs_ctx *adcs_ctx,\
        s_adcs_gps_z *raw_gps_z)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawGpsZ);

        // To verify valid payload present before copying to frame
        if(NULL != raw_gps_z)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawGpsZ,\
                    (uint8_t*)raw_gps_z, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get star magnitude
 */
e_adcs_status adcs_vapi_get_star_magnitude(s_adcs_ctx *adcs_ctx,\
        s_adcs_star_trkr_mag *star_trkr_mag)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(StarMagnitude);

        // To verify valid payload present before copying to frame
        if(NULL != star_trkr_mag)
        {
            // Request Telemetry data
            status = adcs_requesttlm(StarMagnitude,\
                    (uint8_t*)star_trkr_mag, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get star performance
 */
e_adcs_status adcs_vapi_get_star_performance(s_adcs_ctx *adcs_ctx,\
        s_adcs_star_trkr_perform *star_perform)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(StarPerformance1);

        // To verify valid payload present before copying to frame
        if(NULL != star_perform)
        {
            // Request Telemetry data
            status = adcs_requesttlm(StarPerformance1,\
                    (uint8_t*)star_perform, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get star timing
 */
e_adcs_status adcs_vapi_get_star_timing(s_adcs_ctx *adcs_ctx,\
        s_adcs_star_trkr_timing *star_timing)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(StarTiming);

        // To verify valid payload present before copying to frame
        if(NULL != star_timing)
        {
            // Request Telemetry data
            status = adcs_requesttlm(StarTiming,\
                    (uint8_t*)star_timing, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw sensor measurement
 */
e_adcs_status adcs_vapi_get_raw_sensor_measure(s_adcs_ctx *adcs_ctx,\
        s_adcs_raw_sensor *raw_sensor)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_RawSensor_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawSensor);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != raw_sensor)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawSensor,\
                        data_buffer, data_len);
            CUBEACP_ExtractRawSensorTlm(data_buffer, &returnVal);
            raw_sensor->fss_busy = returnVal.cam1Busy;
            raw_sensor->fss_result = returnVal.cam1Result;
            raw_sensor->fss_raw_x = returnVal.cam1RawX;
            raw_sensor->fss_raw_y = returnVal.cam1RawY;
            raw_sensor->nadir_busy = returnVal.cam2Busy;
            raw_sensor->nadir_result = returnVal.cam2Result;
            raw_sensor->nadir_raw_x = returnVal.cam2RawX;
            raw_sensor->nadir_raw_y = returnVal.cam2RawY;
            raw_sensor->css_raw = returnVal.cssRaw1;
            raw_sensor->mag_raw_x = returnVal.magRawX;
            raw_sensor->mag_raw_y = returnVal.magRawY;
            raw_sensor->mag_raw_z = returnVal.magRawZ;
            raw_sensor->raw_rate_x = returnVal.rawRateX;
            raw_sensor->raw_rate_y = returnVal.rawRateY;
            raw_sensor->raw_rate_z = returnVal.rawRateZ;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw GPS measurement
 */
e_adcs_status adcs_vapi_get_raw_gps_measure(s_adcs_ctx *adcs_ctx,\
        s_adcs_raw_gps *raw_gps)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    uint8 *data_buffer = NULL;
    CUBEACP_RawGPS_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawGPS);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != raw_gps)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawGPS,\
                    data_buffer, data_len);
            CUBEACP_ExtractRawGPSTlm(data_buffer, &returnVal);

            raw_gps->gps_sol_sts = returnVal.gpsSolutionStatus;
            raw_gps->gps_num_sats_tracked = returnVal.gpsNumSatsTracked;
            raw_gps->gps_num_sats_sol = returnVal.gpsNumSatsSolution;
            raw_gps->gps_xyz_log_ctr = returnVal.gpsXYZLogCtr;
            raw_gps->gps_range_log_ctr = returnVal.gpsRangeLogCtr;
            raw_gps->gps_response = returnVal.gpsResponse;
            raw_gps->gps_week = returnVal.gpsWeek;
            raw_gps->gps_time_ms = returnVal.gpsTimeMs;
            raw_gps->ecef_pos_x = returnVal.posEcefX;
            raw_gps->ecef_vel_x = returnVal.velEcefX;
            raw_gps->ecef_pos_y = returnVal.posEcefY;
            raw_gps->ecef_vel_y = returnVal.velEcefY;
            raw_gps->ecef_pos_z = returnVal.posEcefZ;
            raw_gps->ecef_vel_z = returnVal.velEcefZ;
            raw_gps->std_dev_pos_x = returnVal.stdDevPosX;
            raw_gps->std_dev_pos_y = returnVal.stdDevPosY;
            raw_gps->std_dev_pos_z = returnVal.stdDevPosZ;
            raw_gps->std_dev_vel_x = returnVal.stdDevVelX;
            raw_gps->std_dev_vel_y = returnVal.stdDevVelY;
            raw_gps->std_dev_vel_z = returnVal.stdDevVelZ;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw star tracker measurement
 */
e_adcs_status adcs_vapi_get_raw_star_measure(s_adcs_ctx *adcs_ctx,\
        s_adcs_raw_star_trkr *raw_star_measure)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    uint8 *data_buffer = NULL;
    CUBEACP_RawStarTracker_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawStarTracker);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != raw_star_measure)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawStarTracker,\
                    data_buffer, data_len);

            CUBEACP_ExtractRawStarTrackerTlm(data_buffer, &returnVal);

            raw_star_measure->num_stars_detected = returnVal.numStarsDetected;
            raw_star_measure->star_image_noise = returnVal.starImageNoise;
            raw_star_measure->invalid_stars = returnVal.invalidStars;
            raw_star_measure->num_stars_id = returnVal.numberOfStarsID;
            raw_star_measure->id_mode = returnVal.iDmode;
            raw_star_measure->image_dark_value = returnVal.imageDarkValue;
            raw_star_measure->image_capture_success =
                                  returnVal.imageCaptureSuccess;
            raw_star_measure->detection_success = returnVal.detectionSuccess;
            raw_star_measure->id_success = returnVal.identificationSuccess;
            raw_star_measure->attitude_success = returnVal.attitudeSuccess;
            raw_star_measure->processing_time_error =
                                    returnVal.processingTimeError;
            raw_star_measure->tracking_module_enabled =
                                    returnVal.trackingModuleEnabled;
            raw_star_measure->prediction_enabled = returnVal.predictionEnabled;
            raw_star_measure->comms_error = returnVal.commsError;
            raw_star_measure->samlpe_period = returnVal.deltaT;
            raw_star_measure->s1_conf = returnVal.s1Conf;
            raw_star_measure->s2_conf = returnVal.s2Conf;
            raw_star_measure->s3_conf = returnVal.s3Conf;
            raw_star_measure->mag_star_1 = returnVal.magStar1;
            raw_star_measure->mag_star_2 = returnVal.magStar2;
            raw_star_measure->mag_star_3 = returnVal.magStar3;
            raw_star_measure->cat_star = returnVal.catStar1;
            raw_star_measure->cent_star_x = returnVal.centXStar1;
            raw_star_measure->cent_star_y = returnVal.centYStar1;
            //returnVal->catStar2;
            //returnVal->centXStar2;
            //returnVal->centYStar2;
            //returnVal->catStar3;
            //returnVal->centXStar3;
            //returnVal->centYStar3;
            raw_star_measure->capture = returnVal.capture;
            raw_star_measure->detection = returnVal.detection;
            raw_star_measure->id = returnVal.identification;
            raw_star_measure->rate_x = returnVal.starRateX;
            raw_star_measure->rate_y = returnVal.starRateY;
            raw_star_measure->rate_z = returnVal.starRateZ;
            raw_star_measure->est_attitude_q1 = returnVal.starQbar0;
            raw_star_measure->est_attitude_q2 = returnVal.starQbar1;
            raw_star_measure->est_attitude_q3 = returnVal.starQbar2;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw star tracker data
 */
e_adcs_status adcs_vapi_get_raw_star_data(s_adcs_ctx *adcs_ctx,uint8_t star_id,
        s_adcs_raw_star_trkr_data *raw_star_data)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(Star1Raw + star_id);

        // To verify valid payload present before copying to frame
        if(NULL != raw_star_data)
        {
            // Request Telemetry data
            status = adcs_requesttlm(Star1Raw + star_id,\
                        (uint8_t*)raw_star_data, data_len);

        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw secondary magnetometer measurement
 */
e_adcs_status adcs_vapi_get_sec_raw_magmtr_measure(s_adcs_ctx *adcs_ctx,\
        s_adcs_raw_mgmtr *raw_mgmtr)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(MagRaw2);

        // To verify valid payload present before copying to frame
        if(NULL != raw_mgmtr)
        {
            // Request Telemetry data
            status = adcs_requesttlm(MagRaw2,\
                    (uint8_t*)raw_mgmtr, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw sensor rates
 */
e_adcs_status adcs_vapi_get_raw_rates(s_adcs_ctx *adcs_ctx,\
        s_adcs_raw_rate_sens *raw_rates)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RawRate);

        // To verify valid payload present before copying to frame
        if(NULL != raw_rates)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RawRate,\
                    (uint8_t*)raw_rates, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get star tracker estimation rate
 */
e_adcs_status adcs_vapi_get_star_est_rate(s_adcs_ctx *adcs_ctx,\
        s_adcs_star_est_rate *star_est_rate)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(EstimRates);

        // To verify valid payload present before copying to frame
        if(NULL != star_est_rate)
        {
            // Request Telemetry data
            status = adcs_requesttlm(EstimRates,\
                    (uint8_t*)star_est_rate, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get sensor current
 */
e_adcs_status adcs_vapi_get_sensor_current(s_adcs_ctx *adcs_ctx,\
        s_adcs_sens_cur *sens_current)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8_t *data_buffer = NULL;
        CUBEACP_AdcsPowerMeasure_t returnVal = {0};

        // value assignment to variables
        data_len = adcs_get_tlm_size(CubeSense1Currents);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != sens_current)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CubeSense1Currents,\
                        data_buffer, data_len);
            CUBEACP_ExtractCubeSense1CurrentsTlm(data_buffer, &returnVal);
            sens_current->fss_3v3_current = returnVal.cubeSense1_3V3Current;
            sens_current->fss_sram_current = returnVal.cubeSense1_CamCurrent;

            // Request Telemetry data
            status |= adcs_requesttlm(CubeSense2Currents,\
                        data_buffer, data_len);
            CUBEACP_ExtractCubeSense2CurrentsTlm(data_buffer, &returnVal);
            sens_current->nadir_3v3_current = returnVal.cubeSense2_3V3Current;
            sens_current->nadir_sram_current = returnVal.cubeSense2_CamCurrent;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get adcs current measurement
 */
e_adcs_status adcs_vapi_get_con_current_measure(s_adcs_ctx *adcs_ctx,\
        s_adcs_current *con_current_measure)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8_t *data_buffer = NULL;
        CUBEACP_AdcsPowerMeasure_t returnVal = {0};

        // value assignment to variables
        data_len = adcs_get_tlm_size(CubeControlCurrents);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != con_current_measure)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CubeControlCurrents,\
                        data_buffer, data_len);
            CUBEACP_ExtractCubeControlCurrentsTlm(data_buffer, &returnVal);
            con_current_measure->current_3v3 = returnVal.cubeControl3V3Current;
            con_current_measure->current_5v = returnVal.cubeControl5VCurrent;
            con_current_measure->current_vbat = returnVal.cubeControlBatCurrent;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get adcs temperature
 */
e_adcs_status adcs_vapi_get_temperature(s_adcs_ctx *adcs_ctx,\
        s_adcs_temperature *temperature)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8_t *data_buffer = NULL;
        CUBEACP_AdcsPowerMeasure_t returnVal = {0};

        // value assignment to variables
        data_len = adcs_get_tlm_size(AdcsTemperatures1);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != temperature)
        {
            // Request Telemetry data
            status = adcs_requesttlm(AdcsTemperatures1,\
                        data_buffer, data_len);
            CUBEACP_ExtractAdcsTemperatures1Tlm(data_buffer, &returnVal);
            temperature->mcu_temperature = returnVal.mCUTemp;
            temperature->mgmtr_temperature = returnVal.magnetometerTemp;
            temperature->red_magmtr_temperature =
                                returnVal.redundentMagnetometerTemp;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get rate sensor temperature
 */
e_adcs_status adcs_vapi_get_rate_sensor_temperature(s_adcs_ctx *adcs_ctx,\
        s_adcs_rate_temperature *rate_sens_temperature)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(AdcsTemperatures2);

        // To verify valid payload present before copying to frame
        if(NULL != rate_sens_temperature)
        {
            // Request Telemetry data
            status = adcs_requesttlm(AdcsTemperatures2,\
                    (uint8_t*)rate_sens_temperature, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get power and temperature measurement
 */
e_adcs_status adcs_vapi_get_power_temperature(s_adcs_ctx *adcs_ctx,\
        s_adcs_cur_temp *power_temperature)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8_t *data_buffer = NULL;
        CUBEACP_AdcsPowerMeasure_t returnVal = {0};

        // value assignment to variables
        data_len = adcs_get_tlm_size(AdcsPowerMeasure);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != power_temperature)
        {
            // Request Telemetry data
            status = adcs_requesttlm(AdcsPowerMeasure,\
                        data_buffer, data_len);
            CUBEACP_ExtractAdcsPowerMeasureTlm(data_buffer, &returnVal);
            power_temperature->adcs_current.current_3v3 =
                                    returnVal.cubeControl3V3Current;
            power_temperature->adcs_current.current_5v =
                                    returnVal.cubeControl5VCurrent;
            power_temperature->adcs_current.current_vbat =
                                    returnVal.cubeControlBatCurrent;
            power_temperature->adcs_temp.mcu_temperature =
                                    returnVal.mCUTemp;
            power_temperature->adcs_temp.mgmtr_temperature =
                                    returnVal.magnetometerTemp;
            power_temperature->adcs_temp.red_magmtr_temperature =
                                        returnVal.redundentMagnetometerTemp;
            power_temperature->rate_sensor_temp.x_rate_temp =
                                    returnVal.xRateTemp;
            power_temperature->rate_sensor_temp.y_rate_temp =
                                    returnVal.yRateTemp;
            power_temperature->rate_sensor_temp.z_rate_temp =
                                    returnVal.zRateTemp;
            power_temperature->rw_current.rw_current =
                                    returnVal.wheel1Current;
            power_temperature->sensor_current.fss_3v3_current =
                                    returnVal.cubeSense1_3V3Current;
            power_temperature->sensor_current.fss_sram_current =
                                    returnVal.cubeSense1_CamCurrent;
            power_temperature->sensor_current.nadir_3v3_current =
                                    returnVal.cubeSense2_3V3Current;
            power_temperature->sensor_current.nadir_sram_current =
                                    returnVal.cubeSense2_CamCurrent;
            power_temperature->star_trkr_mcu_temp = returnVal.cubeStarTemp;
            power_temperature->star_trkr_current = returnVal.cubeStarCurrent;
            power_temperature->magtrqr_current = returnVal.magtorqCurrent;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get gyro configuration
 */
e_adcs_status adcs_vapi_get_gyro_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_gyro_cfg *gyro_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t returnVal = {0};
    uint8 *data_buffer = NULL;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(GyroConfig);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != gyro_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(GyroConfig,\
                    (uint8_t*)data_buffer, data_len);
            CUBEACP_ExtractGyroConfigTlm(data_buffer, &returnVal);
            gyro_cfg->gyro_conf_1 = returnVal.gyro1Conf;
            gyro_cfg->gyro_conf_2 = returnVal.gyro2Conf;
            gyro_cfg->gyro_conf_3 = returnVal.gyro3Conf;
            gyro_cfg->rate_sensor_mult = returnVal.rateSensorMult;
            gyro_cfg->x_rate_offset = returnVal.xRateOffset;
            gyro_cfg->y_rate_offset = returnVal.yRateOffset;
            gyro_cfg->z_rate_offset = returnVal.zRateOffset;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get star tracker configuration
 */
e_adcs_status adcs_vapi_get_star_trkr_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_star_trkr_cfg *star_trkr_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    uint8 *data_buffer = NULL;
    CUBEACP_AdcsConfig_t returnVal = {0};
    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(StarConfig);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != star_trkr_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(StarConfig,\
                    data_buffer, data_len);
            CUBEACP_ExtractStarConfigTlm(data_buffer, &returnVal);
            star_trkr_cfg->angle_1 = returnVal.starAngle1;
            star_trkr_cfg->angle_2 = returnVal.starAngle2;
            star_trkr_cfg->angle_3 = returnVal.starAngle3;
            star_trkr_cfg->exposure = returnVal.starExposure;
            star_trkr_cfg->gain = returnVal.starGain;
            star_trkr_cfg->detection_threshold = returnVal.detectionThreshold;
            star_trkr_cfg->threshold = returnVal.starThreshold;
            star_trkr_cfg->max_star_matched = returnVal.maxStarMatched;
            star_trkr_cfg->timeout_time = returnVal.starTimeoutTime;
            star_trkr_cfg->max_star_pixel = returnVal.maxStarPixel;
            star_trkr_cfg->min_star_pixel = returnVal.minStarPixel;
            star_trkr_cfg->error_margin = returnVal.starErrorMargin;
            star_trkr_cfg->delay_time = returnVal.starDelayTime;
            star_trkr_cfg->cent_x = returnVal.starCentX;
            star_trkr_cfg->cent_y = returnVal.starCentY;
            star_trkr_cfg->focal = returnVal.starFocal;
            star_trkr_cfg->lens_k1 = returnVal.starLensK1;
            star_trkr_cfg->lens_k2 = returnVal.starLensK2;
            star_trkr_cfg->lens_p1 = returnVal.starLensP1;
            star_trkr_cfg->lens_p2 = returnVal.starLensP2;
            star_trkr_cfg->window_width = returnVal.starWindowWidth;
            star_trkr_cfg->tracking_margin = returnVal.starTrackingMargin;
            star_trkr_cfg->validation_margin = returnVal.starValidationMargin;
            star_trkr_cfg->search_width = returnVal.starSearchWidth;
            star_trkr_cfg->module_enable = returnVal.starModuleEnable;
            star_trkr_cfg->location_prediction_enable =
                                    returnVal.starLocationPredictionEnable;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get magnetometer configuration
 */
e_adcs_status adcs_vapi_get_mgmtr_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_mgmtr_cfg *mgmtr_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t returnVal = {0};
    uint8 *data_buffer = NULL;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(MagConfig);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != mgmtr_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(MagConfig,\
                    data_buffer, data_len);
            CUBEACP_ExtractMagConfigTlm(data_buffer, &returnVal);

            mgmtr_cfg->angle_1 = returnVal.magmAngle1;
            mgmtr_cfg->angle_2 = returnVal.magmAngle2;
            mgmtr_cfg->angle_3 = returnVal.magmAngle3;
            mgmtr_cfg->offset_1 = returnVal.magmOffset1;
            mgmtr_cfg->offset_2 = returnVal.magmOffset2;
            mgmtr_cfg->offset_3 = returnVal.magmOffset3;
            mgmtr_cfg->sens_11 = returnVal.magmSens11;
            mgmtr_cfg->sens_22 = returnVal.magmSens22;
            mgmtr_cfg->sens_33 = returnVal.magmSens33;
            mgmtr_cfg->sens_12 = returnVal.magmSens12;
            mgmtr_cfg->sens_13 = returnVal.magmSens13;
            mgmtr_cfg->sens_21 = returnVal.magmSens21;
            mgmtr_cfg->sens_23 = returnVal.magmSens23;
            mgmtr_cfg->sens_31 = returnVal.magmSens31;
            mgmtr_cfg->sens_32 = returnVal.magmSens32;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get coarse sun sensor configuration
 */
e_adcs_status adcs_vapi_get_css_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_css_cfg *css_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    uint8 *data_buffer = NULL;
    CUBEACP_AdcsConfig_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(CssConfig);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != css_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CssConfig, data_buffer, data_len);
            CUBEACP_ExtractCssConfigTlm(data_buffer, &returnVal);
            css_cfg->css_conf = returnVal.css1Conf;
            css_cfg->css_scale = returnVal.css1Scale;
            css_cfg->css_min = returnVal.cssMinimum;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function to get Fine sun sensor configuration
 */
e_adcs_status adcs_vapi_get_fss_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_fss_cfg *fss_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    uint8 *data_buffer = NULL;
    CUBEACP_AdcsConfig_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(CubeSenseConfig);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != fss_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CubeSenseConfig,data_buffer,data_len);

            CUBEACP_ExtractCubeSenseConfigTlm(data_buffer,&returnVal);

            // Copy data to data_buffer
            fss_cfg->angle_1 = returnVal.cam1Angle1;
            fss_cfg->angle_2 = returnVal.cam1Angle2;
            fss_cfg->angle_3 = returnVal.cam1Angle3;
            fss_cfg->auto_adj = returnVal.cam1AutoAdj;
            fss_cfg->bore_x = returnVal.cam1BoreX;
            fss_cfg->bore_y = returnVal.cam1BoreY;
            fss_cfg->exposure = returnVal.cam1Exposure;
            fss_cfg->mask_area_1_x_max = returnVal.cam1MaskArea1Xmax;
            fss_cfg->mask_area_1_x_min = returnVal.cam1MaskArea1Xmin;
            fss_cfg->mask_area_2_x_max = returnVal.cam1MaskArea2Xmax;
            fss_cfg->mask_area_2_x_min = returnVal.cam1MaskArea2Xmin;
            fss_cfg->mask_area_3_x_max = returnVal.cam1MaskArea3Xmax;
            fss_cfg->mask_area_3_x_min = returnVal.cam1MaskArea3Xmin;
            fss_cfg->mask_area_4_x_max = returnVal.cam1MaskArea4Xmax;
            fss_cfg->mask_area_4_x_min = returnVal.cam1MaskArea4Xmin;
            fss_cfg->mask_area_5_x_max = returnVal.cam1MaskArea5Xmax;
            fss_cfg->mask_area_5_x_min = returnVal.cam1MaskArea5Xmin;
            fss_cfg->mask_area_1_y_max = returnVal.cam1MaskArea1Ymax;
            fss_cfg->mask_area_1_y_min = returnVal.cam1MaskArea1Ymin;
            fss_cfg->mask_area_2_y_max = returnVal.cam1MaskArea2Ymax;
            fss_cfg->mask_area_2_y_min = returnVal.cam1MaskArea2Ymin;
            fss_cfg->mask_area_3_y_max = returnVal.cam1MaskArea3Ymax;
            fss_cfg->mask_area_3_y_min = returnVal.cam1MaskArea3Ymin;
            fss_cfg->mask_area_4_y_max = returnVal.cam1MaskArea4Ymax;
            fss_cfg->mask_area_4_y_min = returnVal.cam1MaskArea4Ymin;
            fss_cfg->mask_area_5_y_max = returnVal.cam1MaskArea5Ymax;
            fss_cfg->mask_area_5_y_min = returnVal.cam1MaskArea5Ymin;
            fss_cfg->threshold = returnVal.cam1Threshold;

        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Abstracted function to get Nadir configuration
 */
e_adcs_status adcs_vapi_get_nadir_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_nadir_cfg *nadir_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    uint8 *data_buffer = NULL;
    CUBEACP_AdcsConfig_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(CubeSenseConfig);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != nadir_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CubeSenseConfig,data_buffer,data_len);

            CUBEACP_ExtractCubeSenseConfigTlm(data_buffer,&returnVal);

            // Copy data to data_buffer
            nadir_cfg->angle_1 = returnVal.cam2Angle1;
            nadir_cfg->angle_2 = returnVal.cam2Angle2;
            nadir_cfg->angle_3 = returnVal.cam2Angle3;
            nadir_cfg->auto_adj = returnVal.cam2AutoAdj;
            nadir_cfg->bore_x = returnVal.cam2BoreX;
            nadir_cfg->bore_y = returnVal.cam2BoreY;
            nadir_cfg->exposure = returnVal.cam2Exposure;
            nadir_cfg->mask_area_1_x_max = returnVal.cam2MaskArea1Xmax;
            nadir_cfg->mask_area_1_x_min = returnVal.cam2MaskArea1Xmin;
            nadir_cfg->mask_area_2_x_max = returnVal.cam2MaskArea2Xmax;
            nadir_cfg->mask_area_2_x_min = returnVal.cam2MaskArea2Xmin;
            nadir_cfg->mask_area_3_x_max = returnVal.cam2MaskArea3Xmax;
            nadir_cfg->mask_area_3_x_min = returnVal.cam2MaskArea3Xmin;
            nadir_cfg->mask_area_4_x_max = returnVal.cam2MaskArea4Xmax;
            nadir_cfg->mask_area_4_x_min = returnVal.cam2MaskArea4Xmin;
            nadir_cfg->mask_area_5_x_max = returnVal.cam2MaskArea5Xmax;
            nadir_cfg->mask_area_5_x_min = returnVal.cam2MaskArea5Xmin;
            nadir_cfg->mask_area_1_y_max = returnVal.cam2MaskArea1Ymax;
            nadir_cfg->mask_area_1_y_min = returnVal.cam2MaskArea1Ymin;
            nadir_cfg->mask_area_2_y_max = returnVal.cam2MaskArea2Ymax;
            nadir_cfg->mask_area_2_y_min = returnVal.cam2MaskArea2Ymin;
            nadir_cfg->mask_area_3_y_max = returnVal.cam2MaskArea3Ymax;
            nadir_cfg->mask_area_3_y_min = returnVal.cam2MaskArea3Ymin;
            nadir_cfg->mask_area_4_y_max = returnVal.cam2MaskArea4Ymax;
            nadir_cfg->mask_area_4_y_min = returnVal.cam2MaskArea4Ymin;
            nadir_cfg->mask_area_5_y_max = returnVal.cam2MaskArea5Ymax;
            nadir_cfg->mask_area_5_y_min = returnVal.cam2MaskArea5Ymin;
            nadir_cfg->threshold = returnVal.cam2Threshold;
            nadir_cfg->max_bad_edges = returnVal.nadirMaxBadEdges;
            nadir_cfg->max_deviation_pct = 
                returnVal.nadirMaxDeviationPercentage;
            nadir_cfg->max_radius = returnVal.nadirMaxRadius;
            nadir_cfg->min_radius = returnVal.nadirMinRadius;

        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get redudent magnetometer configuration
 */
e_adcs_status adcs_vapi_get_red_mgmtr_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_mgmtr_cfg *red_magmtr_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t returnVal = {0};
    uint8 *data_buffer = NULL;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RedMagConfig);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != red_magmtr_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RedMagConfig,\
                    data_buffer, data_len);

            CUBEACP_ExtractRedMagConfigTlm(data_buffer, &returnVal);
            red_magmtr_cfg->angle_1 = returnVal.mredAngle1;
            red_magmtr_cfg->angle_2 = returnVal.mredAngle2;
            red_magmtr_cfg->angle_3 = returnVal.mredAngle3;
            red_magmtr_cfg->offset_1 = returnVal.mredOffset1;
            red_magmtr_cfg->offset_2 = returnVal.mredOffset2;
            red_magmtr_cfg->offset_3 = returnVal.mredOffset3;
            red_magmtr_cfg->sens_11 = returnVal.mredSens11;
            red_magmtr_cfg->sens_22 = returnVal.mredSens22;
            red_magmtr_cfg->sens_33 = returnVal.mredSens33;
            red_magmtr_cfg->sens_12 = returnVal.mredSens12;
            red_magmtr_cfg->sens_13 = returnVal.mredSens13;
            red_magmtr_cfg->sens_21 = returnVal.mredSens21;
            red_magmtr_cfg->sens_23 = returnVal.mredSens23;
            red_magmtr_cfg->sens_31 = returnVal.mredSens31;
            red_magmtr_cfg->sens_32 = returnVal.mredSens32;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get magnetorquer configuration
 */
e_adcs_status adcs_vapi_get_mgntrqr_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_mgntrqr_cfg *mgntrqr_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    uint8 *data_buffer = NULL;
    CUBEACP_AdcsConfig_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(MagtorqConfig);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != mgntrqr_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(MagtorqConfig,\
                    (uint8_t*)data_buffer, data_len);
            CUBEACP_ExtractMagtorqConfigTlm(data_buffer, &returnVal);
            mgntrqr_cfg->mgntrqr_axis = returnVal.magtorq1;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get reaction wheel configuration
 */
e_adcs_status adcs_vapi_get_rw_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_rw_cfg *rw_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(WheelConfig);

        // To verify valid payload present before copying to frame
        if(NULL != rw_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(WheelConfig,\
                    (uint8_t*)rw_cfg, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get detumble control parameters
 */
e_adcs_status adcs_vapi_get_detumble_param(s_adcs_ctx *adcs_ctx,\
        s_adcs_detumble_ctrl *detumble_ctrl_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setval = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8_t* data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(DetumbleParams);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != detumble_ctrl_param)
        {
            // Request Telemetry data
            status = adcs_requesttlm(DetumbleParams,\
                     data_buffer, data_len);
            CUBEACP_ExtractDetumbleParamsTlm(data_buffer, &setval);
            detumble_ctrl_param->spin_gain = setval.ks;
            detumble_ctrl_param->damping_gain = setval.kd;
            detumble_ctrl_param->rw_ref_spin_rate = setval.wy_ref;
            detumble_ctrl_param->f_bdot_gain = setval.kdf;
        }
        else
        {
            // No Action Retun failure
        }
        //Free the allocated memory
        os_free(data_buffer);

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Y reaction wheel control
 */
e_adcs_status adcs_vapi_get_y_rw_ctrl(s_adcs_ctx *adcs_ctx,\
        s_adcs_y_rw_ctrl *y_rw_ctrl)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(YWheelParams);

        // To verify valid payload present before copying to frame
        if(NULL != y_rw_ctrl)
        {
            // Request Telemetry data
            status = adcs_requesttlm(YWheelParams,\
                    (uint8_t*)y_rw_ctrl, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get reaction wheel control
 */
e_adcs_status adcs_vapi_get_rw_ctrl(s_adcs_ctx *adcs_ctx,\
        s_adcs_rw_ctrl *rw_ctrl)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t setval = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8_t* data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RWheelParams);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != rw_ctrl)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RWheelParams, data_buffer,\
                    data_len);
            CUBEACP_ExtractRWheelParamsTlm(data_buffer, &setval);
            rw_ctrl->rw_prop_gain = setval.kp2;
            rw_ctrl->rw_derv_gain = setval.kd2;
            rw_ctrl->y_rw_bias = setval.h_bias;
            rw_ctrl->sun_point_facet = setval.sunPointFacet;
            rw_ctrl->rw_error_handling = setval.wheelErrorHandling;
        }
        else
        {
            // No Action Retun failure
        }
        // Free allocated memory
        os_free(data_buffer);

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get tracking control gain
 */
e_adcs_status adcs_vapi_get_trck_ctrl_gain(s_adcs_ctx *adcs_ctx,\
        s_adcs_trck_ctrl_gain *trck_ctrl_gain)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(TrackingParams);

        // To verify valid payload present before copying to frame
        if(NULL != trck_ctrl_gain)
        {
            // Request Telemetry data
            status = adcs_requesttlm(TrackingParams,\
                    (uint8_t*)trck_ctrl_gain, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get estimated attitude angle
 */
e_adcs_status adcs_vapi_get_est_attitude(s_adcs_ctx *adcs_ctx,\
        s_adcs_attitude_angl *attitude_angle)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsState_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(EstimAttitude);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != attitude_angle && NULL != data_buffer)
        {
            // Request Telemetry data
            status = adcs_requesttlm(EstimAttitude,\
                    data_buffer, data_len);
            CUBEACP_ExtractEstimAttitudeTlm(data_buffer, &returnVal);
            attitude_angle->roll = returnVal.roll;
            attitude_angle->pitch = returnVal.pitch;
            attitude_angle->yaw = returnVal.yaw;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get target tracking parameters
 */
e_adcs_status adcs_vapi_get_target_track(s_adcs_ctx *adcs_ctx,\
        s_adcs_trck_target *trck_trget)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(CmdTrackingTarget);

        // To verify valid payload present before copying to frame
        if(NULL != trck_trget)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CmdTrackingTarget,\
                    (uint8_t*)trck_trget, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get inertial reference
 */
e_adcs_status adcs_vapi_get_inertial_ref(s_adcs_ctx *adcs_ctx,\
        s_adcs_inrt_ref *inrt_ref)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(InertialPointReference);

        // To verify valid payload present before copying to frame
        if(NULL != inrt_ref)
        {
            // Request Telemetry data
            status = adcs_requesttlm(InertialPointReference,\
                    (uint8_t*)inrt_ref, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get estimation paremeters
 */
e_adcs_status adcs_vapi_get_est_param(s_adcs_ctx *adcs_ctx,\
        s_adcs_est_param *est_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(EstimParams);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != est_param)
        {
            // Request Telemetry data
            status = adcs_requesttlm(EstimParams,\
                    (uint8_t*)data_buffer, data_len);
            CUBEACP_ExtractEstimParamsTlm(data_buffer, &returnVal);
            est_param->mag_rate_noise = returnVal.magRateNoise;
            est_param->ekf_sys_noise = returnVal.ekfSysNoise;
            est_param->css_noise = returnVal.cssNoise;
            est_param->sun_noise = returnVal.sunNoise;
            est_param->nadir_noise = returnVal.nadirNoise;
            est_param->mag_noise = returnVal.magNoise;
            est_param->star_noise = returnVal.starNoise;
            est_param->use_sun_est = returnVal.useSunEst;
            est_param->use_nadir_est = returnVal.useNadirEst;
            est_param->use_css_est = returnVal.useCssEst;
            est_param->use_star_est = returnVal.useStarEst;
            est_param->nadir_terminator_check = returnVal.terminatorCheck;
            est_param->auto_recover_mtm = returnVal.autoRecoverMtm;
            est_param->mag_mode = returnVal.magMode;
            est_param->mag_raw_tlm_2_Sel = returnVal.magRawTlm2Selection;
            est_param->rate_sens_err_hndl = returnVal.rateSensorErrorHandling;
            est_param->rw_pwr_on_30s_delay = returnVal.wheelPowerOn30sDelay;
            est_param->fss_period = returnVal.cam1Cam2Period>>4;
            est_param->nadir_period = returnVal.cam1Cam2Period&0xf;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get sattelite position ECI
 */
e_adcs_status adcs_vapi_get_eci_postition(s_adcs_ctx *adcs_ctx,\
        s_adcs_eci_position *eci_position)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(PositionECI);

        // To verify valid payload present before copying to frame
        if(NULL != eci_position)
        {
            // Request Telemetry data
            status = adcs_requesttlm(PositionECI,\
                    (uint8_t*)eci_position, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get sattelite velocity
 */
e_adcs_status adcs_vapi_get_sat_velocity(s_adcs_ctx *adcs_ctx,\
        s_adcs_eci_velocity *eci_velocity)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(VelocityECI);

        // To verify valid payload present before copying to frame
        if(NULL != eci_velocity)
        {
            // Request Telemetry data
            status = adcs_requesttlm(VelocityECI,\
                    (uint8_t*)eci_velocity, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get sattelte position LLH
 */
e_adcs_status adcs_vapi_get_llh_psition(s_adcs_ctx *adcs_ctx,\
        s_adcs_trck_target *llh_position)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsState_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(PositionLLH);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != llh_position)
        {
            // Request Telemetry data
            status = adcs_requesttlm(PositionLLH,\
                    (uint8_t*)data_buffer, data_len);
            CUBEACP_ExtractPositionLLHTlm(data_buffer, &returnVal);
            llh_position->lat_ref = returnVal.latitude;
            llh_position->long_ref = returnVal.longitude;
            llh_position->alt_ref = returnVal.altitude;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get estimation rates
 */
e_adcs_status adcs_vapi_get_est_rate(s_adcs_ctx *adcs_ctx,\
        s_adcs_est_rate *est_rate)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(EstimRates);

        // To verify valid payload present before copying to frame
        if(NULL != est_rate)
        {
            // Request Telemetry data
            status = adcs_requesttlm(EstimRates,\
                    (uint8_t*)est_rate, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get estimated quaternion
 */
e_adcs_status adcs_vapi_get_est_qutrn(s_adcs_ctx *adcs_ctx,\
        s_adcs_est_qutrn *est_qutrn)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(EstimQuaternion);

        // To verify valid payload present before copying to frame
        if(NULL != est_qutrn)
        {
            // Request Telemetry data
            status = adcs_requesttlm(EstimQuaternion,\
                    (uint8_t*)est_qutrn, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get ECEF sattelite position
 */
e_adcs_status adcs_vapi_get_ecef_position(s_adcs_ctx *adcs_ctx,\
        s_adcs_eci_position *ecef_poistion)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(PositionECEF);

        // To verify valid payload present before copying to frame
        if(NULL != ecef_poistion)
        {
            // Request Telemetry data
            status = adcs_requesttlm(PositionECEF,\
                    (uint8_t*)ecef_poistion, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get moduled magnetic field vector
 */
e_adcs_status adcs_vapi_get_mog_mag_vector(s_adcs_ctx *adcs_ctx,\
        s_adcs_mag_vector *mod_mag_vector)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(ModelMagVec);

        // To verify valid payload present before copying to frame
        if(NULL != mod_mag_vector)
        {
            // Request Telemetry data
            status = adcs_requesttlm(ModelMagVec,\
                    (uint8_t*)mod_mag_vector, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get moduled sun vector
 */
e_adcs_status adcs_vapi_get_mod_sun_vector(s_adcs_ctx *adcs_ctx,\
        s_adcs_sun_vector *mod_sun_vector)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(ModelSunVec);

        // To verify valid payload present before copying to frame
        if(NULL != mod_sun_vector)
        {
            // Request Telemetry data
            status = adcs_requesttlm(ModelSunVec,\
                    (uint8_t*)mod_sun_vector, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get estimated gyro measurement
 */
e_adcs_status adcs_vapi_get_est_gyro_measure(s_adcs_ctx *adcs_ctx,\
        s_adcs_est_gyro *est_gyro)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(EstimGyroBias);

        // To verify valid payload present before copying to frame
        if(NULL != est_gyro)
        {
            // Request Telemetry data
            status = adcs_requesttlm(EstimGyroBias,\
                    (uint8_t*)est_gyro, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get estimation innovation
 */
e_adcs_status adcs_vapi_get_est_innovation(s_adcs_ctx *adcs_ctx,\
        s_adcs_est_innovn *est_innovn)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(InnovationVec);

        // To verify valid payload present before copying to frame
        if(NULL != est_innovn)
        {
            // Request Telemetry data
            status = adcs_requesttlm(InnovationVec,\
                    (uint8_t*)est_innovn, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get quaternion error vector
 */
e_adcs_status adcs_vapi_get_qutrn_error(s_adcs_ctx *adcs_ctx,\
        s_adcs_qutr_error *qutrn_error)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(QuaternionErrVec);

        // To verify valid payload present before copying to frame
        if(NULL != qutrn_error)
        {
            // Request Telemetry data
            status = adcs_requesttlm(QuaternionErrVec,\
                    (uint8_t*)qutrn_error, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get quaternion covariance
 */
e_adcs_status adcs_vapi_get_qutrn_covr(s_adcs_ctx *adcs_ctx,\
        s_adcs_qutr_covr *qutrn_covr)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(QuaternionCovar);

        // To verify valid payload present before copying to frame
        if(NULL != qutrn_covr)
        {
            // Request Telemetry data
            status = adcs_requesttlm(QuaternionCovar,\
                    (uint8_t*)qutrn_covr, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get angular rate covariance
 */
e_adcs_status adcs_vapi_get_ang_rate_covr(s_adcs_ctx *adcs_ctx,\
        s_adcs_angl_rate_covr *ang_rate_covr)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(RateCovar);

        // To verify valid payload present before copying to frame
        if(NULL != ang_rate_covr)
        {
            // Request Telemetry data
            status = adcs_requesttlm(RateCovar,\
                    (uint8_t*)ang_rate_covr, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get boot and running program status
 */
e_adcs_status adcs_vapi_get_boot_run_prog_status(s_adcs_ctx *adcs_ctx,\
        s_adcs_b_run_prog_sts *boot_run_prog_sts)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    COMMON_ExtendedIdentification_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(ExtendedIdentification);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != boot_run_prog_sts)
        {
            // Request Telemetry data
            status = adcs_requesttlm(ExtendedIdentification,\
                    data_buffer, data_len);
            COMMON_ExtractExtendedIdentificationTlm(data_buffer, &returnVal);
            boot_run_prog_sts->boot_cause = returnVal.bootCause;
            boot_run_prog_sts->boot_counter = returnVal.bootCounter;
            boot_run_prog_sts->boot_program_index =
                                returnVal.runningProgramIndex;
            boot_run_prog_sts->fw_major_version =
                                returnVal.firmwareMajorVersion;
            boot_run_prog_sts->fw_minor_version =
                                returnVal.firmwareMinorVersion;
            boot_run_prog_sts->mcu_reset_cause = returnVal.mcuResetCause;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get boot index and status
 */
e_adcs_status adcs_vapi_get_boot_indx_status(s_adcs_ctx *adcs_ctx,\
        s_adcs_b_index_sts *boot_indx_sts)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(BootIndexStatus);

        // To verify valid payload present before copying to frame
        if(NULL != boot_indx_sts)
        {
            // Request Telemetry data
            status = adcs_requesttlm(BootIndexStatus,\
                    (uint8_t*)boot_indx_sts, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get last logged event
 */
e_adcs_status adcs_vapi_get_last_log_evnt(s_adcs_ctx *adcs_ctx,\
        s_adcs_last_log_evnt *last_log_event)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(LastLogEvent);

        // To verify valid payload present before copying to frame
        if(NULL != last_log_event)
        {
            // Request Telemetry data
            status = adcs_requesttlm(LastLogEvent,\
                    (uint8_t*)last_log_event, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get SRAM latchup counter
 */
e_adcs_status adcs_vapi_get_latchup_cntr(s_adcs_ctx *adcs_ctx,\
        s_adcs_latchup_cntr *latchup_cntr)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(LatchupErrors);

        // To verify valid payload present before copying to frame
        if(NULL != latchup_cntr)
        {
            // Request Telemetry data
            status = adcs_requesttlm(LatchupErrors,\
                    (uint8_t*)latchup_cntr, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get EDAC error counters
 */
e_adcs_status adcs_vapi_get_edac_err_cntr(s_adcs_ctx *adcs_ctx,\
        s_adcs_edac_err_cntr *edac_err_cntr)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(EdacErrors);

        // To verify valid payload present before copying to frame
        if(NULL != edac_err_cntr)
        {
            // Request Telemetry data
            status = adcs_requesttlm(EdacErrors,\
                    (uint8_t*)edac_err_cntr, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Communication status
 */
e_adcs_status adcs_vapi_get_comm_sts(s_adcs_ctx *adcs_ctx,\
        s_adcs_comm_sts *comm_sts)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    COMMON_CommsStatus_t returnVal;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(CommsStatus);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != comm_sts)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CommsStatus,\
                    data_buffer, data_len);
            COMMON_ExtractCommsStatusTlm(data_buffer, &returnVal);
            comm_sts->can_tc_buffer_error = returnVal.cANBufferError;
            comm_sts->i2c_tc_buffer_error = returnVal.i2CBufferError;
            comm_sts->i2c_tlm_error = returnVal.i2CTelemetryError;
            comm_sts->tc_buffer_overrun = returnVal.uartBufferOverrun;
            comm_sts->tc_counter = returnVal.tcCounter;
            comm_sts->tlm_counter = returnVal.tlmCounter;
            comm_sts->uart_incomplete_message = returnVal.uartMsgIncomplete;
            comm_sts->uart_protocol_error = returnVal.uartProtocolError;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get SD card format or erase progress
 */
e_adcs_status adcs_vapi_get_sd_erase_prgrs(s_adcs_ctx *adcs_ctx,\
        s_adcs_erase_prgrs *erase_prgrs)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(SdProgress);

        // To verify valid payload present before copying to frame
        if(NULL != erase_prgrs)
        {
            // Request Telemetry data
            status = adcs_requesttlm(SdProgress,\
                    (uint8_t*)erase_prgrs, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Telecommand acknowledge
 */
e_adcs_status adcs_vapi_get_tc_ack(s_adcs_ctx *adcs_ctx,\
        s_adcs_tc_ack *tc_ack)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(TelecommandAcknowledge);

        // To verify valid payload present before copying to frame
        if(NULL != tc_ack)
        {
            // Request Telemetry data
            status = adcs_requesttlm(TelecommandAcknowledge,\
                    (uint8_t*)tc_ack, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get File Download Buffer with File Contents
 */
e_adcs_status adcs_vapi_get_file_dwnld(s_adcs_ctx *adcs_ctx,\
        s_adcs_file_dwnld_buffer *file_dwnld_buff)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(FileDownload);

        // To verify valid payload present before copying to frame
        if(NULL != file_dwnld_buff)
        {
            // Request Telemetry data
            status = adcs_requesttlm(FileDownload,\
                    (uint8_t*)file_dwnld_buff, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get File Download Buffer with File Contents
 */
e_adcs_status adcs_vapi_get_dwnld_blck_rdy(s_adcs_ctx *adcs_ctx,\
        s_adcs_dwnld_blck_ready *dwnld_blck_rdy)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    COMMON_DownloadBlockReady_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(DownloadBlockReady);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != dwnld_blck_rdy)
        {
            // Request Telemetry data
            status = adcs_requesttlm(DownloadBlockReady,\
                    (uint8_t*)data_buffer, data_len);
            COMMON_ExtractDownloadBlockReadyTlm(data_buffer, &returnVal);
            dwnld_blck_rdy->block_crc = returnVal.checksum;
            dwnld_blck_rdy->block_len = returnVal.length;
            dwnld_blck_rdy->parameter_error = returnVal.parameterError;
            dwnld_blck_rdy->ready = returnVal.ready;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get File information
 */
e_adcs_status adcs_vapi_get_file_info(s_adcs_ctx *adcs_ctx,\
        s_adcs_file_info *file_info)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    COMMON_FileInfo_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(FileInfo);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != file_info)
        {
            // Request Telemetry data
            status = adcs_requesttlm(FileInfo,\
                    (uint8_t*)data_buffer, data_len);
            COMMON_ExtractFileInfoTlm(data_buffer, &returnVal);
            file_info->busy_updating = returnVal.busyUpdating;
            file_info->file_crc = returnVal.checksum;
            file_info->file_counter = returnVal.fileCtr;
            file_info->file_data_time = returnVal.unixTime;
            file_info->file_size = returnVal.size;
            file_info->file_type = returnVal.fileType;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Initialize Upload Complete
 */
e_adcs_status adcs_vapi_get_initialize_upld_cmplt(s_adcs_ctx *adcs_ctx,\
        s_adcs_init_upld *init_upld_cmplt)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(InitializeUploadComplete);

        // To verify valid payload present before copying to frame
        if(NULL != init_upld_cmplt)
        {
            // Request Telemetry data
            status = adcs_requesttlm(InitializeUploadComplete,\
                    (uint8_t*)init_upld_cmplt, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Initialize Upload Complete
 */
e_adcs_status adcs_vapi_get_upld_blck_cmplt(s_adcs_ctx *adcs_ctx,\
        s_adcs_upld_blck_cmplt *upld_blck_cmplt)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    COMMON_UploadBlockComplete_t returnVal = {0};
    uint8 data_buffer = 0;
    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(UploadBlockComplete);

        // To verify valid payload present before copying to frame
        if(NULL != upld_blck_cmplt)
        {
            // Request Telemetry data
            status = adcs_requesttlm(UploadBlockComplete,\
                    (uint8_t*)&data_buffer, data_len);
            COMMON_ExtractUploadBlockCompleteTlm(&data_buffer, &returnVal);
            upld_blck_cmplt->busy = returnVal.busy;
            upld_blck_cmplt->error = returnVal.error;
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Block Checksum
 */
e_adcs_status adcs_vapi_get_blck_crc(s_adcs_ctx *adcs_ctx,\
        s_adcs_blck_crc *blck_crc)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(BlockChecksum);

        // To verify valid payload present before copying to frame
        if(NULL != blck_crc)
        {
            // Request Telemetry data
            status = adcs_requesttlm(BlockChecksum,\
                    (uint8_t*)blck_crc, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Bootloader State
 */
e_adcs_status adcs_vapi_get_btlr_state(s_adcs_ctx *adcs_ctx,\
        s_adcs_btlr_state *btlr_state)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    BOOTLOADER_State_t returnVal = {0};
    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = BOOTLOADER_GetTlmLen(State);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != btlr_state)
        {
            // Request Telemetry data
            status = adcs_requesttlm(State,\
                    data_buffer, data_len);
            BOOTLOADER_ExtractStateTlm(data_buffer, &returnVal);
            btlr_state->boot_reg_corrupt = returnVal.bootRegCorrupt;
            btlr_state->eeprom_err = returnVal.eepromError;
            btlr_state->ext_flash_err = returnVal.extFlashError;
            btlr_state->int_flash_err = returnVal.intFlashError;
            btlr_state->radio_comms_error = returnVal.radioCommsError;
            btlr_state->runtime = returnVal.runtime;
            btlr_state->sd_init_err = returnVal.sdInitError;
            btlr_state->sd_r_err = returnVal.sdReadError;
            btlr_state->sd_w_err = returnVal.sdWriteError;
            btlr_state->sram1_enabled = returnVal.sram1Enabled;
            btlr_state->sram2_enabled = returnVal.sram2Enabled;
            btlr_state->sram_latchup = returnVal.sramLatchup;
            btlr_state->sram_latchup_recovered =
                                returnVal.sramLatchupRecovered;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Program Information
 */
e_adcs_status adcs_vapi_get_prgrm_info(s_adcs_ctx *adcs_ctx,\
        s_adcs_prgm_info *prgrm_info)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = BOOTLOADER_GetTlmLen(ProgramInfo);

        // To verify valid payload present before copying to frame
        if(NULL != prgrm_info)
        {
            // Request Telemetry data
            status = adcs_requesttlm(ProgramInfo,\
                    (uint8_t*)prgrm_info, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Copy To Internal Flash Progress
 */
e_adcs_status adcs_vapi_get_cpy_intrnl_flsh_prgrs(s_adcs_ctx *adcs_ctx,\
        s_adcs_cpy_intrnl_flsh_prgrs *intrnl_flsh_prgrs)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    BOOTLOADER_CopyToIntFlashProgress_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 data_buffer = 0;

        // value assignment to variables
        data_len = BOOTLOADER_GetTlmLen(CopyToIntFlashProgress);

        // To verify valid payload present before copying to frame
        if(NULL != intrnl_flsh_prgrs)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CopyToIntFlashProgress,\
                    (uint8_t*)&data_buffer, data_len);
            BOOTLOADER_ExtractCopyToIntFlashProgressTlm(&data_buffer, \
                                        &returnVal);
            intrnl_flsh_prgrs->busy = returnVal.busy;
            intrnl_flsh_prgrs->error = returnVal.error;
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Fine Estimated Angular Rates
 */
e_adcs_status adcs_vapi_get_fine_est_anglr_rate(s_adcs_ctx *adcs_ctx,\
        s_adcs_est_rate *fine_est_anglr_rate)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(FineEstimRates);

        // To verify valid payload present before copying to frame
        if(NULL != fine_est_anglr_rate)
        {
            // Request Telemetry data
            status = adcs_requesttlm(FineEstimRates,\
                    (uint8_t*)fine_est_anglr_rate, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get JPG Conversion Progress
 */
e_adcs_status adcs_vapi_get_jpg_cnvrsn_prgrs(s_adcs_ctx *adcs_ctx,\
        s_adcs_jpg_cnvrsn_prgrs *jpg_cnvrsn_prgrs)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(ConversionProgress);

        // To verify valid payload present before copying to frame
        if(NULL != jpg_cnvrsn_prgrs)
        {
            // Request Telemetry data
            status = adcs_requesttlm(ConversionProgress,\
                    (uint8_t*)jpg_cnvrsn_prgrs, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Execution Times
 */
e_adcs_status adcs_vapi_get_exec_time(s_adcs_ctx *adcs_ctx,\
        s_adcs_exec_time *exec_time)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(AdcsExecTimes);

        // To verify valid payload present before copying to frame
        if(NULL != exec_time)
        {
            // Request Telemetry data
            status = adcs_requesttlm(AdcsExecTimes,\
                    (uint8_t*)exec_time, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get ACP Execution state
 */
e_adcs_status adcs_vapi_get_exec_state(s_adcs_ctx *adcs_ctx,\
        s_adcs_exec_state *exec_state)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(AcpLoopState);

        // To verify valid payload present before copying to frame
        if(NULL != exec_state)
        {
            // Request Telemetry data
            status = adcs_requesttlm(AcpLoopState,\
                    (uint8_t*)exec_state, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Image save status
 */
e_adcs_status adcs_vapi_get_img_sv_sts(s_adcs_ctx *adcs_ctx,\
        s_adcs_img_sv_sts *img_sts)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(ImageSaveStatus);

        // To verify valid payload present before copying to frame
        if(NULL != img_sts)
        {
            // Request Telemetry data
            status = adcs_requesttlm(ImageSaveStatus,\
                    (uint8_t*)img_sts, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Reaction wheel measurement
 */
e_adcs_status adcs_vapi_get_rw_speed_measure(s_adcs_ctx *adcs_ctx,\
        uint8_t rw_cnt, s_adcs_rw_speed *rw_measure)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(WheelSpeed);

        // To verify valid payload present before copying to frame
        if(NULL != rw_measure && R_WHEEL_3 >= rw_cnt)
        {
            // Request Telemetry data
            status = adcs_requesttlm(WheelSpeed,\
                    (uint8_t*)rw_measure, data_len);
        }
        else
        {
            status = TC_TM_ERROR;
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Control Mode
 */
e_adcs_status adcs_vapi_get_control_mode(s_adcs_ctx *adcs_ctx,\
        uint8 *cntrl_mode, u_control_mode_param *control_mode_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsState_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8* data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(CurrentAdcsState);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != cntrl_mode)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CurrentAdcsState,\
                    (uint8_t*)data_buffer, data_len);

            CUBEACP_ExtractCurrentAdcsStateTlm(data_buffer, &returnVal);

            os_memset(control_mode_param, 0, sizeof(u_control_mode_param));

            switch(returnVal.controlMode)
            {
            case ConModeSelect_ConXYZwheel:         // 3axis stabilization
            {
                *cntrl_mode =  ADCS_CTRL_MODE_THREE_AXIS;
                status = adcs_vapi_get_attitude(adcs_ctx,\
                    (s_adcs_attitude_angl*)&control_mode_param->attitude_ctrl);
            }
            break;
            case ConModeSelect_ConRWTargetTrack:    // Target tracking
            {
                *cntrl_mode = ADCS_CTRL_MODE_TARGET_TRACKING;
                status = adcs_vapi_get_target_track(adcs_ctx,\
                (s_adcs_trck_target*)&control_mode_param->target_track_ctrl);
            }
            break;
            case ConModeSelect_ConNone:                   // No control mode
            {
                *cntrl_mode = ADCS_CTRL_MODE_NONE;
            }
            break;
            case ConModeSelect_ConBdot:             // Detumbling
            {
                *cntrl_mode = ADCS_CTRL_MODE_DETUMBLING;
            }
            break;
            case ConModeSelect_ConYspin:   // Y Spin Stabilization
            {
                *cntrl_mode = ADCS_CTRL_MODE_Y_SPIN_STABILIZATION;
            }
            break;
            case ConModeSelect_ConRWSunTrack:           // Sun pointing
            {
                *cntrl_mode = ADCS_CTRL_MODE_SUN_POINTING;
            }
            break;
            default:               // Custom Control Mode selected
            {
                *cntrl_mode = returnVal.controlMode | 0x80;
            }
            break;
            }

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Magnetorquer command
 */
e_adcs_status adcs_vapi_get_mgntrqr_cmd(s_adcs_ctx *adcs_ctx,\
        s_adcs_mgntrqr_out *mgntrqr_cmd)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(MagTorquerCmd);

        // To verify valid payload present before copying to frame
        if(NULL != mgntrqr_cmd)
        {
            // Request Telemetry data
            status = adcs_requesttlm(MagTorquerCmd,\
                    (uint8_t*)mgntrqr_cmd, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Reaction wheel speed command
 */
e_adcs_status adcs_vapi_get_rw_speed_cmd(s_adcs_ctx *adcs_ctx,\
        uint8 rw_cnt, s_adcs_rw_speed *rw_cmd)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(SpeedCmd);

        // To verify valid payload present before copying to frame
        if(NULL != rw_cmd && R_WHEEL_3 >= rw_cnt)
        {
            // Request Telemetry data
            status = adcs_requesttlm(SpeedCmd,\
                    (uint8_t*)rw_cmd, data_len);
        }
        else
        {
            status = TC_TM_ERROR;
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Actuator commands
 */
e_adcs_status adcs_vapi_get_actuator_cmd(s_adcs_ctx *adcs_ctx,\
        s_adcs_actuator_cmd *actuator_cmd)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(ActuatorCmd);

        // To verify valid payload present before copying to frame
        if(NULL != actuator_cmd)
        {
            // Request Telemetry data
            status = adcs_requesttlm(ActuatorCmd,\
                    (uint8_t*)actuator_cmd, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Estimation Data
 */
e_adcs_status adcs_vapi_get_estimation_data(s_adcs_ctx *adcs_ctx,\
        s_adcs_estmiation_data *estm_data)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(EstimData);

        // To verify valid payload present before copying to frame
        if(NULL != estm_data)
        {
            // Request Telemetry data
            status = adcs_requesttlm(EstimData,\
                    (uint8_t*)estm_data, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Attitude quaternion estimated by Star tracker
 */
e_adcs_status adcs_vapi_get_star_qutr_attitude(s_adcs_ctx *adcs_ctx,\
        s_adcs_qutr_attitude *qutr_est_attitude)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(StarEstimQ);

        // To verify valid payload present before copying to frame
        if(NULL != qutr_est_attitude)
        {
            // Request Telemetry data
            status = adcs_requesttlm(StarEstimQ,\
                    (uint8_t*)qutr_est_attitude, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Attitude quaternion estimated by Star tracker
 */
e_adcs_status adcs_vapi_get_star_est_rates(s_adcs_ctx *adcs_ctx,\
        s_adcs_star_trckr_est_rates *est_rates)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(StarEstimRate);

        // To verify valid payload present before copying to frame
        if(NULL != est_rates)
        {
            // Request Telemetry data
            status = adcs_requesttlm(StarEstimRate,\
                    (uint8_t*)est_rates, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get calibarated ADCS sensor measurement
 */
e_adcs_status adcs_vapi_get_adcs_measurement(s_adcs_ctx *adcs_ctx,\
        s_adcs_measurement *adcs_measure)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(AdcsMeasure);

        // To verify valid payload present before copying to frame
        if(NULL != adcs_measure)
        {
            // Request Telemetry data
            status = adcs_requesttlm(AdcsMeasure,\
                    (uint8_t*)adcs_measure, data_len);
        }
        else
        {
            // No Action Retun failure
        }

    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get cache command
 */
e_adcs_status adcs_vapi_get_cache_cmd(s_adcs_ctx *adcs_ctx,\
        s_adcs_cache_cmd* cache)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(Cache);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != cache)
        {
            // Request Telemetry data
            status = adcs_requesttlm(Cache,\
                    data_buffer, data_len);
            COMMON_ExtractCacheTlm(data_buffer, (Boolean*)&cache->enabled);

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}


/**
 * @brief Function to get sram scrub settings
 */
e_adcs_status adcs_vapi_get_sram_scrub(s_adcs_ctx *adcs_ctx,\
        s_adcs_sram_scrub* sram_scrub)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(SramScrubSettings);

        // To verify valid payload present before copying to frame
        if(NULL != sram_scrub)
        {
            // Request Telemetry data
            status = adcs_requesttlm(SramScrubSettings,\
                    (uint8*)&sram_scrub->scrub_size, data_len);

        }
        else
        {
            // No Action Retun failure
        }
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}


/**
 * @brief Function to get save unix time to flash
 */
e_adcs_status adcs_vapi_get_utc_flash(s_adcs_ctx *adcs_ctx,\
        s_adcs_utc_flash *utc_flash)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    COMMON_UnixTimeSave_t retval ={0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(UnixTimeSave);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != utc_flash)
        {
            // Request Telemetry data
            status = adcs_requesttlm(UnixTimeSave,\
                    data_buffer, data_len);
            COMMON_ExtractUnixTimeSaveTlm(data_buffer, &retval);
            utc_flash->save_now = retval.saveNow;
            utc_flash->save_on_upt = retval.saveOnUpdate;
            utc_flash->save_periodic = retval.savePeriodic;
            utc_flash->period = retval.period;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get ASGP4 Params
 */
e_adcs_status adcs_vapi_get_asgp4_param(s_adcs_ctx *adcs_ctx,\
        s_adcs_asgp4_param *asgp4_param)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t retval ={0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(ASgp4Params);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != asgp4_param)
        {
            // Request Telemetry data
            status = adcs_requesttlm(ASgp4Params,\
                    data_buffer, data_len);
            CUBEACP_ExtractASgp4ParamsTlm(data_buffer, &retval);
            asgp4_param->ainclcoeff = retval.aInclCoeff;
            asgp4_param->araancoeff = retval.aRaanCoeff;
            asgp4_param->aecccoeff = retval.aEccCoeff;
            asgp4_param->aargpercoeff = retval.aArgPerCoeff;
            asgp4_param->atimecoeff = retval.aTimeCoeff;
            asgp4_param->aposcoeff = retval.aPosCoeff;
            asgp4_param->asgp4maxposerror = retval.asgp4MaxPosError;
            asgp4_param->asgp4filter = retval.asgp4Filter;
            asgp4_param->asgp4xp = retval.asgp4Xp;
            asgp4_param->asgp4yp = retval.asgp4Yp;
            asgp4_param->asgp4gpsrollover = retval.asgp4GpsRollover;
            asgp4_param->asgp4possdth = retval.asgp4PosSdTh;
            asgp4_param->asgp4velsdth = retval.asgp4VelSdTh;
            asgp4_param->asgp4minsat = retval.asgp4MinSat;
            asgp4_param->asgp4timegain = retval.asgp4TimeGain;
            asgp4_param->asgp4maxlag = retval.asgp4MaxLag;
            asgp4_param->asgp4minsamples = retval.asgp4MinSamples;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get user-coded controller and estimator parameters
 *        command.
 */
e_adcs_status adcs_vapi_get_user_ctrlr_est_sett(s_adcs_ctx *adcs_ctx,\
        s_adcs_user_ctrlr_est_sett *user_ctrlr_est)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsConfig_t retval ={0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(UserConEstParams);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != user_ctrlr_est)
        {
            // Request Telemetry data
            status = adcs_requesttlm(UserConEstParams,\
                    data_buffer, data_len);
            CUBEACP_ExtractUserConEstParamsTlm(data_buffer, &retval);
            memcpy(user_ctrlr_est->user_ctrlr_sett, retval.userConSettings, 48);
            memcpy(user_ctrlr_est->user_est_sett, retval.userEstSettings, 48);
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get SD Log1 configuration message
 */
e_adcs_status adcs_vapi_get_sdlog1_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_sdlog_cfg *sdlog1_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_LogSdConfig1_t retval;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(LogSdConfig1);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != sdlog1_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(LogSdConfig1,\
                    data_buffer, data_len);
            CUBEACP_ExtractLogSdConfig1Tlm(data_buffer, &retval);
            memcpy(sdlog1_cfg->log_sel, retval.logSelection, 10);
            sdlog1_cfg->period = retval.period;
            sdlog1_cfg->dest = retval.destination;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get SD Log2 configuration message
 */
e_adcs_status adcs_vapi_get_sdlog2_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_sdlog_cfg *sdlog2_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_LogSdConfig2_t retval;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(LogSdConfig2);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != sdlog2_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(LogSdConfig2,\
                    data_buffer, data_len);
            CUBEACP_ExtractLogSdConfig2Tlm(data_buffer, &retval);
            memcpy(sdlog2_cfg->log_sel, retval.logSelection, 10);
            sdlog2_cfg->period = retval.period;
            sdlog2_cfg->dest = retval.destination;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get UART Log configuration message
 */
e_adcs_status adcs_vapi_get_uart_log_cfg(s_adcs_ctx *adcs_ctx,\
        s_adcs_uart_log_cfg *uart_log_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_LogUartConfig_t retval;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(LogUartConfig);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != uart_log_cfg)
        {
            // Request Telemetry data
            status = adcs_requesttlm(LogUartConfig,\
                    data_buffer, data_len);
            CUBEACP_ExtractLogUartConfigTlm(data_buffer, &retval);
            memcpy(uart_log_cfg->selection, retval.selection, 10);
            uart_log_cfg->period = retval.period;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Hole Map 1 frame
 */
e_adcs_status adcs_vapi_get_hole_map1(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap* holemap1)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        uint8_t* temp = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(HoleMap1);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != holemap1)
        {
            // Request Telemetry data
            status = adcs_requesttlm(HoleMap1,\
                    data_buffer, data_len);
            COMMON_ExtractHoleMap1Tlm(data_buffer, temp);
            memcpy(holemap1->holemap, &temp, sizeof(temp));
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Hole Map 2 frame
 */
e_adcs_status adcs_vapi_get_hole_map2(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap2)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        uint8_t* temp = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(HoleMap2);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != holemap2)
        {
            // Request Telemetry data
            status = adcs_requesttlm(HoleMap2,\
                    data_buffer, data_len);
            COMMON_ExtractHoleMap2Tlm(data_buffer, temp);
            memcpy(holemap2->holemap, &temp, sizeof(temp));
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Hole Map 3 frame
 */
e_adcs_status adcs_vapi_get_hole_map3(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap3)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        uint8_t* temp = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(HoleMap3);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != holemap3)
        {
            // Request Telemetry data
            status = adcs_requesttlm(HoleMap3,\
                    data_buffer, data_len);
            COMMON_ExtractHoleMap3Tlm(data_buffer, temp);
            memcpy(holemap3->holemap, &temp, sizeof(temp));
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Hole Map 4 frame
 */
e_adcs_status adcs_vapi_get_hole_map4(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap4)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        uint8_t* temp = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(HoleMap4);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != holemap4)
        {
            // Request Telemetry data
            status = adcs_requesttlm(HoleMap4,\
                    data_buffer, data_len);
            COMMON_ExtractHoleMap4Tlm(data_buffer, temp);
            memcpy(holemap4->holemap, &temp, sizeof(temp));
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Hole Map 5 frame
 */
e_adcs_status adcs_vapi_get_hole_map5(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap5)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        uint8_t* temp = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(HoleMap5);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != holemap5)
        {
            // Request Telemetry data
            status = adcs_requesttlm(HoleMap5,\
                    data_buffer, data_len);
            COMMON_ExtractHoleMap5Tlm(data_buffer, temp);
            memcpy(holemap5->holemap, &temp, sizeof(temp));
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Hole Map 6 frame
 */
e_adcs_status adcs_vapi_get_hole_map6(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap6)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        uint8_t* temp = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(HoleMap6);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != holemap6)
        {
            // Request Telemetry data
            status = adcs_requesttlm(HoleMap6,\
                    data_buffer, data_len);
            COMMON_ExtractHoleMap6Tlm(data_buffer, temp);
            memcpy(holemap6->holemap, &temp, sizeof(temp));
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Hole Map 7 frame
 */
e_adcs_status adcs_vapi_get_hole_map7(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap7)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        uint8_t* temp = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(HoleMap7);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != holemap7)
        {
            // Request Telemetry data
            status = adcs_requesttlm(HoleMap7,\
                    data_buffer, data_len);
            COMMON_ExtractHoleMap7Tlm(data_buffer, temp);
            memcpy(holemap7->holemap, &temp, sizeof(temp));
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Hole Map 8 frame
 */
e_adcs_status adcs_vapi_get_hole_map8(s_adcs_ctx *adcs_ctx,\
        s_adcs_holemap *holemap8)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;
        uint8_t* temp = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(HoleMap8);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != holemap8)
        {
            // Request Telemetry data
            status = adcs_requesttlm(HoleMap8,\
                    data_buffer, data_len);
            COMMON_ExtractHoleMap8Tlm(data_buffer, temp);
            //memcpy(&holemap8->holemap, temp, sizeof(temp));
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get current unix time
 */
e_adcs_status adcs_vapi_get_crnt_unix_time(s_adcs_ctx *adcs_ctx,\
        s_adcs_time* utc_time)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;

        // value assignment to variables
        data_len = adcs_get_tlm_size(UnixTime);

        // To verify valid payload present before copying to frame
        if(NULL != utc_time)
        {
            // Request Telemetry data
            status = adcs_requesttlm(UnixTime,\
                    (uint8*)utc_time, data_len);
        }
        else
        {
            // No Action Retun failure
        }
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Commanded Attitude Angles
 */
e_adcs_status adcs_vapi_get_attitude(s_adcs_ctx *adcs_ctx,\
        s_adcs_attitude_angl* att_angle)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_CmdAttitude_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(CmdAttitude);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != att_angle)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CmdAttitude,\
                    data_buffer, data_len);
            CUBEACP_ExtractCmdAttitudeTlm(data_buffer, &returnVal);
            att_angle->pitch = returnVal.pitch;
            att_angle->roll = returnVal.roll;
            att_angle->yaw = returnVal.yaw;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get wheel currents
 */
e_adcs_status adcs_vapi_get_rw_current(s_adcs_ctx *adcs_ctx,\
        uint8 rw_cnt, s_adcs_rw_cur* rw_cur)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsPowerMeasure_t return_val = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(WheelCurrents);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != rw_cur && R_WHEEL_3 >= rw_cnt)
        {
            // Request Telemetry data
            status = adcs_requesttlm(WheelCurrents,\
                    data_buffer, data_len);
            CUBEACP_ExtractWheelCurrentsTlm(data_buffer, &return_val);
            rw_cur[0].rw_current = return_val.wheel1Current;
            rw_cur[1].rw_current = return_val.wheel2Current;
            rw_cur[2].rw_current = return_val.wheel3Current;
        }
        else
        {
            status = TC_TM_ERROR;
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get ADCS misc current measurements
 */
e_adcs_status adcs_vapi_get_misc_cur(s_adcs_ctx *adcs_ctx,\
        s_adcs_misc_cur* misc_cur)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsPowerMeasure_t returnval = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(AdcsMiscCurrents);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != misc_cur)
        {
            // Request Telemetry data
            status = adcs_requesttlm(AdcsMiscCurrents,\
                    data_buffer, data_len);
            CUBEACP_ExtractAdcsMiscCurrentsTlm(data_buffer, &returnval);
            misc_cur->cube_star_cur = returnval.cubeStarCurrent;
            misc_cur->magtorq_cur = returnval.magtorqCurrent;
            misc_cur->cube_star_temp = returnval.cubeStarTemp;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get ASGP4 TLEs telemetry
 */
e_adcs_status adcs_vapi_get_asgp4_tle(s_adcs_ctx *adcs_ctx,\
        s_adcs_asgp4_tle* asgp4_tle)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_Asgp4KepTle_t retval = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(Asgp4KepTle);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != asgp4_tle)
        {
            // Request Telemetry data
            status = adcs_requesttlm(Asgp4KepTle,\
                    data_buffer, data_len);
            CUBEACP_ExtractAsgp4KepTleTlm(data_buffer, \
                    &retval);
            asgp4_tle->asgp4_aop = retval.asgp4Aop;
            asgp4_tle->asgp4_bstar = retval.asgp4Bstar;
            asgp4_tle->asgp4_cmplt = retval.asgp4Complete;
            asgp4_tle->asgp4_ecc = retval.asgp4Ecc;
            asgp4_tle->asgp4_epoch = retval.asgp4Epoch;
            asgp4_tle->asgp4_incli = retval.asgp4Incli;
            asgp4_tle->asgp4_ma = retval.asgp4Ma;
            asgp4_tle->asgp4_mm = retval.asgp4Mm;
            asgp4_tle->asgp4_raan = retval.asgp4Raan;
            asgp4_tle->asgp_err = retval.asgpErr;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get star performance 2
 */
e_adcs_status adcs_vapi_get_star_perform2(s_adcs_ctx *adcs_ctx,\
        s_adcs_star_perform2* star_perform2)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_RawStarTracker_t returnval = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8 *data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(StarPerformance2);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != star_perform2)
        {
            // Request Telemetry data
            status = adcs_requesttlm(StarPerformance2,\
                    data_buffer, data_len);
            CUBEACP_ExtractStarPerformance2Tlm(data_buffer, &returnval);
            star_perform2->img_cptr_success = returnval.imageCaptureSuccess;
            star_perform2->detect_success = returnval.detectionSuccess;
            star_perform2->ident_success = returnval.identificationSuccess;
            star_perform2->att_success = returnval.attitudeSuccess;
            star_perform2->processing_time_err =
                                returnval.processingTimeError;
            star_perform2->trck_module_enabled =
                                  returnval.trackingModuleEnabled;
            star_perform2->prediction_enabled = returnval.predictionEnabled;
            star_perform2->comms_err = returnval.commsError;
            star_perform2->deltat = returnval.deltaT;
            star_perform2->s1conf = returnval.s1Conf;
            star_perform2->s2conf = returnval.s2Conf;
            star_perform2->s3conf = returnval.s3Conf;
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Estimation Mode
 */
e_adcs_status adcs_vapi_get_est_mode(s_adcs_ctx *adcs_ctx, uint8 *est_mode)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsState_t returnVal = {0};

    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 data_len = 0;
        uint8* data_buffer = NULL;

        // value assignment to variables
        data_len = adcs_get_tlm_size(CurrentAdcsState);
        data_buffer = os_malloc_eram(data_len);

        // To verify valid payload present before copying to frame
        if(NULL != est_mode)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CurrentAdcsState,\
                    (uint8_t*)data_buffer, data_len);

            CUBEACP_ExtractCurrentAdcsStateTlm(data_buffer, &returnVal);
            switch(returnVal.estimMode)
            {
            case EstimModeSelect_EstNone:
            {
                *est_mode = ADCS_EST_NONE;
            }
            break;
            case EstimModeSelect_EstMemsRate:
            {
                *est_mode = ADCS_EST_MEMS_RATE;
            }
            break;
            case EstimModeSelect_EstGyroEkf:
            {
                *est_mode = ADCS_EST_GYRO_EKF;
            }
            break;
            default:
            {
                *est_mode = returnVal.estimMode | 0x80;
            }
            break;
            }
        }
        else
        {
            // No Action Retun failure
        }
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get adcs sensors parameter
 */
e_adcs_status adcs_vapi_get_sensor_params(s_adcs_ctx *adcs_ctx,\
        e_adcs_sensor_type sensor_type,uint8_t sensor_id,\
        u_adcs_sensor_config *sensor_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint8 *data_buffer = NULL;
        uint16 data_len = 0;

        os_memset(sensor_cfg, 0, sizeof(u_adcs_sensor_config));
        switch(sensor_type) // Selecting Specific sensor for its payload length
        {
        case ADCS_MAG:          // Magnetometer
        {
            status = adcs_vapi_get_mgmtr_cfg(adcs_ctx, \
                        (s_adcs_mgmtr_cfg*)&sensor_cfg->magetometer_config);
        }
        break;
        case ADCS_COARSE_SUN:   // Coarse momentum sensor
        {
            // value assignment to variables
            data_len = adcs_get_tlm_size(CssConfig);
            data_buffer = (uint8*) os_malloc_eram(data_len);
            // Request Telemetry data
            status = adcs_requesttlm(CssConfig,&data_buffer[0], data_len);

            sensor_cfg->corase_config.css_conf = data_buffer[sensor_id];
            sensor_cfg->corase_config.css_scale = 
                data_buffer[sensor_id + 10] * 0.01;
            sensor_cfg->corase_config.css_min = data_buffer[sensor_id + 20];

            os_free(data_buffer);
        }
        break;
        case ADCS_NADIR_SENS:   // Nadir pointing sensor
        {
            status = adcs_vapi_get_nadir_cfg(adcs_ctx,\
                               (s_adcs_nadir_cfg*)&sensor_cfg->nadir_config);
        }
        break;
        case ADCS_RED_MAG:      // Redundant Magnetometer
        {
            status = adcs_vapi_get_red_mgmtr_cfg(adcs_ctx, \
                    (s_adcs_mgmtr_cfg*)&sensor_cfg->red_magetometer_config);
        }
        break;
        case ADCS_FINE_SUN:     // Fine momentum sensor
        {
            status = adcs_vapi_get_fss_cfg(adcs_ctx,\
                    (s_adcs_fss_cfg*)&sensor_cfg->fss_config);
        }
        break;
        case ADCS_STAR_SENS:    // Star tracking sensor
        {
            status = adcs_vapi_get_star_trkr_cfg(adcs_ctx, \
            (s_adcs_star_trkr_cfg*)&sensor_cfg->star_trkr_config);
        }
        break;
        default:                // Invalid type selected
        {
            status = OPERATION_FAILURE;
        }
        break;
        }
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get adcs acutator configuration parameter
 */
e_adcs_status adcs_vapi_get_actuator_params(s_adcs_ctx *adcs_ctx,\
        e_adcs_actuator_type actuator_type,uint8_t actuator_id,\
        u_adcs_acutator_config *actuator_cfg)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint8 *data_buffer = NULL;
        uint16 data_len = 0;

        os_memset(actuator_cfg, 0, sizeof(u_adcs_acutator_config));
        // Selecting Specific actuator for its payload length
        switch(actuator_type)
        {
        case ADCS_WHEEL:        // Reaction Wheel
        {
            status = adcs_vapi_get_rw_cfg(adcs_ctx,\
                    (s_adcs_rw_cfg*)&actuator_cfg->rwheel_config);
        }
        break;
        case ADCS_MAG_TORQUER:  // Magnetorquer
        {
            data_len = adcs_get_tlm_size(MagtorqConfig);
            data_buffer = os_malloc_eram(data_len);

            // Request Telemetry data
            status = adcs_requesttlm(MagtorqConfig,&data_buffer[0], data_len);
            actuator_cfg->magnotorque_config.mgntrqr_axis =
                    data_buffer[actuator_id];
            os_free(data_buffer);
        }
        break;
        case ADCS_THRUSTER:     // Thruster
        {
            /*
             * TODO Currently Thruster not yet planned will be updated in
             * future
             */
            status = OPERATION_FAILURE;
        }
        break;
        default:                // Invalid type selected
        {
            status = OPERATION_FAILURE;
        }
        break;
        }
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get Current ADCS State
 */
e_adcs_status adcs_vapi_get_state(s_adcs_ctx *adcs_ctx, \
        s_adcs_state* crnt_state)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    CUBEACP_AdcsState_t returnval = {0};


    // ADCS Context verification
    if(NULL != adcs_ctx)
    {
        // Variable declaration
        uint16 crnt_state1_len = 0;
        uint16 crnt_state2_len = 0;
        uint8* state1_data_buffer = NULL;
        uint8* state2_data_buffer = NULL;

        // value assignment to variables
        crnt_state1_len = adcs_get_tlm_size(CurrentAdcsState);
        crnt_state2_len = adcs_get_tlm_size(CurrentAdcsState2);
        state1_data_buffer = os_malloc_eram(crnt_state1_len);
        state2_data_buffer = os_malloc_eram(crnt_state2_len);

        // To verify valid payload present before copying to frame
        if(NULL != crnt_state)
        {
            // Request Telemetry data
            status = adcs_requesttlm(CurrentAdcsState,\
                    (uint8_t*)state1_data_buffer, crnt_state1_len);
            CUBEACP_ExtractCurrentAdcsStateTlm(state1_data_buffer, \
                    &returnval);

            crnt_state->asgp4_mode = returnval.asgp4Mode;
            crnt_state->cam1_3v3_ocur = returnval.cam1Overcurrent3V3;
            crnt_state->cam1_sns_busy_err = returnval.cam1SensNotIdle;
            crnt_state->cam1_sns_err = returnval.cam1SensDetectError;
            crnt_state->cam1_sram_ocur = returnval.cam1OvercurrentSram;
            crnt_state->cam2_3v3_ocur = returnval.cam2Overcurrent3V3;
            crnt_state->cam2_sns_busy_err = returnval.cam2SensNotIdle;
            crnt_state->cam2_sns_err = returnval.cam2SensDetectError;
            crnt_state->cam2_sram_ocur = returnval.cam2OvercurrentSram;
            crnt_state->css_err = returnval.cssError;
            crnt_state->ctrl_motor_comm_err =
                    returnval.cubeControlMotorCommsError;
            crnt_state->ctrl_motor_en = returnval.cubeControlMotorPower;
            crnt_state->ctrl_sig_comm_err =
                    returnval.cubeControlSignalCommsError;
            crnt_state->ctrl_sig_en = returnval.cubeControlSignalPower;
            crnt_state->cubesens1_comm_err = returnval.cubeSense1CommsError;
            crnt_state->cubesens2_comm_err = returnval.cubeSense2CommsError;
            crnt_state->cubesense1_en = returnval.cubeSense1Power;
            crnt_state->gps_lna_pwr_en = returnval.gpsLnaPower;
            crnt_state->gps_recv_en = returnval.gpsReceiverPower;
            crnt_state->mgntr_range_err = returnval.magRangeError;
            crnt_state->motor_driver_en = returnval.motorDriverPower;
            crnt_state->nadir_sns_range_err = returnval.nadirSensRangeError;
            crnt_state->rate_sns_range_err = returnval.rateSensRangeError;
            crnt_state->run_mode = returnval.adcsRunMode;
            crnt_state->rw1_comm_err = returnval.cubeWheel1CommsError;
            crnt_state->rw1_en = returnval.cubeWheel1Power;
            crnt_state->rw2_comm_err = returnval.cubeWheel2CommsError;
            crnt_state->rw2_en = returnval.cubeWheel2Power;
            crnt_state->rw3_comm_err = returnval.cubeWheel3CommsError;
            crnt_state->rw3_en = returnval.cubeWheel3Power;
            crnt_state->rw_spd_range_err = returnval.wheelSpeedRangeError;
            crnt_state->star_comm_err = returnval.cubeStarCommsError;
            crnt_state->star_en = returnval.cubeStarPower;
            crnt_state->star_trckr_match_err = returnval.starMatchError;
            crnt_state->star_trckr_ocur = returnval.starTrackOvercurrent;
            crnt_state->sun_above_horizon = returnval.sunAboveHorizon;
            crnt_state->sun_sns_range_err = returnval.sunSensRangeError;

            switch(returnval.estimMode)
            {
            case EstimModeSelect_EstNone:
            {
                crnt_state->att_est_mode = ADCS_EST_NONE;
            }
            break;
            case EstimModeSelect_EstMemsRate:
            {
                crnt_state->att_est_mode = ADCS_EST_MEMS_RATE;
            }
            break;
            case EstimModeSelect_EstGyroEkf:
            {
                crnt_state->att_est_mode = ADCS_EST_GYRO_EKF;
            }
            break;
            default:
            {
                crnt_state->att_est_mode = returnval.estimMode | 0x80;
            }
            break;
            }

            switch(returnval.controlMode)
            {
            case ConModeSelect_ConXYZwheel:    // 3axis stabilization
            {
                crnt_state->ctrl_mode =  ADCS_CTRL_MODE_THREE_AXIS;
            }
            break;
            case ConModeSelect_ConRWTargetTrack:    // Target tracking
            {
                crnt_state->ctrl_mode = ADCS_CTRL_MODE_TARGET_TRACKING;
            }
            break;
            case ConModeSelect_ConNone:             // No control mode
            {
                crnt_state->ctrl_mode = ADCS_CTRL_MODE_NONE;
            }
            break;
            case ConModeSelect_ConBdot:             // Detumbling
            {
                crnt_state->ctrl_mode = ADCS_CTRL_MODE_DETUMBLING;
            }
            break;
            case ConModeSelect_ConYspin:   // Y Spin Stabilization
            {
                crnt_state->ctrl_mode = ADCS_CTRL_MODE_Y_SPIN_STABILIZATION;
            }
            break;
            case ConModeSelect_ConRWSunTrack:           // Sun pointing
            {
                crnt_state->ctrl_mode = ADCS_CTRL_MODE_SUN_POINTING;
            }
            break;
            default:                       // Custom Control Mode selected
            {
                crnt_state->ctrl_mode = returnval.controlMode | 0x80;
            }
            break;
            }

            status = adcs_requesttlm(CurrentAdcsState2,\
                    (uint8_t*)state2_data_buffer, crnt_state2_len);
            CUBEACP_ExtractCurrentAdcsState2Tlm(state2_data_buffer, \
                    &returnval);

            crnt_state->orbit_param_invalid =
                    returnval.orbitParamsInvalidError;
            crnt_state->cfg_invalid = returnval.configInvalidError;
            crnt_state->ctrl_mode_chg_not_alwd =
                    returnval.controlModeNotAllowed;
            crnt_state->est_chg_not_alwd = returnval.estimatorNotAllowed;
            crnt_state->cur_mgntr_mode = returnval.curMagMode;
            crnt_state->magfield_model_err = returnval.magfieldModelError;
            crnt_state->node_reco_err = returnval.nodeRecoveryError;
            crnt_state->cubesense1_runt_err = returnval.cubeSense1RuntimeError;
            crnt_state->cubesense2_runt_err = returnval.cubeSense2RuntimeError;
            crnt_state->cubectrl_sig_runt_err =
                    returnval.cubeControlSignalRuntimeError;
            crnt_state->cubectrl_m_runt_err =
                    returnval.cubeControlMotorRuntimeError;
            crnt_state->rw1_runt_err = returnval.cubeWheel1RuntimeError;
            crnt_state->rw2_runt_err = returnval.cubeWheel2RuntimeError;
            crnt_state->rw3_runt_err = returnval.cubeWheel3RuntimeError;
            crnt_state->star_runt_err = returnval.cubeStarRuntimeError;
            crnt_state->mgntr_err = returnval.magnetometerError;
            crnt_state->rate_sns_fail = returnval.rateSensorFailure;

        }
        else
        {
            // No Action Retun failure
        }
        os_free(state1_data_buffer);
        os_free(state2_data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}

/**
 * @brief Function to get raw CSS measurement
 */
e_adcs_status adcs_vapi_get_raw_css(s_adcs_ctx *adcs_ctx,\
        uint8_t css_id, s_adcs_raw_css *raw_css)
{
    // Return variable assigning to FAIL status
    e_adcs_status status = OPERATION_FAILURE;
    if(NULL != adcs_ctx && NULL != raw_css)
    {
        // Variable declaration
        uint8 *data_buffer = NULL;
        uint16 data_len = 0;
        uint8 instance_cnt = 0;
        CUBEACP_RawSensor_t returnVal = {0};
        if(0 == css_id)
        {
            instance_cnt = 10;
        }
        else
        {
            instance_cnt = 1;
            css_id = css_id - 1;
        }

        os_memset(raw_css, 0, sizeof(s_adcs_raw_css)*instance_cnt);
        data_len = adcs_get_tlm_size(RawCss1);
        data_buffer = os_malloc_eram(data_len);

        status = adcs_requesttlm(RawCss1,\
                (uint8_t*)data_buffer, data_len);

        CUBEACP_ExtractRawCss1Tlm(data_buffer, &returnVal);

        status = adcs_requesttlm(RawCss2,\
                (uint8_t*)data_buffer, data_len);

        CUBEACP_ExtractRawCss2Tlm(data_buffer, &returnVal);

        os_memcpy(&raw_css->sample_ad, &returnVal.cssRaw1+css_id,\
                sizeof(s_adcs_raw_css)*instance_cnt);
        os_free(data_buffer);
    }
    else
    {
        // No Action Retun failure
    }
    return status;
}
