#ifndef __IKONKE_MODULE_FACTORY_TEST_H_______________________
#define __IKONKE_MODULE_FACTORY_TEST_H_______________________

#include "app/framework/include/af.h"
#include "ikk-module-def.h"
#include "ikk-debug.h"
#include "../driver/ikk-button.h"
#include "ikk-command.h"
#include "../driver/ikk-uart.h"
//使能debug快速测试老化
#define AGING_DEBUG                 			false
//可以最多两个按钮可以退出老化
#define AGING_EXIT_MAX_BTN_NUM					2


//按键强制退老化时，长按次数，比如铂金10A/16A插座的触摸按键长按5S两次退老化，轻触机械按键只要1次20S
#define LONG_PRESS_1_TIMES						1
#define LONG_PRESS_2_TIMES						2
//强制退老化时间
#define TOUCH_KEY_LONG_PRESS_TIME_MS			(5 * 1000)
#define MECHANICAL_KEY_LONG_PRESS_TIME_MS		(20 * 1000)

#define FIRST_BTN_LONG_PRESSED_VALIED_TIME_MS	(10 * 1000)

#define FACTORY_TEST_POLL_TTME_1S				(1 * 1000)
#define FACTORY_TEST_POLL_TTME_10S				(10 * 1000)
#define FACTORY_TEST_POLL_TIMES					(FACTORY_TEST_POLL_TTME_10S / FACTORY_TEST_POLL_TTME_1S)
#if AGING_DEBUG
#define FACTORY_TEST_15MIN_MS					(1 * 60 * 1000)
#define FACTORY_TEST_4HOU_MS					(4 * 1 * 60 * 1000)
#else
#define FACTORY_TEST_15MIN_MS					(15 * 60 * 1000)
#define FACTORY_TEST_4HOU_MS					(4 * 60 * 60 * 1000)
#endif
#define FACTORY_TEST_1S							(1000)

typedef enum{
	FTS_NORMAL=0,
	FTS_START,
	FTS_AGING_15MIN,
	FTS_AGING_8HOU_START,
	FTS_AGING_8HOU,
	FTS_AGING_DONE,
	FTS_FORCE_EXIT,
	FTS_WAITING_RELEASED,//waiting key released
	FTS_FORCE_REBOOT,
	FTS_FIRST_LONG_PRESSED,
	FTS_WAITING_SECOND_PRESS,
	FTS_SINGLE_BOARD_TEST,
	FTS_FULL_DEVICE_TEST,
	FTS_SINGLE_BOARD_TEST_DONE,
	FTS_FULL_DEVICE_TEST_DONE,
}FactoryTestStatusEnum;

typedef struct{
	uint8_t u8BtnId;
	uint8_t u8BtnLongPressTimes; //touch keys must be long pressed 2 times, mechanical keys is pressed 1 time
	uint32_t u32AgingForceExitTimeMs;  //key long pressed time for  exit aging test
}FactoryTestConfSt;

//10S轮询操作函数，可根据不同长供电产品自定义实现
typedef void (*pFactoryTestPollCallback)(FactoryTestStatusEnum status);

//获取当前产测状态
FactoryTestStatusEnum kGetFactoryTestStatus(void);
//void  kGetFactoryTestBtnAction(uint8_t btn_id, BtnActionEnum action);
void kFactoryTestInit(pFactoryTestPollCallback callback, FactoryTestConfSt conf_list[], uint8_t btn_num, uint8_t led_id);

void kkFactoryMsgInComingCallBack(UMsgNodeSt *pMsgNode);
#endif

