/*****************************************************************************
 * Copyright (C) 2018 SP Technology
 *              AISTB2 HAL implementation.
 *              SP Technology All Rights Reserved.
 *
 * Author: SP Technology
 * Date: 2019.01.14
 * Description:
 * Note:
 *****************************************************************************/

#ifndef HAL_FRONTPANEL_H_
#define HAL_FRONTPANEL_H_

#include "HAL_common.h"

#define HAL_FRONTPANEL_VERSION_100		100
#define HAL_FRONTPANEL_VERSION_LAST		102

#ifdef __cplusplus
extern "C" {
#endif

/**
 * led id.
 */
enum
{
	LED_POWER,
	LED_NETWORK,
	LED_AILED,
	LED_STATE,	//Definition for rcu keypressed
	LED_MAX,
};
/**
 * led state.
 */
enum
{
	LED_STATE_OFF = 0,
	LED_STATE_ON,
	LED_STATE_BLINK,
	LED_STATE_BOOT_UP,
	LED_STATE_BOOT_COMPLETE,
	LED_STATE_IDLE,
	
	LED_STATE_LISTEN_WAKEUP,				// 3-1 Wake-up
	LED_STATE_LISTEN_ACTIVE,				// 3-2 Listening Active
	LED_STATE_LISTEN_END,					// 3-3 Listening End
	LED_STATE_LISTEN_PROCESSING,			// 3-4 Processing
	LED_STATE_SPEAKING_SPEAKING,		// 4-1 Speaking			// 10
	LED_STATE_ERR_SPEAKING_SPEAKING,	// 4-2 Error Speaking
	LED_STATE_MIC_OFF,					// 5 Mic-Off			// 12
	LED_STATE_SPEAKER_MUTE,			// 6-1 Speaker Mute
	LED_STATE_SPEAKER_UNMUTE,		// 6-3 Volume up / unmute
	LED_STATE_SPEAKER_VOL_ZERO,		// 6-2 Volume Zero
	LED_STATE_SPEAKER_VOL_UP,		// 6-3 Volume up / unmute
	LED_STATE_SPEAKER_VOL_DOWN,		// 6-4 Volume down
	LED_STATE_SPEAKER_VOL_CONTINUOUS_CONTROL,		// 6-5 Volume continuous control
	LED_STATE_SYSTEM_ERR,					// 7 System Error
	LED_STATE_MIC_ON,					// 5-2 Mic-On			// 20
	
	LED_STATE_NUGU_CALL_OUTGOING = 100, 			// [NUGU CALL] 발신 시작
	LED_STATE_NUGU_CALL_INCOMING, 					// [NUGU CALL] 수신 시작
	LED_STATE_NUGU_CALL_ESTABLISHED, 				// [NUGU CALL] 전화 연결 됨 (수발신 공통)
	LED_STATE_NUGU_CALL_CLOSED, 					// [NUGU CALL] 통화가 정상적으로 종료됨
	LED_STATE_NUGU_CALL_CANCEL_BY_MT_BUSY, 			// [NUGU CALL] 상대방이 통화를 거부함
	LED_STATE_NUGU_CALL_CANCEL_BY_MO_BUSY, 			// [NUGU CALL] 상대방이 통화 중
	LED_STATE_NUGU_CALL_CANCEL_BY_MISSED_CALL, 		// [NUGU CALL] 상대방이 전화를 받지 않음
	LED_STATE_NUGU_CALL_CANCEL_BY_NETWORK_DROP, 	// [NUGU CALL] 네트웍이 불안정함
	LED_STATE_NUGU_CALL_CANCEL_BY_OEM_CALL, 		// [NUGU CALL] 상대방이 모바일일때 상대방의 전화로 OEM 전화가 수신되어 NUGU CALL 이 종료된 경우
	LED_STATE_NUGU_CALL_CANCEL_BY_INACTIVE, 		// [NUGU CALL] 상대방의 NUGU CALL 이 active 상태가 아님
	LED_STATE_NUGU_CALL_LOGOUT, 					// [NUGU CALL] 상대방이 NUGU 서비스에서 Logout 됨
	LED_STATE_NUGU_CALL_CANCEL_BY_POWER_OFF, 		// [NUGU CALL] 상대방의 기기가 모두 꺼져 있음
	LED_STATE_NUGU_CALL_CANCEL_BY_OUT_OF_SERVICE, 	// [NUGU CALL] 그외 기타 에러
	
	LED_STATE_TIMER_ON, 	// timer on
	LED_STATE_TIMER_OFF, 	// timer off
	LED_STATE_ALARM_ON, 	// alarm on
	LED_STATE_ALARM_OFF, 	// alarm off
	LED_STATE_BT_ON, 	// bluetooth on
	LED_STATE_BT_OFF, 	// bluetooth off
};

/**
 * led color.
 */
enum
{
    LED_COLOR_RED = 0,
    LED_COLOR_BLUE,
    LED_COLOR_GREEN,
    LED_COLOR_YELLOW,
    LED_COLOR_MARGENTA,
    LED_COLOR_VIOLET,
    LED_COLOR_EX1,
    LED_COLOR_EX2,
    LED_COLOR_EX3,
    LED_COLOR_EX4,
};



/**
 * get HAL interface version.
 */
int HAL_FrontPanelGetVersion();

/**
 * initialize front panel h/w interface.
 *
 * @return HAL_OK on success, other HAL_ERROR
 */
HAL_Error HAL_FrontPanelInit();

/**
 * de-initialize front panel h/w interface.
 *
 * @return HAL_OK on success, other HAL_ERROR
 */
HAL_Error HAL_FrontPanelDeinit();

/**
 * set LED on/off on front panel.
 *
 * @param index	Led id or 0 base index. see LED_XXX constants.
 * @param state new state of target led. see LED_STATE_XXX constants.
 *
 * @return HAL_OK on success, other HAL_ERROR
 */
HAL_Error HAL_FrontPanelSetLedState(int index, int state);

/**
 * set LED on/off on front panel.
 *
 * @param index	Led id or 0 base index. see LED_XXX constants.
 * @param state new state of target led. It is only for LED_STATE_SPEAKER_VOL_ZERO, LED_STATE_SPEAKER_VOL_UP,LED_STATE_SPEAKER_VOL_DOWN,LED_STATE_SPEAKER_VOL_CONTINUOUS_CONTROL.
 * @param volume volume value.
 * 
 * @return HAL_OK on success, other HAL_ERROR
 */
HAL_Error HAL_FrontPanelSetLedStateForVolume(int index, int state, int volume);


/**
 * set LED color on front panel.
 *
 * @param index Led id or 0 base index. see LED_XXX constants.
 * @param color color of target led. see LED_COLOR_XXX constants.
 *
 * @return HAL_OK on success, other HAL_ERROR
 */
HAL_Error HAL_FrontPanelSetLedColor(int index, int color);

/**
 * set Degree of Beamforming.
 *
 * @param index	Led id or 0 base index. see LED_XXX constants.
 * @param state new state of target led. see LED_STATE_XXX constants.
 * @param degree degree of beamforming. -60 ~ 60.
 * @return HAL_OK on success, other HAL_ERROR
 */
HAL_Error HAL_FrontPanelSetBeamformingDegree(int index, int state, int degree);

#ifdef __cplusplus
}
#endif

#endif
