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

#include <unistd.h>
#include "exo_ahw_vdp_multifeep_thruster.h"
#include "morpheus_multifeep_thruster.h"
#include "exo_common.h"
extern ahw_io_map *ahw_io_lookup_tble[MAX_AH_INST_ID];
extern void *intf_inst_hdle_ptr[MAX_IO_INST_ID];

#ifndef LINUX_TEMP_PORT

/*!
 *  @brief I2C read hook function for morpheus thruster module
 */
int8_t thruster_i2c_read(void* intf_hdl, uint16_t slv_addr, uint8_t *data, uint8_t len)
{
    ioal_i2c_hdle *hi2c = (ioal_i2c_hdle*)intf_hdl;
    int8_t rslt;
        if(HAL_SCS == io_hal_i2c_receive(hi2c, (uint16)(slv_addr<<1), data, len, 500))
        {
            rslt = MULTIFEEP_SUCCESS;
        }
        else
        {
            rslt = MULTIFEEP_COM_FAIL;
         }

    return rslt;
}

/*!
 *  @brief I2C write hook function for morpheus thruster module
 */
int8_t thruster_i2c_write(void* intf_hdl, uint16_t slv_addr, uint8_t *data, uint8_t len)
{
    ioal_i2c_hdle *hi2c = (ioal_i2c_hdle*)intf_hdl;
    int8_t rslt;
        if(HAL_SCS == io_hal_i2c_transmit(hi2c, (uint16)(slv_addr<<1), data, len, 500))
        {
            rslt = MULTIFEEP_SUCCESS;
        }
        else
        {
            rslt = MULTIFEEP_COM_FAIL;
        }
    return rslt;
}
#endif

/*!
 *  @brief This API initalizes  and allocates the memory
 */
hal_ret_sts ahw_vdp_thruster_init(ahw_al_thruster_hdle *h_thrsut_sns)
{
    
    hal_ret_sts sts=HAL_MAX_ERR;
#ifdef LINUX_TEMP_PORT
    DEBUG_CPRINT(("\n EXO morpheus_thruster - AH-Vendor driver porting layer Initialise"));
    DEBUG_CPRINT(("\n EXO morpheus_thruster - AH-Vendor driver Initialise"));
    DEBUG_CPRINT(("\n EXO morpheus_thruster - AH-Vendor driver Initialisation completed successfully "));
    usleep(100000);
    DEBUG_CPRINT(("\n EXO morpheus_thruster - AH-Vendor driver porting layer initialisation completed successfully"));

#else

    multifeep_intf* h_thruster=(multifeep_intf*)malloc(sizeof(multifeep_intf));
    h_thruster->transmit = thruster_i2c_write;
    h_thruster->recieve = thruster_i2c_read;
    h_thruster->intf_hdl = intf_inst_hdle_ptr[ahw_io_lookup_tble[h_thrsut_sns->ahw_gen_info.ahw_inst_id]->io_instance_id];
    h_thruster->slv_addr=ahw_io_lookup_tble[h_thrsut_sns->ahw_gen_info.ahw_inst_id]->slv_addr;
    h_thrsut_sns->ahw_gen_info.vdp_inst_hdle = (void*)h_thruster;
    h_thrsut_sns->ahw_gen_info.io_intf_hdle=h_thruster->intf_hdl;

#endif
    return sts;
}

#ifndef LINUX_TEMP_PORT
/*!
 *  @brief This API is used to set the force in (micro Newton)
 */
hal_ret_sts ahw_vdp_thruster_unit_set_frc(ahw_al_thruster_hdle *h_thruster,uint8_t system_id,float force)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = h_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_unit_thruster_set_force(multifeep_hdl_vdp,system_id,force))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to reset the system
 */
hal_ret_sts ahw_vdp_thruster_reset(ahw_al_thruster_hdle *h_thruster)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = h_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_reset(multifeep_hdl_vdp))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to boot the system
 */
hal_ret_sts ahw_vdp_thruster_boot(ahw_al_thruster_hdle *h_thruster)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =h_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_boot(multifeep_hdl_vdp))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to set the on or off state
 */
hal_ret_sts ahw_vdp_thruster_unit_set_pwr_on_off(ahw_al_thruster_hdle *h_thruster,uint8_t system_id,uint8_t on_off)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = h_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_unit_set_pwr_on_off(multifeep_hdl_vdp,system_id,on_off))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to set the mode of the thruster
 */
