/**
 *  @file ins_ut_gsensor.c
 *  @details config unit test
 *
 */

#include <stdlib.h>
#include "unittest.h"
#include "unittest/device/ins_ut_gsensor.h"
#include "ins_mw_config.h"
#include "ins_pal_error_code.h"
#include "ins_comm_log.h"

#include "ins_dev_gsensor.h"

static int32_t InsUT_Device_Gsensor_Open(int32_t argc, char **argv)
{
    InsDev_Gsensor_t * p_gsensor_dev = InsDev_Gsensor_Init(0);
    int32_t part = 0;

//	if(argc > 0)
//	{
//		INSLOG_E("argc = %d\n", argc);
//	    for(int i = 0; i < argc; i++)
//	    {
//	        INSLOG_E("argv[%d] = %s\n", i, argv[i]);
//	    }
//	}
    if(argc < 1)
    {
        INSLOG_W("Input para not enough!");
        INSLOG_W("open 0 -> open gsensor!");
        return INSERR_NG;
    }
    part = atoi(argv[0]);

    return (int32_t)p_gsensor_dev->open((AMBA_GSENSOR_NUM_e)part);
}

static int32_t InsUT_Device_Gsensor_Close(int32_t argc, char **argv)
{
    InsDev_Gsensor_t * p_gsensor_dev = InsDev_Gsensor_Init(0);
    int32_t part = 0;

//	if(argc > 0)
//	{
//		INSLOG_E("argc = %d\n", argc);
//	    for(int i = 0; i < argc; i++)
//	    {
//	        INSLOG_E("argv[%d] = %s\n", i, argv[i]);
//	    }
//	}
    if(argc < 1)
    {
        INSLOG_W("Input para not enough!");
        INSLOG_W("close 0 -> close gsensor!");
        return INSERR_NG;
    }
    part = atoi(argv[0]);

    return (int32_t)p_gsensor_dev->close((AMBA_GSENSOR_NUM_e)part);
}

InsUT_Unittest_CmdInfo_t g_ut_cmd_gsensor[INSUT_CMDCNT_GSENSOR] = 
{
    {InsUT_Device_Gsensor_Open,     0, NULL, "open",        "open gsensor"},
    {InsUT_Device_Gsensor_Close,    0, NULL, "close",       "close gsensor"},
};

