package atservice

const MATRIX_LAMP_NUM = 81 /*9x9 矩阵灯个数*/

type LAMP_TYPE uint8

const (
	LAMP_TYPE_ALL    LAMP_TYPE = 0 //全部
	LAMP_TYPE_GUIDE  LAMP_TYPE = 1 //指向灯
	LAMP_TYPE_MATRIX LAMP_TYPE = 2 //矩阵灯
)

type BrightnessCtrlT struct {
	LampType          LAMP_TYPE //lamp type, 定义在LAMP_TYPE_ENUM中
	BrightnessPercent uint8     //最大亮度值百分比，取值在0-100，100%即默认最大亮度。
}

type GUIDE_ACTION uint8

const (
	GUIDE_ACTION_NONE  GUIDE_ACTION = 0
	GUIDE_ACTION_START GUIDE_ACTION = 1 //指向灯开始
	GUIDE_ACTION_STOP  GUIDE_ACTION = 2 //指向灯结束
)

const (
	FADE_NONE    = 0 //无淡入或者无淡出参数控制，而以实际效果为准
	FADE_DISABLE = 1 //无渐变呼吸效果过程
	FADE_ENABLE  = 2 //有渐变呼吸效果过程
)

type GUIDE_EFFECT_ID uint8

const (
	GUIDE_EFFECT_ID_NONE            GUIDE_EFFECT_ID = 0
	GUIDE_EFFECT_ID_INIT            GUIDE_EFFECT_ID = 1  //初始化灯
	GUIDE_EFFECT_ID_INIT_FAIL       GUIDE_EFFECT_ID = 2  //初始化灯失败
	GUIDE_EFFECT_ID_BLE_PROGRESS    GUIDE_EFFECT_ID = 5  //进入BLE模式进度反馈灯
	GUIDE_EFFECT_ID_SOFTAP_PROGRESS GUIDE_EFFECT_ID = 6  //进入soft AP 进度反馈
	GUIDE_EFFECT_ID_NET_MODE        GUIDE_EFFECT_ID = 7  //联网模式辅助
	GUIDE_EFFECT_ID_BLE_MODE        GUIDE_EFFECT_ID = 10 //联网模式灯
	GUIDE_EFFECT_ID_SOFTAP_MODE     GUIDE_EFFECT_ID = 11 //Soft AP模式灯
	GUIDE_EFFECT_ID_NETTING         GUIDE_EFFECT_ID = 15 //联网中
	GUIDE_EFFECT_ID_NET_SUCCESS     GUIDE_EFFECT_ID = 16 //联网成功
	GUIDE_EFFECT_ID_NET_FAIL        GUIDE_EFFECT_ID = 17 //联网失败
	GUIDE_EFFECT_ID_NO_NET          GUIDE_EFFECT_ID = 18 //网络未连接灯
	GUIDE_EFFECT_ID_VOICE_WAKEUP    GUIDE_EFFECT_ID = 30 //唤醒灯
	GUIDE_EFFECT_ID_VOICE_INPUT     GUIDE_EFFECT_ID = 31 //输入灯
	GUIDE_EFFECT_ID_THINKING        GUIDE_EFFECT_ID = 32 //识别等待灯
	GUIDE_EFFECT_ID_EXEC_CMD        GUIDE_EFFECT_ID = 33 //执行灯, notice:如果有伴随调节的需求,一定要先调整音量再调用执行灯开启
	GUIDE_EFFECT_ID_MIC_OFF         GUIDE_EFFECT_ID = 40 //禁Mic灯
	GUIDE_EFFECT_ID_VOLUME_ADJUST   GUIDE_EFFECT_ID = 41
	GUIDE_EFFECT_ID_SYSTEM_ERR      GUIDE_EFFECT_ID = 60 //错误灯
	GUIDE_EFFECT_ID_CLEAR           GUIDE_EFFECT_ID = 163
	GUIDE_EFFECT_ID_MIC_STAT_OFF    GUIDE_EFFECT_ID = 227 //mic status on/off
	GUIDE_EFFECT_ID_DO_NOTHING      GUIDE_EFFECT_ID = 255
)

type GuideLampEffectT struct {
	EffectID     GUIDE_EFFECT_ID //效果ID, 参考GUIDE_EFFECT_ID_ENUM
	Action       GUIDE_ACTION    //执行动作
	FadeIn       uint8           //是否淡入
	FadeOut      uint8           //是否淡出
	StartLampNum uint8           //开始亮灯位置，1-24,0视情况而定
	DataLen      uint16          //扩展数据大小
	Data         []byte          //数据
}

type VolumeT struct {
	MaxVolume uint8 //最大音量
	CurVolume uint8 //当前音量大小
}

type MatrixLampAnimationT struct {
	RepeatTimes uint8  //循环次数
	FrameNums   uint8  //总帧数
	FrameBytes  uint16 //一帧数据字节数
	FrameDelay  uint16 //帧延迟时间，单位为1ms
	Data        []byte //数据
}

const (
	// animation will loop forever
	MATRIX_ANIMATION_LOOP_FOREVER = 0x00

	// if delay of animation is forever,
	// we just display the first frame of animation
	// and keep it forever
	MATRIX_ANIMATION_DELAY_FOREVER = 0xFF

	// breath will loop forever
	MATRIX_BREATH_LOOP_FOREVER = 0x00

	// keep on or off phase forever
	MATRIX_BREATH_ON_OFF_FOREVER = 0xFFFF
)

type ICON_INSERT_MODE uint8

const (
	NEW_ICON_MODE    ICON_INSERT_MODE = 0 //切换新ICON，立即执行旧ICON的T3，T3执行完毕后，切换到新ICON
	INSERT_ICON_MODE ICON_INSERT_MODE = 1 //插入新ICON，显示完成后，恢复旧ICON显示
	CLOSE_ICON_MODE  ICON_INSERT_MODE = 2 //关闭ICON显示
)

type MatrixLampGradientT struct {
	RepeatTimes uint8            //循环次数
	FrameNums   uint8            //总帧数
	FrameBytes  uint16           //一帧数据字节数
	InsertMode  ICON_INSERT_MODE //插入模式
	T1          uint16           //上升时间
	T2          uint16           //亮保持时间
	T3          uint16           //下降时间
	T4          uint16           //暗保持时间
	Data        []byte           //数据
}

type MATRIX_MUSIC_MODE uint8

const (
	MATRIX_MUSIC_PLAY_NONE   MATRIX_MUSIC_MODE = 0
	MATRIX_MUSIC_PLAY_SYNC   MATRIX_MUSIC_MODE = 1 //圆形
	MATRIX_MUSIC_PLAY_FILTER MATRIX_MUSIC_MODE = 2 //九段
	MATRIX_MUSIC_PLAY_LINE   MATRIX_MUSIC_MODE = 3 //一条线
	MATRIX_SPEAK_PLAY_LINE   MATRIX_MUSIC_MODE = 4 //speak一条线
)

type MatrixLampMusicPlayT struct {
	mode        MATRIX_MUSIC_MODE //显示模式，圆形，九段
	volumeLevel uint8             //当前音量等级
}

//--------------------------factory test---------------------
type GuideLampTestInfoT struct {
	red   uint8 //取值范围0-63
	green uint8 //取值范围0-63
	blue  uint8 //取值范围0-63
}

type MatrixLampTestInfoT struct {
	Brightnesslevel uint8 //取值范围0-63
}