hal_ret_sts ahw_vdp_thruster_unit_set_mode(ahw_al_thruster_hdle *h_thruster,uint8_t system_id,uint8_t mode)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = h_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_unit_thruster_set_mode(multifeep_hdl_vdp,system_id,mode))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to set the mode of system
 */
hal_ret_sts  ahw_vdp_thruster_set_mode(ahw_al_thruster_hdle *h_thruster,uint8_t system_id)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = h_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_set_mode(multifeep_hdl_vdp,system_id))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the mode of the system
 */
hal_ret_sts ahw_vdp_thruster_get_mode(ahw_al_thruster_hdle *h_thruster,uint8_t system_id,uint8_t *mode)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =h_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_mode(multifeep_hdl_vdp,system_id,mode))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the mode of thruster
 */
hal_ret_sts ahw_vdp_thruster_unit_get_mode(ahw_al_thruster_hdle *h_thruster,uint8_t system_id,uint8_t *mode)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = h_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_thruster_get_mode(multifeep_hdl_vdp,system_id,mode))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the status of the system
 */
hal_ret_sts ahw_vdp_thruster_get_sys_sts(ahw_al_thruster_hdle *h_thruster, uint8_t system_id,al_thruster_sts *info)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = h_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_system_get_status(multifeep_hdl_vdp,system_id,(multifeep_sts*)info))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the serial number of the system
 */
hal_ret_sts ahw_vdp_thruster_get_sys_srl_num(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *srl_num)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_system_get_serial_number(multifeep_hdl_vdp,system_id,srl_num))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the housekeeping1 data
 */
hal_ret_sts ahw_vdp_thruster_get_housekeeping1_data(ahw_al_thruster_hdle *al_thruster,al_thruster_housekeeping1 *info)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_housekeeping1_data(multifeep_hdl_vdp,(multifeep_housekeeping1*)info))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the housekeeping2 data
 */
hal_ret_sts ahw_vdp_thruster_get_housekeeping2_data(ahw_al_thruster_hdle *al_thruster,al_thruster_housekeeping2 *info,uint8_t system_id)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_housekeeping2_data(multifeep_hdl_vdp,(multifeep_housekeeping2*)info,system_id))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the housekeeping3 data
 */
hal_ret_sts ahw_vdp_thruster_get_housekeeping3_data(ahw_al_thruster_hdle *al_thruster,uint8_t *housekeeping3)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_housekeeping3_data(multifeep_hdl_vdp,housekeeping3))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the power status of the system
 */
hal_ret_sts ahw_vdp_thruster_unit_get_pwr_on_off(ahw_al_thruster_hdle *al_thruster,uint8_t *on_off,uint8_t system_id)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_unit_get_pwr_on_off(multifeep_hdl_vdp,on_off,system_id))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the force in (micro Newton)
 */
hal_ret_sts ahw_vdp_thruster_unit_get_frc(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *frc)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_unit_thruster_get_force(multifeep_hdl_vdp,system_id,frc))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the master time from housekeeping1 data
 */
hal_ret_sts ahw_vdp_thruster_get_mst_time(ahw_al_thruster_hdle *al_thruster,uint32_t *mst_tm)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_master_time(multifeep_hdl_vdp,mst_tm))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the backplane temperature
 */
hal_ret_sts ahw_vdp_thruster_get_bckplane_temp(ahw_al_thruster_hdle *al_thruster,uint8_t* bckpln_temp)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_backplane_temp(multifeep_hdl_vdp,bckpln_temp))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the total force of thruster
 */
hal_ret_sts ahw_vdp_thruster_get_bckplane_tot_frc(ahw_al_thruster_hdle *al_thruster,uint16_t* bckpln_frc)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_backplane_total_force(multifeep_hdl_vdp,bckpln_frc))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the total azimuthal angle
 */
hal_ret_sts ahw_vdp_thruster_get_tot_azimth_ang(ahw_al_thruster_hdle *al_thruster,uint16_t* tot_azmth)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_total_azimuthal_angle(multifeep_hdl_vdp,tot_azmth))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the total polar angle
 */
hal_ret_sts ahw_vdp_thruster_get_tot_polar_ang(ahw_al_thruster_hdle *al_thruster,uint8_t *tot_plr)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_total_polar_angle(multifeep_hdl_vdp,tot_plr))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the total power consumption
 */
