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

#include <stdlib.h>
#include "unittest.h"
#include "unittest/device/display/oled/ins_ut_oled.h"
#include "ins_mw_config.h"
#include "ins_pal_error_code.h"
#include "ins_comm_log.h"

#include "ins_dev_oled.h"

static int32_t InsUT_Device_OledOpen(int32_t argc, char **argv)
{
	InsDev_Oled_t * oled_dev = InsDev_Oled_Init(0);
    int32_t part = 0;

#if 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]);
	    }
	}
#endif
	
    if(argc < 1)
    {
        INSLOG_W("Input para not enough!\n open 0 -> open oled function\n");
        return INSERR_NG;
    }
    part = atoi(argv[0]);

    return (int32_t)oled_dev->open((InsDev_Oled_HOOK_ID_e)part);
}

static int32_t InsUT_Device_OledClose(int32_t argc, char **argv)
{
	InsDev_Oled_t * oled_dev = InsDev_Oled_Init(0);
    int32_t part = 0;

#if 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]);
	    }
	}
#endif
	
    if(argc < 1)
    {
        INSLOG_W("Input para not enough!\n close 0 -> close oled function\n");
        return INSERR_NG;
    }
    part = atoi(argv[0]);

    return (int32_t)oled_dev->close((InsDev_Oled_HOOK_ID_e)part);
}

static int32_t InsUT_Device_Show(int32_t argc, char **argv)
{
	InsDev_Oled_t * oled_dev = InsDev_Oled_Init(0);
    int32_t part = 0;

#if 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]);
	    }
	}
#endif
    if(argc < 1)
    {
        INSLOG_W("Input para not enough!\n");
		INSLOG_W("show 1 -> show picture 1\n");
		INSLOG_W("show 2 -> show picture 2\n");
		INSLOG_W("show 3 -> show picture 3\n");
		INSLOG_W("show 4 -> show picture 4\n");
        INSLOG_W("show 5 -> show picture 5\n");
		INSLOG_W("show 6 -> show off\n");
        INSLOG_W("show 7 -> show all light\n");
        return INSERR_NG;
    }
    part = atoi(argv[0]);
	
    return (int32_t)oled_dev->uinttest_show((InsDev_Oled_HOOK_ID_e)part);
}

InsUT_Unittest_CmdInfo_t g_ut_cmd_DevOled[INSUT_CMDCNT_DEV_OLED] = 
{
	{InsUT_Device_OledOpen,		0, NULL, "open",		"open oled"},
	{InsUT_Device_OledClose,    0, NULL, "close",       "close oled"},
	{InsUT_Device_Show,    		0, NULL, "show",		"show picture"},
};