hal_ret_sts ahw_vdp_thruster_get_tot_pwr_cnsp(ahw_al_thruster_hdle *al_thruster,uint16_t *pwr_cnsp)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_total_pwr_cnsp(multifeep_hdl_vdp,pwr_cnsp))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get unregulated voltage
 */
hal_ret_sts ahw_vdp_thruster_get_unreg_vol(ahw_al_thruster_hdle *al_thruster,uint8_t *unreg_vol)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_unreg_vol(multifeep_hdl_vdp,unreg_vol))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the remaining propellant
 */
hal_ret_sts ahw_vdp_thruster_get_remn_prplt(ahw_al_thruster_hdle *al_thruster,uint16_t *prplt)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_remn_prplt(multifeep_hdl_vdp,prplt))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the polar angle of the system
 */
hal_ret_sts ahw_vdp_thruster_get_unit_polar_ang(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *polar)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_unit_polar_angle(multifeep_hdl_vdp,system_id,polar))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the azimuthal angle of the system
 */
hal_ret_sts ahw_vdp_thruster_get_unit_azimth_ang(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *azimuthal)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_unit_azimuthal_angle(multifeep_hdl_vdp,system_id,azimuthal))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the power-consumption of the system
 */
hal_ret_sts ahw_vdp_thruster_get_unit_pwr(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *power)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_unit_pwr(multifeep_hdl_vdp,system_id,power))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the reset status
 */
hal_ret_sts ahw_vdp_thruster_get_rst_sts(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *rst_sts)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_rst_sts(multifeep_hdl_vdp,system_id,rst_sts))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the total power
 */
hal_ret_sts ahw_vdp_thruster_get_tot_pwr(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *pwr)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_total_pwr(multifeep_hdl_vdp,system_id,pwr))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the unregulated Voltage
 */
hal_ret_sts ahw_vdp_thruster_get_unreg_volt(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *unreg_vol)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_unreg_voltage(multifeep_hdl_vdp,system_id,unreg_vol))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the ON status of the device
 */
hal_ret_sts ahw_vdp_thruster_get_dev_on_sts(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *dev_sts)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_device_on_sts(multifeep_hdl_vdp,system_id,dev_sts))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the reset status
 */
hal_ret_sts ahw_vdp_thruster_get_unit_rst_sts(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *rst_sts)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_unit_rst_sts(multifeep_hdl_vdp,system_id,rst_sts))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the board temperature
 */
hal_ret_sts ahw_vdp_thruster_get_brd_temp(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *temp)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_board_temp(multifeep_hdl_vdp,system_id,temp))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the remaining propellant
 */
hal_ret_sts ahw_vdp_thruster_get_unit_prplt(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *prplt)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_unit_prplt(multifeep_hdl_vdp,system_id,prplt))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the unregulated voltage
 */
hal_ret_sts ahw_vdp_thruster_get_ureg_volt(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *unreg_vol)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_ureg_voltage(multifeep_hdl_vdp,system_id,unreg_vol))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the calibration values
 */
hal_ret_sts ahw_vdp_thruster_get_calib(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint32_t *calib)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_calibration(multifeep_hdl_vdp,system_id,calib))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the heater error code
 */
hal_ret_sts ahw_vdp_thruster_get_heat_err_code(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *err_cde)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_heater_err_code(multifeep_hdl_vdp,system_id,err_cde))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the duty cycle of the heater
 */
hal_ret_sts ahw_vdp_thruster_get_heat_duty_cycle(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *duty_cycle)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_heater_duty_cycle(multifeep_hdl_vdp,system_id,duty_cycle))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the temperature of heater
 */
hal_ret_sts ahw_vdp_thruster_get_heat_temp(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,int8_t *temp)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_heater_temp(multifeep_hdl_vdp,system_id,temp))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the target temperature of heater
 */
hal_ret_sts ahw_vdp_thruster_get_heat_trgt_temp(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,int8_t *trgt_temp)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_heater_target_temp(multifeep_hdl_vdp,system_id,trgt_temp))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the emitter voltage
 */
hal_ret_sts ahw_vdp_thruster_get_emit_volt(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *emt_vol)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_emitter_voltage(multifeep_hdl_vdp,system_id,emt_vol))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the emitter current
 */
hal_ret_sts ahw_vdp_thruster_get_emit_cur(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *emt_cur)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_emitter_current(multifeep_hdl_vdp,system_id,emt_cur))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the emitter input current
 */
hal_ret_sts ahw_vdp_thruster_get_emit_inp_cur(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *emt_ip_cur)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_emitter_input_current(multifeep_hdl_vdp,system_id,emt_ip_cur))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the extractor voltage
 */
hal_ret_sts ahw_vdp_thruster_get_ext_volt(ahw_al_thruster_hdle *al_thruster,uint8_t ext_id,uint8_t system_id,uint16_t *ext_vol)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_extractor_voltage(multifeep_hdl_vdp,ext_id,system_id,ext_vol))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the extractor current
 */
hal_ret_sts ahw_vdp_thruster_get_ext_cur(ahw_al_thruster_hdle *al_thruster,uint8_t ext_id,uint8_t system_id,uint16_t *ext_cur)//
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp =  al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_extractor_current(multifeep_hdl_vdp,ext_id,system_id,ext_cur))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the extractor input current
 */
hal_ret_sts ahw_vdp_thruster_get_ext_inp_cur(ahw_al_thruster_hdle *al_thruster,uint8_t ext_id,uint8_t system_id,uint16_t *ext_ip_cur)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_extractor_input_current(multifeep_hdl_vdp,ext_id,system_id,ext_ip_cur))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the neutralizer voltage
 */
hal_ret_sts ahw_vdp_thruster_get_neutlr_volt(ahw_al_thruster_hdle *al_thruster,uint8_t neut_id,uint8_t system_id,uint16_t *neut_vol)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_neutralizer_voltage(multifeep_hdl_vdp,neut_id,system_id,neut_vol))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the neutralizer current
 */
hal_ret_sts ahw_vdp_thruster_get_neutlr_cur(ahw_al_thruster_hdle *al_thruster,uint8_t neut_id,uint8_t system_id,uint16_t *neut_cur)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_neutralizer_current(multifeep_hdl_vdp,neut_id,system_id,neut_cur))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the neutralizer input current
 */
hal_ret_sts ahw_vdp_thruster_get_neutlr_inp_cur(ahw_al_thruster_hdle *al_thruster,uint8_t neut_id,uint8_t system_id,uint16_t *neut_ip_cur)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_neutralizer_input_current(multifeep_hdl_vdp,neut_id,system_id,neut_ip_cur))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the neutralizer return current
 */
hal_ret_sts ahw_vdp_thruster_get_neutlr_retn_cur(ahw_al_thruster_hdle *al_thruster,uint8_t neut_id,uint8_t system_id,uint16_t *neut_ret_cur)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_neutralizer_return_current(multifeep_hdl_vdp,neut_id,system_id,neut_ret_cur))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the major version number
 */
hal_ret_sts ahw_vdp_thruster_get_mjr_vers_no(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *mjr_vers_no)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_major_vers_no(multifeep_hdl_vdp,system_id,mjr_vers_no))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the minor version number
 */
hal_ret_sts ahw_vdp_thruster_get_mnr_vers_no(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *mnr_vers_no)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_minor_vers_no(multifeep_hdl_vdp,system_id,mnr_vers_no))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the patch version number
 */
hal_ret_sts ahw_vdp_thruster_get_patch_vers_no(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint16_t *ptch_vers_no)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_patch_vers_no(multifeep_hdl_vdp,system_id,ptch_vers_no))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the board error code
 */
hal_ret_sts ahw_vdp_thruster_get_brd_err_cde(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *err_cde)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_board_err_cde(multifeep_hdl_vdp,system_id,err_cde))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the error counter
 */
hal_ret_sts ahw_vdp_thruster_get_err_count(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint8_t *err_count)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_err_counter(multifeep_hdl_vdp,system_id,err_count))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}

/*!
 *  @brief This API is used to get the start time
 */
hal_ret_sts ahw_vdp_thruster_get_strt_time(ahw_al_thruster_hdle *al_thruster,uint8_t system_id,uint32_t *strt_time)
{
	hal_ret_sts sts;
	multifeep_intf *multifeep_hdl_vdp;
	multifeep_hdl_vdp = al_thruster->ahw_gen_info.vdp_inst_hdle;
	if(HAL_SCS == (hal_ret_sts)multifeep_get_strt_time(multifeep_hdl_vdp,system_id,strt_time))
	    {
	        sts=HAL_SCS;
	    }
    else
	    {
	        sts=HAL_AH_DRIVER_ERR;
	    }
    return sts;
}
#endif
