
/**
  ******************************************************************************
  * @file    BLV_485_Dev_LEDFun.c
  * @author  BLW RCU  development Team
  * @version 
  * @date    2022年05月23日
  * @brief  
	*    C主机音乐控制  接口函数
	* @log  202205231001   SongHan   配置工具按键音量设置，门铃音量和欢迎词音量设置，设置时，需置保存标志
  ******************************************************************************
  */

#include "BLV_BUS_Dev_C5MusicFun.h"
#include "SPI_SRAM.h"
#include "check_fun.h"
#include "string.h"
#include "usart.h"
#include "DBG.h"
#include "CH57x_common.h"
#include "rtc.h"
#include "rw_logging.h"
#include "SRAM_Variable_Address.h"
#include "Log_api.h"


//#define C5IO_MUSIC_CH_MAX  0x01    //背景音乐有效回路数
#define MUSICVOICELEVELMAX          10    //音乐音量最大级别，用于音量保存和上报
#define MUSICVOICELEVELMIN          01    //音乐音量最小级别，用于音量保存和上报

#define MUSIC_PLAY     		1         //音乐播放
#define MUSIC_STOP    		2					//音乐暂停
#define MUSIC_PRE      		3					//上一曲
#define MUSIC_NEX      		4					//下一曲
//#define MUSIC_PLAY_MODE		5					//进入播放模式
#define MUSIC_VOICE_UP		5					//音量加
#define MUSIC_VOICE_DOWN	6					//音量减
#define MUSIC_VOICE_ALW_UP 7       //音量一直加
#define MUSIC_VOICE_ALW_DOWN 8     //音量一直减
#define MUSIC_VOICE_STOP 9         //音量加减停止

#define C5MUCSIC_RecvData_Len_Max	0x20


uint16_t Dev_Music_Loop_State(uint32_t devaddr, uint16_t DevOutputLoop);

uint8_t sd_log_flag = 0;


/*******************************************************************************
* Function Name  : BLV_BUS_C5MUSIC_For_Logic_Init 
* Description    : C5 MUSIC设备信息初始化函数
*******************************************************************************/
void BLV_BUS_C5MUSIC_For_Logic_Init(LOGICFILE_DEVICE_INFO *dev_info,uint8_t *data,uint16_t data_len)
{
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;

	memset(&BUS_Public,0,sizeof(Device_Public_Information_G));
	memset(&C5Music_Info,0,sizeof(BUS_C5MUSIC_INFO));
	
	BUS_Public.addr = 0x01;						//设备地址 - 默认地址
	BUS_Public.type = DEV_C5MUSIC_Type;			//设备类型
	BUS_Public.port = 0x03;						//设备发送端口
	BUS_Public.baud = 115200;					//设备发送波特率
	BUS_Public.retry_num = C5MUSIC_REPEATSENDTIMEMAX;		//设备数据重发次数
	BUS_Public.wait_time = C5MUSIC_SEND_WAIT_TIME;		//设备数据发送等待回复时间
	BUS_Public.polling_cf = (uint32_t)&BLV_BUS_C5MUSIC_Cycle_Call;
	BUS_Public.processing_cf = (uint32_t)&BLV_BUS_C5MUSIC_Data_Processing;
	BUS_Public.Protocol = dev_info->version;
	
	BUS_Public.DevFunInfo.Dev_Output_Ctrl = Logic_Music_Ctrl;    //
	
	BUS_Public.DevFunInfo.Dev_Output_Loop_State_Get = Dev_Music_Loop_State;
	C5Music_Info.DevOfflineLast = DEV_IS_ONLINE;   //在线状态初始化
	C5Music_Info.DevOffline = C5Music_Info.DevOfflineLast;
	C5Music_Info.now_playback_type = 0x01;		//默认为房间音乐
	C5Music_Info.default_volume = BLV_C5MUSIC_Default_Volume;
	C5Music_Info.fade_time = 0x01;				//渐变时间 - 100ms
	C5Music_Info.quite_flag = 0x02;
//	C5Music_Info.now_playback_status = 0x01;
	
	C5Music_Info.playback_mode = BLV_C5MUSIC_Folder_Loop;
	C5Music_Info.control_flag |= C5MUSIC_Set_Loop_Mode_Flag;
	
/*背景音乐参数初始化开始*/	
	C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice = 0x03;     //最大为10   上电为3
	C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice = 0x03;     //最大为10   上电为3
	C5Music_Info.BackMusicState[2].CtrlCont.CtrlVoice = 0x03;     //最大为10   上电为3
	C5Music_Info.BackMusicState[3].CtrlCont.CtrlVoice = 0x03;     //最大为10   上电为3        2025-08-22
/*背景音乐参数初始化结束*/

	C5Music_Info.adjust_volume_type |= 0x12 ;	//设置回路音量和全局音量
	C5Music_Info.set_music_volume = C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice*3; //0x1A;
	C5Music_Info.set_tone_volume = C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice*3; //0x1A;
	C5Music_Info.set_door_volume = C5Music_Info.BackMusicState[2].CtrlCont.CtrlVoice*3;   //0x1B
//	C5Music_Info.set_helpsleep_volume = C5Music_Info.BackMusicState[3].CtrlCont.CtrlVoice*3; //0x1A;    2022-12-16
	
	C5Music_Info.helpsleep_volume = C5Music_Info.BackMusicState[3].CtrlCont.CtrlVoice*3;
	
	C5Music_Info.set_global_volume = 60;		//上电默认全局音量为60
	C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
	
	C5Music_Info.control_flag |= C5MUSIC_Query_Versions_Flag;
	//C5Music_Info.control_flag |= C5MUSIC_Query_Filenum_Flag;
	C5Music_Info.control_flag |= C5MUSIC_Set_Default_Volume_Flag;
	
	Add_BUS_Device_To_List2(&BUS_Public,(uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO));
	
	BUS485_Info.device_num += 1;
}

/*******************************************************************************
* Function Name  : BLV_BUS_C5MUSIC_Cycle_Call 
* Description    : C5 MUSIC轮询发送函数函数
* Input          : 
	dev_addr	: 设备信息地址
* Return         :
	0x01：等待发送
*******************************************************************************/
uint8_t BLV_BUS_C5MUSIC_Cycle_Call(uint32_t dev_addr)
{
//	uint16_t temp = 0;
	uint32_t temp1 = 0;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	
//	temp = SRAM_Read_Byte(dev_addr+Dev_Type);		//判断设备类型
//	if(temp != DEV_C5MUSIC_Type) return 0x01;
	
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),dev_addr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),dev_addr+Dev_Privately);
	
	if((BUS_Public.port == Bus_port) && (BUS485_Info.BUS_Start == Baud_Wait)) {
		//切换波特率过程中,只发送询问数据
		//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"切换波特率过程中,只发送询问数据");
		
		BUS_C5MUSIC_Playback_Status_Datasend(dev_addr,&C5Music_Info);
		
		BUS_Public.check = 0x00;
		BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
		SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),dev_addr);/*将数据保存*/
		SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),dev_addr+Dev_Privately);
		
		return RS485OCCUPYTIME;
	}
	
	/*控制数据与轮询数据发送*/
	if(C5Music_Info.control_flag != 0x00)	//控制数据
	{
		for(uint8_t i = 0;i<C5MUSIC_Control_Num;i++)
		{
			temp1 = 0x01 << i;
			if((C5Music_Info.control_flag & temp1))	break;
		}
		switch(temp1)
		{
			case C5MUSIC_Set_Default_Volume_Flag:		//设定音量默认参数
				BUS_C5MUSIC_Set_Default_Volume_Datasend(dev_addr,&C5Music_Info);
				break;
			case C5MUSIC_Set_Volume_Flag:				//设置音量
				BUS_C5MUSIC_Set_Volume_Datasend(dev_addr,&C5Music_Info);
				break;
			case C5MUSIC_Specify_Play_Flag:				//指定播放状态
				BUS_C5MUSIC_Specify_Play_Datasend(dev_addr,&C5Music_Info);
				break;
			case C5MUSIC_Query_Default_Volume_Flag:		//查询默认音量
				BUS_C5MUSIC_Query_Default_Volume_Datasend(dev_addr,&C5Music_Info);
				break;
			case C5MUSIC_Query_Volume_Flag:				//查询音量
				BUS_C5MUSIC_Query_Volume_Datasend(dev_addr,&C5Music_Info);
				break;
			case C5MUSIC_Set_Loop_Mode_Flag:			//设置循环模式
				BUS_C5MUSIC_Set_Loop_Mode_Datasend(dev_addr,&C5Music_Info);
				break;
			case C5MUSIC_Query_Loop_Mode_Flag:			//查询循环模式
				BUS_C5MUSIC_Query_Loop_Mode_Datasend(dev_addr,&C5Music_Info);
				break;
			case C5MUSIC_Query_Filenum_Flag:			//查询文件总数(音乐总数)
				BUS_C5MUSIC_Query_Filenum_Datasend(dev_addr,&C5Music_Info);
				break;
			case C5MUSIC_Query_Versions_Flag:			//查询版本号
				BUS_C5MUSIC_Query_Versions_Datasend(dev_addr,&C5Music_Info);
				break;
//			case C5MUSIC_Write_FILEHEAD_Flag:			//写文件头
//				BUS_C5MUSIC_Write_FILEHEAD_Datasend(dev_addr,&C5Music_Info);
//				break;
//			case C5MUSIC_Write_FILEData_Flag:			//写文件数据
//				BUS_C5MUSIC_Write_FILEData_Datasend(dev_addr,&C5Music_Info);
//				break;
//			case C5MUSIC_Read_FILEHEAD_Flag:			//读文件头
//				BUS_C5MUSIC_Read_FILEHEAD_Datasend(dev_addr,&C5Music_Info);
//				break;
//			case C5MUSIC_Read_FILEData_Flag:			//读文件数据回复
//				BUS_C5MUSIC_Read_FILEData_Datasend(dev_addr,&C5Music_Info);
//				break;
		}
	}else {		//轮询数据
		BUS_C5MUSIC_Playback_Status_Datasend(dev_addr,&C5Music_Info);
	}
	
	C5Music_Info.inquire_tick = SysTick_1ms;
	
//	temp = BLV_Communication_Baud_Adjust2(&C5Music_Info.comm_record,&BUS_Public);
//	if(temp != 0x00)
//	{
//		switch(temp)
//		{
//			case 0x01:
//				//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"当前通讯记录未达计算数");
//				break;
//			case 0x02:
//				Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5Music 连续失败次数已达上限，切换通讯波特率");
//				Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5Music Adjust Baud:%ld!",BUS_Public.baud);
//				//LOG_Device_COMM_Adjust_Baud_Record(DEV_C5MUSIC_Type,BUS_Public.addr,BUS_Public.baud);
//				break;
//			case 0x03:
//				Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5Music 通讯失败百分比已达上限，切换通讯波特率");
//				Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5Music Adjust Baud:%ld!",BUS_Public.baud);
//				//LOG_Device_COMM_Adjust_Baud_Record(DEV_C5MUSIC_Type,BUS_Public.addr,BUS_Public.baud);
//				break;
//		}
//	}
//	BLV_Communication_Record(&C5Music_Info.comm_record,0x01,0x00);
	
	if(C5Music_Info.DevSendCnt > C5MUSIC_REPEATSENDTIMEMAX)
	{
		if(C5Music_Info.DevOffline != DEV_IS_OFFLINE)
		{
			Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC OFFLINE");
			LOG_Device_Online_Record(DEV_C5MUSIC_Type,BUS_Public.addr,LogInfo_Device_Offline);	//记录设备离线
		}
		C5Music_Info.DevOffline = DEV_IS_OFFLINE;		//判为离线
		C5Music_Info.control_flag = 0x00;				//发送达到上限，清除控制标志位
		C5Music_Info.DevSendCnt = 0x00;					//清除发送次数
		if(C5Music_Info.DevOffline != C5Music_Info.DevOfflineLast)	//当前在线状态不等于上一次在线状态
		{
			C5Music_Info.DevOfflineLast = C5Music_Info.DevOffline;	//更新上一次在线状态
			Write_Device_Fault_State(BUS_Public.type,BUS_Public.addr,In_ErrFun_LineState,DEV_IS_OFFLINE);	//保存设备在线状态到SRAM
		}
	}else {
		C5Music_Info.DevSendCnt++;   				//发送次数累计
	}

	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),dev_addr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),dev_addr+Dev_Privately);
	
	return RS485OCCUPYTIME;
}

/*******************************************************************************
* Function Name  : BLV_BUS_C5MUSIC_Data_Processing 
* Description    : C5 MUSIC数据处理函数
* Input          : 
	dev_addr	: 设备信息地址
	data_addr	: 数据地址
	len			：数据长度
* Return         : 
	0x00：处理成功
	0x01：处理失败
*******************************************************************************/
uint8_t BLV_BUS_C5MUSIC_Data_Processing(uint32_t dev_addr,uint32_t data_addr,uint16_t len)
{
	uint16_t temp2 = 0,temp3 = 0;
	
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),dev_addr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),dev_addr+Dev_Privately);
	
	uint16_t deal_len = len;
	if(deal_len > C5MUCSIC_RecvData_Len_Max)
	{
		Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC Check_Len Fail!");
		return 0x01;	//和校验
	}
	uint8_t deal_buff[40];
	memset(deal_buff,0,sizeof(deal_buff));
	SRAM_DMA_Read_Buff(deal_buff,deal_len,data_addr);

	if(deal_len < PKT2_PARA)
	{
		Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC Check_Len Fail %d!",deal_len);
		return 0x01;						//接收数据长度不对
	}
	
	if(deal_buff[PKT2_ADD_FM] != 0x01)	
	{
		Dbg_Print_Buff(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC PKT_ADD_FM Fail:",deal_buff,deal_len);
		return 0x01;						//发送地址不对
	}
	
	if(deal_buff[PKT2_DevType] != C5MUSICTYPE)	
	{
		Dbg_Print_Buff(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC PKT_DevType Fail:",deal_buff,deal_len);
		return 0x01;					//设备类型不对
	}

	if(deal_buff[PKT2_ADD_TO] != 0x00)	
	{
		Dbg_Print_Buff(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC PKT_ADD_TO Fail:",deal_buff,deal_len);
		return 0x01;						//接收地址不对
	}
	
	if(deal_buff[PKT2_LEN] != deal_len)		
	{
		Dbg_Print_Buff(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC PKT_LEN Fail:",deal_buff,deal_len);
		return 0x01;						//长度不对
	}
	
	if(CheckSum(deal_buff,deal_len) != 0x00) 
	{
		Dbg_Print_Buff(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC Check Fail:",deal_buff,deal_len);
		return 0x01;	//和校验
	}
	
	if((deal_buff[PKT2_TYPE] & 0x0F) != C5Music_Info.DevSendSN)	
	{
		Dbg_Print_Buff(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC PKT_TYPE Fail:",deal_buff,deal_len);
		return 0x01;			//序号不对
	}

	if(deal_buff[PKT2_PARA] != BLV_C5MUSIC_Relay_SUCC)
	{
		Dbg_Print_Buff(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC_Relay_Fail:",deal_buff,deal_len);
		return 0x01;
	}
	
	if(C5Music_Info.DevOffline == DEV_IS_OFFLINE)
	{
		Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC LogInfo_Device_Online...........");
		LOG_Device_Online_Record(DEV_C5MUSIC_Type,BUS_Public.addr,LogInfo_Device_Online);	//记录设备离线
	}
	
	switch(deal_buff[PKT2_CMD])
	{
		case BLV_C5MUSIC_Playback_Status_Reply:				//查询当前播放状态回复
			
			C5Music_Info.now_playback_status = deal_buff[PKT2_PARA + 1];		//当前播放状态	
			C5Music_Info.now_playback_mode = deal_buff[PKT2_PARA + 2];		//播放模式
			C5Music_Info.now_playback_dir = deal_buff[PKT2_PARA + 3];		//当前播放的文件夹
			/*当前播放文件夹下文件名*/	
			temp2 = deal_buff[PKT2_PARA + 5];
			temp2 <<= 8;
			temp2 |= deal_buff[PKT2_PARA + 4];
			C5Music_Info.now_playback_idx = temp2;	//播放文件序号 - 没用
		
			C5Music_Info.now_playback_volume = (deal_buff[PKT2_PARA + 7] & 0x7F);				//当前播放实际输出音量(去掉最高位的静音标志)
			C5Music_Info.now_mute_status = deal_buff[PKT2_PARA + 7] >> 7;				//最高位的静音标志
	
			C5Music_Info.now_global_volume = deal_buff[PKT2_PARA + 8];					//当前全局百分比音量
			
			/*音乐音量 */
			C5Music_Info.now_music_volume = deal_buff[PKT2_PARA + 9];					//当前音乐音量
			/*提示音音量 */
			C5Music_Info.now_tone_volume = deal_buff[PKT2_PARA + 10];					//当前提示音音量
			/*门铃音量 */
			C5Music_Info.now_door_volume = deal_buff[PKT2_PARA + 11];					//当前门铃音量
			
			C5Music_Info.now_helpsleep_volume = deal_buff[PKT2_PARA + 12];			    //当前助眠音乐音量    2022-12-16
			
//			Dbg_Print_Buff(DBG_BIT_DEVICE_STATUS_bit,"Music Polling Data",deal_buff,deal_len);
			
			if(C5Music_Info.last_playback_status != C5Music_Info.now_playback_status)		/*比较C5MUSIC_Playback参数,是否保存日志*/
			{
				Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC_Playback_Status Change:%d",C5Music_Info.now_playback_status);
				C5Music_Info.last_playback_status = C5Music_Info.now_playback_status;
				SRAM_Write_Byte(C5Music_Info.last_playback_status,SRAM_LOG_Device_C5MUSIC_Playback_Status);
				temp3++;
			}
			if(C5Music_Info.last_playback_volume != C5Music_Info.now_playback_volume)		/*比较C5MUSIC_Volume参数,是否保存日志*/
			{
				Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC_Volume_Status Change");
				C5Music_Info.last_playback_volume = C5Music_Info.now_playback_volume;
				SRAM_Write_Byte(C5Music_Info.last_playback_volume,SRAM_LOG_Device_C5MUSIC_Volume_Status);
				temp3++;
			}
			if(C5Music_Info.last_playback_dir != C5Music_Info.now_playback_dir)
			{
				Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC_Playback_Dir Change");
				C5Music_Info.last_playback_dir = C5Music_Info.now_playback_dir;
				temp3++;
			}
			if(C5Music_Info.last_playback_idx != C5Music_Info.now_playback_idx)		/*比较C5MUSIC_idx参数,是否保存日志*/
			{
				Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"C5MUSIC_idx_Status Change");
				C5Music_Info.last_playback_idx = C5Music_Info.now_playback_idx;
				SRAM_Write_Word(C5Music_Info.last_playback_idx,SRAM_LOG_Device_C5MUSIC_idx_Status);
				temp3++;
			}
			if(temp3 != 0x00)	/*查询回来的状态,有改变 - 记录日志*/
			{
				LOG_Device_COMM_ASK_TO_Reply_Record(BUS_Public.port, BUS_Public.baud,(SysTick_1ms - C5Music_Info.inquire_tick),deal_buff,deal_len);
			}
			break;
		case BLV_C5MUSIC_Set_Default_Volume_Reply:			//设定音量默认参数回复
			Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC_Set_Default_Volume_Reply");
			
			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
		
			C5Music_Info.control_flag &= ~(C5MUSIC_Set_Default_Volume_Flag);
			break;
		case BLV_C5MUSIC_Specify_Play_Reply:				//指定播放状态回复
			Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC_Specify_Play_Reply");
			
			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
		
			C5Music_Info.control_flag &= ~(C5MUSIC_Specify_Play_Flag);
			break;
		case BLV_C5MUSIC_Set_Volume_Reply:					//设置音量回复
			Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC_Set_Volume_Reply");
			
			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
		
			C5Music_Info.adjust_volume_type = 0x00;
			C5Music_Info.control_flag &= ~(C5MUSIC_Set_Volume_Flag);
			break;	
		case BLV_C5MUSIC_Query_Default_Volume_Reply:		//查询默认音量回复
			
			C5Music_Info.default_volume = deal_buff[PKT2_PARA + 1];
			C5Music_Info.playback_volume_max = deal_buff[PKT2_PARA + 2];
			C5Music_Info.playback_volume_max = deal_buff[PKT2_PARA + 3];
			
			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
		
			C5Music_Info.control_flag &= ~(C5MUSIC_Query_Default_Volume_Flag);
			break;
		case BLV_C5MUSIC_Query_Volume_Reply:				//查询音量回复
			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
		
			C5Music_Info.now_playback_volume = deal_buff[PKT2_PARA + 1];
			C5Music_Info.control_flag &= ~(C5MUSIC_Query_Volume_Flag);
			break;
		case BLV_C5MUSIC_Set_Loop_Mode_Reply:				//设置循环模式回复
			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
		
			C5Music_Info.control_flag &= ~(C5MUSIC_Set_Loop_Mode_Flag);
			C5Music_Info.control_flag |= C5MUSIC_Query_Loop_Mode_Flag;
			break;
		case BLV_C5MUSIC_Query_Loop_Mode_Reply:				//查询循环模式回复
			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
		
			C5Music_Info.playback_mode = deal_buff[PKT2_PARA + 1];
			Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC playback_mode:%d",C5Music_Info.playback_mode);
			C5Music_Info.control_flag &= ~(C5MUSIC_Query_Loop_Mode_Flag);
			break;
//		case BLV_C5MUSIC_Query_Filenum_Reply:				//查询文件总数(音乐总数)回复
//			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
//		
//			C5Music_Info.playback_num = deal_buff[PKT2_PARA + 1];
//			Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC playback_num:%d",C5Music_Info.playback_num);
//			C5Music_Info.control_flag &= ~(C5MUSIC_Query_Filenum_Flag);
//			break;
		case BLV_C5MUSIC_Query_Versions_Reply:				//查询版本号回复
			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
			C5Music_Info.dev_versions = deal_buff[PKT2_PARA] << 8;
			C5Music_Info.dev_versions = deal_buff[PKT2_PARA + 1];
			Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC dev_versions : %04X",C5Music_Info.dev_versions);
			
			C5Music_Info.control_flag &= ~(C5MUSIC_Query_Versions_Flag);
			break;
//		case BLV_C5MUSIC_Write_FILEHEAD_Reply:				//写文件头回复
//			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
//		
//			C5Music_Info.control_flag &= ~(C5MUSIC_Write_FILEHEAD_Flag);	//写文件头标记清除
//			C5Music_Info.control_flag |= C5MUSIC_Write_FILEData_Flag;		//开始
//			break;
//		case BLV_C5MUSIC_Write_FILEData_Reply:				//写文件数据回复
//			LOG_Device_COMM_Control_Reply_Record(BUS_Public.port, BUS_Public.baud,deal_buff,deal_len);
//			
//			if(C5Music_Info.file_block == deal_buff[PKT2_PARA + 1])		//比对块号
//			{
//				Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"BLV C5MUSIC file block:%d SUCC\r\n",C5Music_Info.file_block);
//				C5Music_Info.file_block++;
//			}
//			if(C5Music_Info.file_block >= C5Music_Info.file_block_num)	//文件接收结束
//			{
//				Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"BLV C5MUSIC Wirte File END\r\n");
//				C5Music_Info.control_flag &= ~(C5MUSIC_Write_FILEData_Flag);
//			}
//			
//			break;
//		case BLV_C5MUSIC_Read_FILEHEAD_Reply:				//读文件头回复
//			C5Music_Info.control_flag &= ~(C5MUSIC_Read_FILEHEAD_Flag);
//			break;
//		case BLV_C5MUSIC_Read_FILEData_Reply:				//读文件数据
//			
//			break;
	}
	
	BLV_Communication_Record(&C5Music_Info.comm_record,0x02,0x01);		//记录通讯成功
	C5Music_Info.DevSendCnt = 0x00;
	C5Music_Info.DevOffline = DEV_IS_ONLINE;    //设备在线
	if(C5Music_Info.DevOffline != C5Music_Info.DevOfflineLast)	//当前在线状态不等于上一次在线状态
	{
		C5Music_Info.DevOfflineLast = C5Music_Info.DevOffline;	//更新上一次在线状态
		Write_Device_Fault_State(BUS_Public.type,BUS_Public.addr,In_ErrFun_LineState,DEV_IS_ONLINE);	//保存设备在线状态到SRAM
	}
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),dev_addr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),dev_addr+Dev_Privately);
	
	return 0x00;
}

/*******************************************************************************
* Function Name  : C5MUSIC_Playback_Status_Datasend 
* Description    : C5 MUSIC 查询当前播放状态数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Playback_Status_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t temp = 0;
	uint8_t send_buff[10];
	memset(send_buff,0,10);
	
	send_buff[PKT2_ADD_FM] = 0x00;			//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x08;									//本次发送数据长度
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Playback_Status_CMD;		//设置命令
	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,0x08);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,0x08);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Set_Default_Volume_Datasend 
* Description    : C5 MUSIC 设定音量默认参数数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Set_Default_Volume_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t temp = 0;
	uint8_t send_buff[15];
	memset(send_buff,0,15);
	
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"%s",__func__);
	send_buff[PKT2_ADD_FM] = 0x00;								//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x0C;									//本次发送数据长度
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Set_Default_Volume_CMD;	//设置命令
	
	send_buff[PKT2_PARA] = Dev_Info->default_volume;			//上电默认音量
	send_buff[PKT2_PARA + 1] = BLV_C5MUSIC_Volume_MAX;
	send_buff[PKT2_PARA + 2] = BLV_C5MUSIC_Volume_MIN;
	send_buff[PKT2_PARA + 3] = 0x00;
	send_buff[PKT2_PARA + 4] = 0x00;
	send_buff[PKT2_PARA + 5] = 0x00;      //2022-12-16
	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,send_buff[PKT2_LEN]);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,0x0B);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Specify_Play_Datasend 
* Description    : C5 MUSIC 指定播放状态数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Specify_Play_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t temp = 0;
	uint8_t send_buff[20];
	memset(send_buff,0,20);
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"%s",__func__);
	send_buff[PKT2_ADD_FM] = 0x00;								//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x13;									//本次发送数据长度
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Specify_Play_CMD;	//设置命令
	
	send_buff[PKT2_PARA] = Dev_Info->now_playback_type;		//指定播放器 - 房间音乐默认
	
	
	switch(Dev_Info->assign_dir)
	{
		case BLV_C5MUSIC_Music_Dir:
			send_buff[PKT2_PARA + 1] = Dev_Info->playback_fun;			//指定播放状态 
			send_buff[PKT2_PARA + 2] = BLV_C5MUSIC_Music_Dir;
			send_buff[PKT2_PARA + 3] = Dev_Info->assign_playback_idx;	//需要指定填具体播放文件，不需要填0x00
			send_buff[PKT2_PARA + 4] = Dev_Info->set_playback_volume;
			send_buff[PKT2_PARA + 5] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 6] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 7] = 0x00;		//下降渐变时间
			send_buff[PKT2_PARA + 8] = 0x00;		//下降渐变时间
			send_buff[PKT2_PARA + 9] = 0x00;		//助眠最大音量 这不需要
			send_buff[PKT2_PARA + 10] = 0x00;		//助眠最小音量 这不需要
			break;
		case BLV_C5MUSIC_Warning_Dir:
			
			send_buff[PKT2_PARA + 1] = Dev_Info->playback_fun;			//指定播放状态
			send_buff[PKT2_PARA + 2] = BLV_C5MUSIC_Warning_Dir;
			send_buff[PKT2_PARA + 3] = Dev_Info->assign_playback_idx;	//需要指定填具体播放文件，不需要填0x00
			send_buff[PKT2_PARA + 4] = Dev_Info->set_playback_volume;
			send_buff[PKT2_PARA + 5] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 6] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 7] = 0x00;		//下降渐变时间
			send_buff[PKT2_PARA + 8] = 0x00;		//下降渐变时间
			send_buff[PKT2_PARA + 9] = 0x00;		//助眠最大音量 这不需要
			send_buff[PKT2_PARA + 10] = 0x00;		//助眠最小音量 这不需要
			break;
		case BLV_C5MUSIC_Helpsleep_Dir:
			send_buff[PKT2_PARA + 1] = Dev_Info->playback_fun;			//指定播放状态 
			send_buff[PKT2_PARA + 2] = BLV_C5MUSIC_Helpsleep_Dir;
			send_buff[PKT2_PARA + 3] = Dev_Info->assign_playback_idx;	//需要指定填具体播放文件，不需要填0x00
			send_buff[PKT2_PARA + 4] = BLV_C5MUSIC_HelpSleep_Start_Volume;		//助眠起始音量
			
			send_buff[PKT2_PARA + 5] = 0x02;		//上升渐变时间
			send_buff[PKT2_PARA + 6] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 7] = Dev_Info->helpsleep_time & 0xFF;		//下降渐变时间
			send_buff[PKT2_PARA + 8] = (Dev_Info->helpsleep_time >> 8) & 0xFF;		//下降渐变时间
			send_buff[PKT2_PARA + 9] = Dev_Info->helpsleep_volume;		//助眠最大音量 这不需要
			send_buff[PKT2_PARA + 10] = 0x00;		//助眠最小音量 这不需要
			break;
		case BLV_C5MUSIC_Doorbell_Dir:
			if(Dev_Info->now_playback_status == BLV_C5MUSIC_Playing)
			{
				send_buff[PKT2_PARA + 1] = BLV_C5MUSIC_Forestall;			//指定播放状态
			}else {
				send_buff[PKT2_PARA + 1] = BLV_C5MUSIC_Single_Play;			//指定播放状态
			}	
			send_buff[PKT2_PARA + 2] = BLV_C5MUSIC_Doorbell_Dir;
			send_buff[PKT2_PARA + 3] = Dev_Info->assign_playback_idx;	//需要指定填具体播放文件，不需要填0x00
			send_buff[PKT2_PARA + 4] = Dev_Info->set_door_volume;		//2022-05-08 修改
			send_buff[PKT2_PARA + 5] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 6] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 7] = 0x00;		//下降渐变时间
			send_buff[PKT2_PARA + 8] = 0x00;		//下降渐变时间
			send_buff[PKT2_PARA + 9] = 0x00;		//助眠最大音量 这不需要
			send_buff[PKT2_PARA + 10] = 0x00;		//助眠最小音量 这不需要
			break;
		case BLV_C5MUSIC_Greet_Dir:
			send_buff[PKT2_PARA + 1] = Dev_Info->playback_fun;			//指定播放状态 
			send_buff[PKT2_PARA + 2] = BLV_C5MUSIC_Greet_Dir;
			send_buff[PKT2_PARA + 3] = Dev_Info->assign_playback_idx;	//需要指定填具体播放文件，不需要填0x00
			send_buff[PKT2_PARA + 4] = Dev_Info->set_playback_volume;
			send_buff[PKT2_PARA + 5] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 6] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 7] = 0x00;		//下降渐变时间
			send_buff[PKT2_PARA + 8] = 0x00;		//下降渐变时间
			send_buff[PKT2_PARA + 9] = 0x00;		//助眠最大音量 这不需要
			send_buff[PKT2_PARA + 10] = 0x00;		//助眠最小音量 这不需要
			break;
		case BLV_C5MUSIC_Helpsleep1_Dir:
			send_buff[PKT2_PARA + 1] = Dev_Info->playback_fun;			//指定播放状态 
			send_buff[PKT2_PARA + 2] = BLV_C5MUSIC_Helpsleep1_Dir;
			send_buff[PKT2_PARA + 3] = Dev_Info->assign_playback_idx;	//需要指定填具体播放文件，不需要填0x00
			send_buff[PKT2_PARA + 4] = BLV_C5MUSIC_HelpSleep_Start_Volume;		//助眠起始音量
			send_buff[PKT2_PARA + 5] = 0x02;		//上升渐变时间
			send_buff[PKT2_PARA + 6] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 7] = Dev_Info->helpsleep_time & 0xFF;		//下降渐变时间
			send_buff[PKT2_PARA + 8] = (Dev_Info->helpsleep_time >> 8) & 0xFF;		//下降渐变时间
			send_buff[PKT2_PARA + 9] = Dev_Info->helpsleep_volume;		//助眠最大音量 这不需要
			send_buff[PKT2_PARA + 10] = 0x00;		//助眠最小音量 这不需要
			break;
		case BLV_C5MUSIC_Helpsleep2_Dir:
			send_buff[PKT2_PARA + 1] = Dev_Info->playback_fun;			//指定播放状态 
			send_buff[PKT2_PARA + 2] = BLV_C5MUSIC_Helpsleep2_Dir;
			send_buff[PKT2_PARA + 3] = Dev_Info->assign_playback_idx;	//需要指定填具体播放文件，不需要填0x00
			send_buff[PKT2_PARA + 4] = BLV_C5MUSIC_HelpSleep_Start_Volume;		//助眠起始音量
			send_buff[PKT2_PARA + 5] = 0x02;		//上升渐变时间
			send_buff[PKT2_PARA + 6] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 7] = Dev_Info->helpsleep_time & 0xFF;		//下降渐变时间
			send_buff[PKT2_PARA + 8] = (Dev_Info->helpsleep_time >> 8) & 0xFF;		//下降渐变时间
			send_buff[PKT2_PARA + 9] = Dev_Info->helpsleep_volume;		//助眠最大音量 这不需要
			send_buff[PKT2_PARA + 10] = 0x00;		//助眠最小音量 这不需要
			break;
		case BLV_C5MUSIC_Helpsleep3_Dir:
			send_buff[PKT2_PARA + 1] = Dev_Info->playback_fun;			//指定播放状态 
			send_buff[PKT2_PARA + 2] = BLV_C5MUSIC_Helpsleep3_Dir;
			send_buff[PKT2_PARA + 3] = Dev_Info->assign_playback_idx;	//需要指定填具体播放文件，不需要填0x00
			send_buff[PKT2_PARA + 4] = BLV_C5MUSIC_HelpSleep_Start_Volume;		//助眠起始音量
			send_buff[PKT2_PARA + 5] = 0x02;		//上升渐变时间
			send_buff[PKT2_PARA + 6] = 0x00;		//上升渐变时间
			send_buff[PKT2_PARA + 7] = Dev_Info->helpsleep_time & 0xFF;		//下降渐变时间
			send_buff[PKT2_PARA + 8] = (Dev_Info->helpsleep_time >> 8) & 0xFF;		//下降渐变时间
			send_buff[PKT2_PARA + 9] = Dev_Info->helpsleep_volume;		//助眠最大音量 这不需要
			send_buff[PKT2_PARA + 10] = 0x00;		//助眠最小音量 这不需要
			break;
	}
	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,send_buff[PKT2_LEN]);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,send_buff[PKT2_LEN]);
	
	
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"指定播放文件夹：%d",Dev_Info->assign_dir);
	Dbg_Print_Buff(DBG_BIT_DEVICE_STATUS_bit,"指定播放数据：",send_buff,send_buff[PKT2_LEN]);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Set_Volume_Datasend 
* Description    : C5 MUSIC 设置音量数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Set_Volume_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t temp = 0;
	uint8_t send_buff[19];
	memset(send_buff,0,19);
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"%s",__func__);
	send_buff[PKT2_ADD_FM] = 0x00;								//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x13;									//本次发送数据长度       2022-12-16
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Set_Volume_CMD;	//设置命令
	
	send_buff[PKT2_PARA] = Dev_Info->now_playback_type;
	send_buff[PKT2_PARA + 1] = Dev_Info->adjust_volume_type;
	

	if(Dev_Info->adjust_volume_type & 0x01)	//绝对音量调节 - 一般不会使用
	{
		send_buff[PKT2_PARA + 2] = Dev_Info->set_playback_volume;	
	}
	
	if(Dev_Info->adjust_volume_type & (0x01<<1))	//设置全局百分比
	{
		send_buff[PKT2_PARA + 3] = Dev_Info->set_global_volume;
	}
	if(Dev_Info->adjust_volume_type & (0x01<<2))	//设置静音
	{
		send_buff[PKT2_PARA + 4] = Dev_Info->set_quiet_status;
	}
	
	if(Dev_Info->adjust_volume_type & (0x01<<3))	//相对回路音量调节
	{
		send_buff[PKT2_PARA + 5] = Dev_Info->adjust_volume_operate;	//相对调节操作
		send_buff[PKT2_PARA + 6] = Dev_Info->adjust_volume_loop;	//相对调节回路
	}
	
	if(Dev_Info->adjust_volume_type & (0x01<<4))	//设置回路音量
	{
		//Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"设置回路音量:门铃音量:%d", Dev_Info->set_door_volume);					
		send_buff[PKT2_PARA + 7] = Dev_Info->set_music_volume;	//回路音量1
		send_buff[PKT2_PARA + 8] = Dev_Info->set_tone_volume;	//回路音量2
		send_buff[PKT2_PARA + 9] = Dev_Info->set_door_volume;	//回路音量3
		send_buff[PKT2_PARA + 10] = Dev_Info->set_helpsleep_volume;	//回路音量4    2022-12-16
	}
	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,send_buff[PKT2_LEN]);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,send_buff[PKT2_LEN]);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Query_Default_Volume_Datasend 
* Description    : C5 MUSIC 查询默认音量数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Query_Default_Volume_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t temp = 0;
	uint8_t send_buff[10];
	memset(send_buff,0,10);
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"%s",__func__);
	send_buff[PKT2_ADD_FM] = 0x00;			//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x08;									//本次发送数据长度
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Query_Default_Volume_CMD;	//设置命令
	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,0x08);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,0x08);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Query_Volume_Datasend 
* Description    : C5 MUSIC 查询音量数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Query_Volume_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t temp = 0;
	uint8_t send_buff[10];
	memset(send_buff,0,10);
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"%s",__func__);
	send_buff[PKT2_ADD_FM] = 0x00;			//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x08;									//本次发送数据长度
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Query_Volume_CMD;	//设置命令
	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,0x08);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,0x08);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Set_Loop_Mode_Datasend 
* Description    : C5 MUSIC 设置循环模式数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Set_Loop_Mode_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t temp = 0;
	uint8_t send_buff[12];
	memset(send_buff,0,12);
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"%s",__func__);
	send_buff[PKT2_ADD_FM] = 0x00;								//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x0A;									//本次发送数据长度
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Set_Loop_Mode_CMD;	//设置命令
	
	send_buff[PKT2_PARA] = Dev_Info->now_playback_type;
	send_buff[PKT2_PARA + 1] = Dev_Info->playback_mode;

	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,0x0A);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,0x0A);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Query_Loop_Mode_Datasend 
* Description    : C5 MUSIC 查询循环模式数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Query_Loop_Mode_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t temp = 0;
	uint8_t send_buff[10];
	memset(send_buff,0,10);
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"%s",__func__);
	send_buff[PKT2_ADD_FM] = 0x00;			//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x08;									//本次发送数据长度
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Query_Loop_Mode_CMD;	//设置命令
	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,0x08);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,0x08);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Query_Filenum_Datasend 
* Description    : C5 MUSIC 查询文件总数(音乐总数)数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Query_Filenum_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t temp = 0;
	uint8_t send_buff[10];
	memset(send_buff,0,10);
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"%s",__func__);
	send_buff[PKT2_ADD_FM] = 0x00;			//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x08;									//本次发送数据长度
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Query_Filenum_CMD;	//设置命令
	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,0x08);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,0x08);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Query_Versions_Datasend 
* Description    : C5 MUSIC 查询版本号数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Query_Versions_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t temp = 0;
	uint8_t send_buff[10];
	memset(send_buff,0,10);
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"%s",__func__);
	send_buff[PKT2_ADD_FM] = 0x00;			//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x08;									//本次发送数据长度
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Query_Versions_CMD;	//设置命令
	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,0x08);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,0x08);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Write_FILEHEAD_Datasend 
* Description    : C5 MUSIC 写文件头数据发送函数 - 写日志文件，MP3通过网络透传下发
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Write_FILEHEAD_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	uint8_t len = 0;
	uint8_t temp = 0;
	uint8_t send_buff[22];
	memset(send_buff,0,22);
	
	send_buff[PKT2_ADD_FM] = 0x00;			//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	send_buff[PKT2_LEN] = 0x00;
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Write_FILEHEAD_CMD;		//设置命令
	
	send_buff[PKT2_PARA] = Dev_Info->file_block_num & 0xFF;			//文件总块数低八位
	send_buff[PKT2_PARA + 1] = (Dev_Info->file_block_num >> 8) & 0xFF;		//文件总块数高八位
	send_buff[PKT2_PARA + 2] = 0x01;							//文件类型 TXT类型
	len = 0x0B;
	//len +=snprintf((char *)&send_buff[PKT2_PARA + 3],16,"%02X%02X%02X%02X",RTC_Raw_Data.year,RTC_Raw_Data.month,RTC_Raw_Data.day,RTC_Raw_Data.hour);
	len +=snprintf((char *)&send_buff[PKT2_PARA + 3],16,"%02X%02X%02X%02X",RTC_Raw_Data.month,RTC_Raw_Data.day,RTC_Raw_Data.hour,RTC_Raw_Data.minute);
	send_buff[PKT2_LEN] = len;									//本次发送数据长度
	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,len);
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,len);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Write_FILEData_Datasend 
* Description    : C5 MUSIC 写文件数据 数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Write_FILEData_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	//获取当前日志文件读取地址
	if((Dev_Info->file_start_addr < SRAM_LOG_DATA_Address) || (Dev_Info->file_start_addr > SRAM_LOG_End_Address)) 
	{
		Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"file_start_addr :%08X",Dev_Info->file_start_addr);
		return ;	//不在日志数据范围内，直接退出
	}
	if((Dev_Info->file_end_addr < SRAM_LOG_DATA_Address) || (Dev_Info->file_end_addr > SRAM_LOG_End_Address)) 
	{
		Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"file_end_addr :%08X",Dev_Info->file_end_addr);
		return ;	
	}
	if(Dev_Info->file_block >= Dev_Info->file_block_num) 
	{
		Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"file_block :%08X , file_block_num:%08X",Dev_Info->file_block,Dev_Info->file_block_num);
		return ;	//发送完毕
	}
	
	uint8_t temp = 0;
	uint16_t temp1 = 0,temp2 = 0,len = 0;
	uint8_t send_buff[530];
	uint32_t read_addr = 0;
	memset(send_buff,0,530);
	
	/*获取写入长度*/
	temp1 = Dev_Info->file_size - Dev_Info->file_block*512;
	if(temp1 > 512)	len = 512;
	else if((temp1 <= 512) && (temp1 != 0)) len = temp1;
	else if(temp1 == 0) return ;
	/*获取读取数据地址*/
	read_addr = Dev_Info->file_block*512+Dev_Info->file_start_addr;
	if(read_addr >= SRAM_LOG_End_Address)	read_addr = read_addr - SRAM_LOG_End_Address + SRAM_LOG_DATA_Address;
	/*开始打包数据*/
	Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BUS_C5MUSIC_Write_FILEData %08X,len:%d",read_addr,len);
	send_buff[PKT2_ADD_FM] = 0x00;			//本机地址
	if(Dev_Info->DevSendCnt == 0x00)
	{
		Dev_Info->DevSendSN++;
		if(Dev_Info->DevSendSN > 0x0F)	Dev_Info->DevSendSN = 0x00;
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);	//设置发送序号
	}else{	
		//本包数据为重发数据
		send_buff[PKT2_TYPE] |= (Dev_Info->DevSendSN & 0x0F);
		send_buff[PKT2_TYPE] |= BUS_Retry_Flag;
	}
	send_buff[PKT2_DevType] = C5MUSICTYPE;						//设备类型
	send_buff[PKT2_ADD_TO] = 0x01;								//设备地址 - C5 MUSIC固定设备地址为0x01
	
	temp1 = len + PKT2_PARA + 4;
	send_buff[PKT2_LEN] = temp1 & 0xFF;							//本次发送数据长度
	send_buff[PKT2_LEN_8] = (temp1 >> 8) & 0xFF;				//本次发送数据长度
	
	send_buff[PKT2_CHKSUM] = 0x00;								//校验
	send_buff[PKT2_CMD] = BLV_C5MUSIC_Write_FILEData_CMD;		//设置命令
	
	send_buff[PKT2_PARA] = Dev_Info->file_block & 0xFF;					//文件总块号低八位
	send_buff[PKT2_PARA + 1] = (Dev_Info->file_block >> 8) & 0xFF;		//文件总块号高八位
	
	if(read_addr + len >= SRAM_LOG_End_Address)		//一次读取不完，需要读取两次	
	{
		temp2 = PKT2_PARA + 4;
		temp1 = SRAM_LOG_End_Address - read_addr;
		SRAM_DMA_Read_Buff(&send_buff[temp2],temp1,read_addr);
		temp2 = PKT2_PARA + 4 + temp1;
		temp1 = len - temp1;
		SRAM_DMA_Read_Buff(&send_buff[temp2],temp1,SRAM_LOG_DATA_Address);
	}else {
		SRAM_DMA_Read_Buff(&send_buff[PKT2_PARA + 4],len,read_addr);
	}
	
	temp2 = NetCRC16_2(&send_buff[PKT2_PARA + 4],len);
	send_buff[PKT2_PARA + 2] = temp2 & 0xFF;							//CRC 低八位
	send_buff[PKT2_PARA + 3] = (temp2 >> 8) & 0xFF;						//CRC 高八位
	temp1 = len + PKT2_PARA + 4;	
	send_buff[PKT2_CHKSUM] = CheckSum(send_buff,temp1);

	/*数据发送*/
	temp = SRAM_Read_Byte(dev_addr+Dev_port);
	MCU485_SendString(temp,send_buff,temp1);
	
	/*日志记录*/
	LOG_Device_COMM_Send_Control_Record2(dev_addr+Dev_port,dev_addr+Dev_baud,send_buff,send_buff[PKT2_LEN]);
}

/*******************************************************************************
* Function Name  : C5MUSIC_Read_FILEHEAD_Datasend 
* Description    : C5 MUSIC 读文件头 数据发送函数
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Read_FILEHEAD_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	/*
		发送读文件头
		
	*/
}

/*******************************************************************************
* Function Name  : C5MUSIC_Read_FILEData_Datasend 
* Description    : C5 MUSIC 读文件数据
* Input          : 
	dev_addr	: 设备信息地址
	Dev_Info	：设备结构体
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Read_FILEData_Datasend(uint32_t dev_addr,BUS_C5MUSIC_INFO *Dev_Info)
{
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Test 
* Description    : C5 MUSIC 测试
*******************************************************************************/
//#include "BLV_485_Dev_Touch_SwiFun.h"

//uint32_t C5music_Tick = 0;

//void BUS_C5MUSIC_Test(void)
//{
//	
//	uint8_t crc_val = 0,temp2 = 0;
//	uint16_t temp = 0;
//	uint32_t read_addr = 0;
//	uint32_t temp1 = 0;
//	RS485_SWI_INFO test_switch;
//	
//	read_addr = SRAM_Read_DW(SRAM_POLL_Device_List_Addr);
//	
//	if((SRAM_Read_Byte(read_addr + Dev_Type) == DEV_SWI_TYPE) && (SRAM_Read_Byte(read_addr + Dev_Addr) == 0x01))
//	{
//		
//		if(Device_Data_Check(read_addr) == 0)
//		{
//			SRAM_DMA_Read_Buff((uint8_t *)&test_switch,sizeof(RS485_SWI_INFO),read_addr+Dev_Privately);

//		}else {
//			Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"read dev switch data fail\r\n");
//			return ;
//		}
//	}else{
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"read dev switch type fail\r\n");
//		return ;
//	}
//	
//	read_addr = SRAM_Device_List_Start_Addr;
//	BUS_C5MUSIC_INFO C5Music_Info;
//	
//	if((SRAM_Read_Byte(read_addr + Dev_Type) == DEV_C5MUSIC_Type) && (SRAM_Read_Byte(read_addr + Dev_Addr) == 0x01))
//	{
//		
//		if(Device_Data_Check(read_addr) == 0)
//		{
//			SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),read_addr+Dev_Privately);

//		}else {
//			Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"read dev C5music data fail\r\n");
//			return ;
//		}
//	}else{
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"read dev C5music data fail\r\n");
//		return ;
//	}
//	

//	if(test_switch.DevReadBuf[0] == KeyPress)		//播放状态设置
//	{
//		temp2++;
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"test_switch1 deal\r\n");
//		test_switch.DevReadBuf[0] = KeyNoAction;
//		
//		if(C5Music_Info.now_playback_status == BLV_C5MUSIC_Playing)		//当前暂停
//		{
//			C5Music_Info.playback_fun = BLV_C5MUSIC_Halted;
//			C5Music_Info.assign_playback_idx = 0x00;
//			C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
//		}else if(C5Music_Info.now_playback_status == BLV_C5MUSIC_Halted)	//当前播放状态,
//		{
//			C5Music_Info.playback_fun = BLV_C5MUSIC_Playing;
//			C5Music_Info.assign_playback_idx = 0x00;
//			C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
//		}
//	}else if(test_switch.DevReadBuf[1] == KeyPress)		//设置模式 - 循环模式切换
//	{
//		temp2++;
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"test_switch2 deal\r\n");
//		test_switch.DevReadBuf[1] = KeyNoAction;
//		
//		switch(C5Music_Info.now_playback_mode)
//		{
//			case BLV_C5MUSIC_Full_Loop:
//				Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC_Single_Cycle !\r\n");
//				C5Music_Info.playback_mode = BLV_C5MUSIC_Single_Cycle;
//				break;
//			case BLV_C5MUSIC_Single_Cycle:
//				Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC_Folder_Loop !\r\n");
//				C5Music_Info.playback_mode = BLV_C5MUSIC_Folder_Loop;
//				break;
//			case BLV_C5MUSIC_Folder_Loop:
//				Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC_Random_Cycle !\r\n");
//				C5Music_Info.playback_mode = BLV_C5MUSIC_Random_Cycle;
//				break;
//			case BLV_C5MUSIC_Random_Cycle:
//				Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC_Order_CyCle !\r\n");
//				C5Music_Info.playback_mode = BLV_C5MUSIC_Order_CyCle;
//				break;
//			case BLV_C5MUSIC_Order_CyCle:
//				Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"BLV_C5MUSIC_Full_Loop !\r\n");
//				C5Music_Info.playback_mode = BLV_C5MUSIC_Full_Loop;
//				break;
//			default:
//				Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"default BLV_C5MUSIC_Full_Loop !\r\n");
//				C5Music_Info.playback_mode = BLV_C5MUSIC_Full_Loop;
//				break;
//		}
//		C5Music_Info.control_flag |= C5MUSIC_Set_Loop_Mode_Flag;
//		
//	}else if(test_switch.DevReadBuf[2] == KeyPress)		//下一首
//	{
//		temp2++;
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"test_switch3 deal\r\n");
//		test_switch.DevReadBuf[2] = KeyNoAction;
//		
//		C5Music_Info.playback_fun = 0x03;
//		C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
//	}else if(test_switch.DevReadBuf[3] == KeyPress)		//上一首
//	{
//		temp2++;
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"test_switch4 deal\r\n");
//		test_switch.DevReadBuf[3] = KeyNoAction;
//		
//		C5Music_Info.playback_fun = 0x04;
//		C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
//	}else if(test_switch.DevReadBuf[4] == KeyPress)		//音量加
//	{
//		temp2++;
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"test_switch5 deal\r\n");
//		test_switch.DevReadBuf[4] = KeyNoAction;
//		//绝对音量调节 - 音量加
////		C5Music_Info.adjust_volume_type = 0x01;
////		C5Music_Info.set_playback_volume = C5Music_Info.now_playback_volume;
////		C5Music_Info.set_playback_volume++;
//		//相对调节 - 音量加一
//		C5Music_Info.adjust_volume_type = 0x02;
//		C5Music_Info.adjust_volume_operate = 0x02;
//		C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
//	}else if(test_switch.DevReadBuf[5] == KeyPress)		//音量减
//	{
//		temp2++;
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"test_switch6 deal\r\n");
//		test_switch.DevReadBuf[5] = KeyNoAction;
//		//绝对音量调节 - 音量减
////		C5Music_Info.adjust_volume_type = 0x01;
////		C5Music_Info.set_playback_volume = C5Music_Info.now_playback_volume;
////		C5Music_Info.set_playback_volume--;
//		//相对调节 - 音量减一
//		C5Music_Info.adjust_volume_type = 0x02;
//		C5Music_Info.adjust_volume_operate = 0x01;
//		
//		C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
//	}
//	
//	/*按键处理过,清楚全局按键值*/
//	if(temp2 != 0x00)	
//	{
//		SRAM_Write_Word(0x00,SRAM_LOG_Device_Switch1_Status);	
//		LOG_Save_Global_Parameters();
//	}
//	
//	/*写日志*/
//	if(sd_log_flag == 0x01)
//	{
//		sd_log_flag = 0x00;
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"sd_log_flag \r\n");
//		C5Music_Info.file_start_addr = SRAM_Get_SD_LOG_READ_Start_Address();
//		C5Music_Info.file_end_addr = SRAM_Get_SD_LOG_READ_End_Address();
//		
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"file_start_addr:%08X file_end_addr:%08X \r\n",C5Music_Info.file_start_addr,C5Music_Info.file_end_addr);
//		if(C5Music_Info.file_start_addr > C5Music_Info.file_end_addr)
//		{
//			temp1 = SRAM_LOG_End_Address - C5Music_Info.file_start_addr;
//			temp1 += C5Music_Info.file_end_addr - SRAM_LOG_DATA_Address;
//			C5Music_Info.file_block_num = temp1/512;
//			if(temp1%512 != 0)
//			{
//				C5Music_Info.file_block_num++;
//			}
//			C5Music_Info.file_size = temp1;
//		}else if(C5Music_Info.file_start_addr < C5Music_Info.file_end_addr)
//		{
//			temp1 = C5Music_Info.file_end_addr - C5Music_Info.file_start_addr;
//			C5Music_Info.file_block_num = temp1/512;
//			if(temp1%512 != 0)
//			{
//				C5Music_Info.file_block_num++;
//			}
//			C5Music_Info.file_size = temp1;
//		}
//		
//		Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"file_block_num:%d file_size:%d\r\n",C5Music_Info.file_block_num,C5Music_Info.file_size);
//		C5Music_Info.file_block = 0x00;
//		if(C5Music_Info.file_block_num != 0)
//		{
//			C5Music_Info.control_flag |= C5MUSIC_Write_FILEHEAD_Flag;
//		}else {
//			Dbg_Print(DBG_BIT_DEVICE_STATUS_bit,"sd log not data \r\n");
//		}
//	}
//	
//	/*将数据保存，重新计算校验值*/
//	read_addr = SRAM_Read_DW(SRAM_POLL_Device_List_Addr);
//	SRAM_DMA_Write_Buff((uint8_t *)&test_switch,sizeof(RS485_SWI_INFO),read_addr+Dev_Privately);
//	
//	SRAM_Write_Byte(0x00,read_addr+Dev_Check);				//校验值清零
//	temp = sizeof(RS485_SWI_INFO) + Dev_Privately;
//	crc_val = Dev_CheckSum(read_addr,temp);
//	SRAM_Write_Byte(crc_val,read_addr+Dev_Check);		//校验值重新写入
//	
//	read_addr = SRAM_Device_List_Start_Addr;
//	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),read_addr+Dev_Privately);
//	
//	SRAM_Write_Byte(0x00,read_addr+Dev_Check);				//校验值清零
//	temp = sizeof(BUS_C5MUSIC_INFO) + Dev_Privately;
//	crc_val = Dev_CheckSum(read_addr,temp);
//	SRAM_Write_Byte(crc_val,read_addr+Dev_Check);		//校验值重新写入
//	
//}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Set_Playback_Mode 
* Description    : C5 MUSIC 设置播放模式
* Input          : 
	devaddr	: 设备信息地址
	playback_mode	：播放模式
		BLV_C5MUSIC_Full_Loop			0x00	//全部循环
		BLV_C5MUSIC_Single_Cycle		0x01	//单曲循环
		BLV_C5MUSIC_Folder_Loop			0x02	//文件夹循环
		BLV_C5MUSIC_Random_Cycle		0x03	//随机循环
		BLV_C5MUSIC_Order_CyCle			0x05	//顺序循环
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Set_Playback_Mode(uint32_t devaddr,uint8_t play_mode)
{
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	
	if(devaddr == 0x00) return;
	
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	C5Music_Info.playback_mode = play_mode;
	C5Music_Info.control_flag |= C5MUSIC_Set_Loop_Mode_Flag;
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Playback 
* Description    : C5 MUSIC 播放指定文件夹下某一首
* Input          : 
	devaddr	: 设备信息地址
	play_dir	：播放文件夹
	playback	：播发状态
	play_id		：播发ID
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Playback(uint32_t devaddr,uint8_t play_dir,uint8_t playback,uint8_t play_id)
{	
	if(devaddr == 0x00) return;
	
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	C5Music_Info.playback_fun = playback;
	C5Music_Info.assign_dir = play_dir;
	C5Music_Info.assign_playback_idx = play_id;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	

	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
		
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Doorbell_Dir 
* Description    : C5 MUSIC 播放门铃声
* Input          : 
	devaddr	: 设备信息地址
	id	：播放门铃文件夹中文件名
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Doorbell_Dir(uint32_t devaddr,uint8_t id)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	C5Music_Info.assign_dir = BLV_C5MUSIC_Doorbell_Dir;
	C5Music_Info.assign_playback_idx = id;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Warning_Dir 
* Description    : C5 MUSIC 播放提示音声
* Input          : 
	devaddr	: 设备信息地址
	id	：播放提示音文件夹中文件名
	start ：播放状态
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Warning_Dir(uint32_t devaddr,uint8_t id,uint8_t start)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	C5Music_Info.playback_fun = start;
	C5Music_Info.assign_dir = BLV_C5MUSIC_Warning_Dir;
	C5Music_Info.assign_playback_idx = id;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Greet_Dir 
* Description    : C5 MUSIC 播放欢迎词
* Input          : 
	devaddr	: 设备信息地址
	id	：播放欢迎词文件夹中文件名
	start ：播放状态
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Greet_Dir(uint32_t devaddr,uint8_t id,uint8_t start)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	

	C5Music_Info.playback_fun = start;

	
	C5Music_Info.assign_dir = BLV_C5MUSIC_Greet_Dir;
	C5Music_Info.assign_playback_idx = id;
//	C5Music_Info.set_playback_volume = 20;		//欢迎词音量为15
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Helpsleep_Dir 
* Description    : C5 MUSIC 播放助眠音乐
* Input          : 
	devaddr	: 设备信息地址
	dir：助眠文件夹 
	id	：播放助眠文件夹中文件名
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Helpsleep_Dir(uint32_t devaddr,uint8_t dir,uint8_t id)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	/*静音模式下*/
	if(C5Music_Info.quiet_mode == 0x01)
	{
		C5Music_Info.quiet_mode = 0x00;
		C5Music_Info.adjust_volume_type |= 0x04;
		C5Music_Info.set_quiet_status = 0x01;	//关闭静音
		C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
	}
	
//	if((C5Music_Info.now_playback_status == BLV_C5MUSIC_Playing) && (C5Music_Info.now_playback_dir == dir))
//	{
//		C5Music_Info.playback_fun = BLV_C5MUSIC_Next_Song;
//	}else
//	{
		C5Music_Info.playback_fun = BLV_C5MUSIC_Playing;
		C5Music_Info.helpsleep_tick = SysTick_1s;
//	}
	C5Music_Info.helpsleep_time = 600;	//单位：S
	
//	C5Music_Info.helpsleep_volume = C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice*3;  //23;
//	C5Music_Info.helpsleep_volume =C5Music_Info.set_helpsleep_volume;      //2022-12-16
	C5Music_Info.assign_dir = dir;

	C5Music_Info.assign_playback_idx = id;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Play_Helpsleep_Dir 
* Description    : C5 MUSIC 播放助眠音乐,设置播放时长
* Input          : 
	devaddr	: 设备信息地址
	dir：助眠文件夹 
	id	：播放助眠文件夹中文件名
	time: 播放时间，单位s
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Play_Helpsleep_Dir(uint32_t devaddr,uint8_t dir,uint8_t id, uint16 time)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	/*静音模式下*/
	if(C5Music_Info.quiet_mode == 0x01)
	{
		C5Music_Info.quiet_mode = 0x00;
		C5Music_Info.adjust_volume_type |= 0x04;
		C5Music_Info.set_quiet_status = 0x01;	//关闭静音
		C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
	}
	
//	if((C5Music_Info.now_playback_status == BLV_C5MUSIC_Playing) && (C5Music_Info.now_playback_dir == dir))
//	{
//		C5Music_Info.playback_fun = BLV_C5MUSIC_Next_Song;
//	}else
//	{
		C5Music_Info.playback_fun = BLV_C5MUSIC_Playing;
		C5Music_Info.helpsleep_tick = SysTick_1s;
//	}
	C5Music_Info.helpsleep_time = time;	//单位：S
	
	C5Music_Info.helpsleep_volume = 23;
	C5Music_Info.assign_dir = dir;

	C5Music_Info.assign_playback_idx = id;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Helpsleep_Dir 
* Description    : C5 MUSIC 播放助眠音乐(只播放音乐）
* Input          : 
	devaddr	: 设备信息地址
	dir：助眠文件夹 
	id	：播放助眠文件夹中文件名
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Helpsleep_Dir_Just(uint32_t devaddr,uint8_t dir,uint8_t id)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	/*静音模式下*/
//	if(C5Music_Info.quiet_mode == 0x01)
//	{
//		C5Music_Info.quiet_mode = 0x00;
//		C5Music_Info.adjust_volume_type |= 0x04;
//		//C5Music_Info.set_quiet_status = 0x01;	//关闭静音
//		C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
//	}
	
//	if((C5Music_Info.now_playback_status == BLV_C5MUSIC_Playing) && (C5Music_Info.now_playback_dir == dir))
//	{
//		C5Music_Info.playback_fun = BLV_C5MUSIC_Next_Song;
//	}else
//	{
		C5Music_Info.playback_fun = BLV_C5MUSIC_Playing;
		C5Music_Info.helpsleep_tick = SysTick_1s;
//	}
	C5Music_Info.helpsleep_time = 600;	//单位：S
	
	C5Music_Info.helpsleep_volume = 23;
	C5Music_Info.assign_dir = dir;

	C5Music_Info.assign_playback_idx = id;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Stop_Playback 
* Description    : C5 MUSIC 停止播放
* Input          : 
	devaddr	: 设备信息地址
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Stop_Playback(uint32_t devaddr)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	

	C5Music_Info.playback_fun = BLV_C5MUSIC_Halted;    //2023-2-22
	C5Music_Info.assign_dir = 0x00;
	C5Music_Info.assign_playback_idx = 0x00;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Play_Playback 
* Description    : C5 MUSIC 播放音乐
* Input          : 
	devaddr	: 设备信息地址
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Play_Playback(uint32_t devaddr)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	

	Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"BUS_C5MUSIC_Play_Playback---");
	
//	if(C5Music_Info.now_playback_status==0x00)
//	{
//		C5Music_Info.playback_fun = BLV_C5MUSIC_Halted; 
////		printf("播放控制:暂停\n");
//	}
//	else if(C5Music_Info.now_playback_status==0x01)
//	{
//		C5Music_Info.playback_fun = BLV_C5MUSIC_Playing;
////		printf("播放控制:播放\n");
//	}
	C5Music_Info.playback_fun = BLV_C5MUSIC_Playing;
	C5Music_Info.assign_dir = 0x00;
	C5Music_Info.assign_playback_idx = 0x00;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
//	C5Music_Info.playback_mode = BLV_C5MUSIC_Folder_Loop;
//	C5Music_Info.control_flag |= C5MUSIC_Set_Loop_Mode_Flag;
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*音乐文件夹 - 下一曲*/
void BUS_C5MUSIC_Play_Playback_Next(uint32_t devaddr)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	

	C5Music_Info.playback_fun = BLV_C5MUSIC_Next_Song;
	C5Music_Info.assign_dir = BLV_C5MUSIC_Music_Dir;
	
	/*目前下一曲 只针对音乐文件夹的 1~40 */
	C5Music_Info.assign_playback_idx++;
	if(C5Music_Info.assign_playback_idx >= 3)
	{
		C5Music_Info.assign_playback_idx = 1;
	}
	
	C5Music_Info.assign_playback_idx = 0;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"%s %d",__func__,C5Music_Info.assign_playback_idx);
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}
void BUS_C5MUSIC_Play_Playback_Last(uint32_t devaddr)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	

	C5Music_Info.playback_fun = BLV_C5MUSIC_Prev_Song;
	C5Music_Info.assign_dir = BLV_C5MUSIC_Music_Dir;
	
	/*目前下一曲 只针对音乐文件夹的 1~40 */
	if(C5Music_Info.assign_playback_idx > 0x01)
	{
		C5Music_Info.assign_playback_idx--;
	}else {
		C5Music_Info.assign_playback_idx = 3;
	}
	
	C5Music_Info.assign_playback_idx = 0;
	
	Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"%s %d",__func__,C5Music_Info.assign_playback_idx);
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Pause_Playback 
* Description    : C5 MUSIC 暂停播放音乐
* Input          : 
	devaddr	: 设备信息地址
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Pause_Playback(uint32_t devaddr)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	

	C5Music_Info.playback_fun = BLV_C5MUSIC_Halted;
	C5Music_Info.assign_dir = 0x00;
	C5Music_Info.assign_playback_idx = 0x00;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Playback_Next 
* Description    : C5 MUSIC 播放下一首
* Input          : 
	devaddr	: 设备信息地址]
	dir			: 需要下一首的文件夹
助眠也有下一首的功能，但前期是当前播放处于助眠
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Playback_Next(uint32_t devaddr, uint8_t dir)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	

	C5Music_Info.playback_fun = BLV_C5MUSIC_Next_Song;
	C5Music_Info.assign_dir = dir;
	C5Music_Info.assign_playback_idx = 0x00;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Playback_Prev 
* Description    : C5 MUSIC 播放上一首
* Input          : 
	devaddr	: 设备信息地址]
	dir			: 需要上一首的文件夹
助眠也有上一首的功能，但前期是当前播放处于助眠
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Playback_Prev(uint32_t devaddr, uint8_t dir)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	

	C5Music_Info.playback_fun = BLV_C5MUSIC_Prev_Song;
	C5Music_Info.assign_dir = dir;
	C5Music_Info.assign_playback_idx = 0x00;
	
	C5Music_Info.control_flag |= C5MUSIC_Specify_Play_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Relative_Volume_Plus 
* Description    : C5 MUSIC 相对调节加音量
* Input          : 
	devaddr	: 设备信息地址
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Relative_Volume_Plus(uint32_t devaddr)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	//相对调节 - 音量加一
//	C5Music_Info.adjust_volume_type |= 0x08;
	Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"%s",__func__);
	C5Music_Info.set_playback_volume++;
	if(C5Music_Info.set_playback_volume >= 30)	C5Music_Info.set_playback_volume=30;
	C5Music_Info.adjust_volume_type |= 0x08;
	C5Music_Info.adjust_volume_operate = 0x02;
	C5Music_Info.adjust_volume_loop = 0x03;			//回路1与回路2
	C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Relative_Volume_Plus 
* Description    : C5 MUSIC 相对调节减音量
* Input          : 
	devaddr	: 设备信息地址
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Relative_Volume_Subtraction(uint32_t devaddr)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"%s",__func__);
	//相对调节 - 音量减一
//	C5Music_Info.adjust_volume_type |= 0x08;
	if(C5Music_Info.set_playback_volume != 0x00 )	C5Music_Info.set_playback_volume--;
	
	C5Music_Info.adjust_volume_type |= 0x08;
	C5Music_Info.adjust_volume_operate = 0x01;
	C5Music_Info.adjust_volume_loop = 0x03;			//回路1与回路2
	
	C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Relative_Volume_Plus 
* Description    : C5 MUSIC 相对调节加音量
* Input          : 
	devaddr	: 设备信息地址
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Relative_Volume_PlusValue(uint32_t devaddr, uint8_t value)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	//相对调节 - 音量加value
//	C5Music_Info.adjust_volume_type |= 0x08;
	Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"音量加:%d", value);
	
	C5Music_Info.set_music_volume = C5Music_Info.now_music_volume + value;
	if(C5Music_Info.set_music_volume > 30)	C5Music_Info.set_music_volume = 30;
	
	C5Music_Info.set_tone_volume = C5Music_Info.now_tone_volume + value;
	if(C5Music_Info.set_tone_volume > 30)	C5Music_Info.set_tone_volume = 30;
	
	C5Music_Info.set_door_volume = C5Music_Info.now_door_volume;
	if(C5Music_Info.set_door_volume > 30)	C5Music_Info.set_door_volume = 30;
	
	C5Music_Info.set_playback_volume = 0;      //操作回路音量就不要再发播放音量了，不然设置不能生效
	C5Music_Info.adjust_volume_type |= 0x10;
	C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Relative_Volume_Plus 
* Description    : C5 MUSIC 相对调节减音量
* Input          : 
	devaddr	: 设备信息地址
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Relative_Volume_SubtractionValue(uint32_t devaddr, uint8_t value)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	//相对调节 - 音量减value
//	C5Music_Info.adjust_volume_type |= 0x08;
	Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"音量减:%d", value);
	
	if(C5Music_Info.now_music_volume > value)	C5Music_Info.set_music_volume = C5Music_Info.now_music_volume - value;
	else C5Music_Info.set_music_volume = 0;
	
	if(C5Music_Info.now_tone_volume > value)	C5Music_Info.set_tone_volume = C5Music_Info.now_tone_volume - value;
	else C5Music_Info.set_tone_volume = 0;
	
	C5Music_Info.set_door_volume = C5Music_Info.now_door_volume;
	if(C5Music_Info.set_door_volume > 30)	C5Music_Info.set_door_volume = 30;
	
	C5Music_Info.set_playback_volume = 0;      //操作回路音量就不要再发播放音量了，不然设置不能生效
	C5Music_Info.adjust_volume_type |= 0x10;
	C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
	
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Set_Quiet_Mode 
* Description    : C5 MUSIC 静音模式
* Input          : 
	devaddr	: 设备信息地址
start ： 设置状态
	0x00：关闭
	0x01：开启静音
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Set_Quiet_Mode(uint32_t devaddr)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	/*静音状态取反*/
	if(C5Music_Info.quiet_mode == 0x00)		//	
	{
		C5Music_Info.quiet_mode = 0x01;		
		
		C5Music_Info.adjust_volume_type |= 0x04;
		C5Music_Info.set_quiet_status = 0x00;	//开启静音
		
		C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
	}else
	{
		C5Music_Info.quiet_mode = 0x00;		
		
		C5Music_Info.adjust_volume_type |= 0x04;
		C5Music_Info.set_quiet_status = 0x01;	//关闭静音
		
		C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
	}
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}


void BUS_C5MUSIC_Set_Quiet_Mode2(uint32_t devaddr,uint8_t status)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	

	if(status == 0x00)		
	{
		C5Music_Info.adjust_volume_type |= 0x04;
		C5Music_Info.set_quiet_status = 0x01;	//关闭静音
		
		C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
		
	}else
	{
		C5Music_Info.adjust_volume_type |= 0x04;
		C5Music_Info.set_quiet_status = 0x00;	//开启静音
		
		C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
		
	}

	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Set_Global_Volume 
* Description    : C5 MUSIC 设置全局音量
* Input          : 
	devaddr	: 设备信息地址
vel ： 设置全局音量 0~100

* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Set_Global_Volume(uint32_t devaddr,uint8_t vel)
{
	if(devaddr == 0x00) return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	

	
	C5Music_Info.adjust_volume_type |= 0x02;
	C5Music_Info.set_global_volume = vel;
	C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;

	if(vel == 0x00)
	{
		C5Music_Info.quiet_mode = 0x01;
	}else {
		C5Music_Info.quiet_mode = 0x00;
	}

	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Set_LoopVolume
* Description    : C5 MUSIC 设置回路音量
* Input          : 
	devaddr	: 设备信息地址
	loop：
		0x01：音乐回路
		0x02：提示音回路
		0x03：门铃回路
	vel ： 设置回路音量 0~30

* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Set_LoopVolume(uint32_t devaddr,uint8_t loop,uint8_t vel)
{
	if(devaddr == 0x00)	return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	switch(loop)
	{
		case 0x01:		//音乐
			C5Music_Info.set_music_volume = vel;
			C5Music_Info.adjust_volume_type |= 0x10;
			C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
			break;
		case 0x02:		//提示音
			C5Music_Info.set_tone_volume = vel;
			C5Music_Info.adjust_volume_type |= 0x10;
			C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
			break;
		case 0x03:		//门铃
			C5Music_Info.set_door_volume = vel;
			C5Music_Info.adjust_volume_type |= 0x10;
			C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
			break;
	}
	
	BUS_Public.check = 0x00;
	BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
	SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
	SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
}

/*******************************************************************************
* Function Name  : BUS_C5MUSIC_Set_LoopVolume_2
* Description    : C5 MUSIC 设置回路音量
* Input          : 
	devaddr	: 设备信息地址
	loop：
				bit0:0x01：音乐回路
				bit1:0x01：提示音回路
				bit2:0x01：门铃回路
	vel ： 设置回路音量 0~30
* Return         :	NONE
*******************************************************************************/
void BUS_C5MUSIC_Set_LoopVolume_2(uint32_t devaddr,uint8_t loop,uint8_t vel)
{
	uint16_t temp = 0;
	if(devaddr == 0x00)	return;
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	if((loop & 0x01))   //音乐
	{
		C5Music_Info.set_music_volume = vel;
		temp++;
	}
	if((loop & 0x02))   //提示音
	{
		C5Music_Info.set_tone_volume = vel;
		temp++;
	}
	if((loop & 0x04))   //门铃
	{
		C5Music_Info.set_door_volume = vel;
		temp++;
	}
	
	if(temp)
	{
		C5Music_Info.set_playback_volume = 0;     //操作回路音量就不要再发播放音量了，不然设置不能生效
		C5Music_Info.adjust_volume_type |= 0x10;
		C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
		
		BUS_Public.check = 0x00;
		BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
		SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),devaddr);/*将数据保存*/
		SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	}
	
}


/*******************************************************************************
* Function Name  : Get_BUS_C5MUSIC_Loop_Volume
* Description    : C5 MUSIC 获取回路音量
* Input          : 
	devaddr	: 设备信息地址
	loop：
		0x01：音乐回路
		0x02：提示音回路
		0x03：门铃回路
		0x04：全局百分比
* Return         :	回路音量值
*******************************************************************************/
uint8_t Get_BUS_C5MUSIC_Loop_Volume(uint32_t devaddr,uint8_t loop)
{
	uint8_t volume = 0;
	if(devaddr == 0x00)	return 0x02;
	
	Device_Public_Information_G BUS_Public;
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),devaddr);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	switch(loop)
	{
		case 0x01:
			volume = C5Music_Info.now_music_volume;
			break;
		case 0x02:
			volume = C5Music_Info.now_tone_volume;
			break;
		case 0x03:
			volume = C5Music_Info.now_door_volume;
			break;
		case 0x04:
			volume = C5Music_Info.now_global_volume;
			break;
	}
	return volume;
}

/*获取在线状态*/
uint8_t Get_BUS_C5MUSIC_Online_Status(uint32_t devaddr)
{
	if(devaddr == 0x00)	return 0x02;
	
	BUS_C5MUSIC_INFO C5Music_Info;
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);
	
	if(C5Music_Info.DevOffline == DEV_IS_ONLINE)
	{
		return 0x01;
	}
	return 0x02;
}

void BLV_Music_CtrlState_Get(DEV_MUSIC_CTRLSTATE *music_state,uint16_t Output_state )
{
	if(music_state == NULL)	return ;
	
	music_state->DevMusicCtrlWay.CtrlDirect = Output_state & 0x000F;
	music_state->DevMusicCtrlWay.CtrlDir = (Output_state >> 4) & 0x000F;
	music_state->CtrlCont.CtrlVoice = (Output_state >> 8) & 0x00FF;
}

/**
*@name 背景音乐控制函数
*@para
*  DevAddrIn            设备输入
*  DevInputLoop         输入回路
*  DevAddrOut           设备输出
*  DevOutputLoop        输出回路
*  DevOutputType        输出类型
*/
void Logic_Music_Ctrl(uint32_t DevAddrIn, uint16_t DevInputLoop, uint32_t DevAddrOut, uint16_t DevOutputLoop, uint16_t DevOutputType)
{
	DEV_MUSIC_CTRLSTATE DevMusicCtrlState;    //背景音乐控制状态
	Device_Public_Information_G BUS_Public;	
	BUS_C5MUSIC_INFO C5Music_Info;
	uint8_t KeepFlag = 0x00;
	uint8_t KeepFlag1 = 0x00;
	
	if(NULL == DevAddrOut)
	{
		return ;
	}
	
	SRAM_DMA_Read_Buff((uint8_t *)&BUS_Public,sizeof(Device_Public_Information_G),DevAddrOut);				
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),DevAddrOut+Dev_Privately);

	if(DevOutputLoop >= MUSICLOOPMAX)
	{
		return ;
	}
	
	Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"Music Ctrl State:%04X",DevOutputType);
	
	BLV_Music_CtrlState_Get(&DevMusicCtrlState,DevOutputType);
	
	switch(DevMusicCtrlState.DevMusicCtrlWay.CtrlDirect)   //功能
	{
		case 0x00:  //功能
			switch(DevMusicCtrlState.DevMusicCtrlWay.CtrlDir)
			{
				case 0x01: //播放
					BUS_C5MUSIC_Play_Playback(DevAddrOut);    //数据在里面保存
					break;
				case 0x02: //暂停
					BUS_C5MUSIC_Stop_Playback(DevAddrOut);    //数据在里面保存
					break;
				case 0x03: //上一曲
					BUS_C5MUSIC_Play_Playback_Last(DevAddrOut);
					break;
				case 0x04: //下一曲
					BUS_C5MUSIC_Play_Playback_Next(DevAddrOut);
					break;    
				case 0x05: //音量加     目前按照10级音量进行加减，每次加减一级
					Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"执行背景音乐控制，音量加");
					KeepFlag1 = 0x03;
					if(C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice < MUSICVOICELEVELMAX)  //音量加的设置音乐音量和提示音音量的回路固定为0和1    2022-06-28
					{
						KeepFlag = 0x01;
						C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice++;
						C5Music_Info.set_music_volume = C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice*3;
					}
					
					if(C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice < MUSICVOICELEVELMAX)
					{
						KeepFlag = 0x01;
						C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice++;
						C5Music_Info.set_tone_volume = C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice*3;
					}
					

					break;
				case 0x06: //音量减     目前按照10级音量进行加减，每次加减一级
					Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"执行背景音乐控制，音量减");
					KeepFlag1 = 0x03;
					if(C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice > MUSICVOICELEVELMIN)  //音量减的设置音乐音量和提示音音量的回路固定为0和1    2022-06-28
					{
						KeepFlag = 0x01;
						C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice--;
						C5Music_Info.set_music_volume = C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice*3;
					}
					if(C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice > MUSICVOICELEVELMIN)
					{
						KeepFlag = 0x01;
						C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice--;	
						C5Music_Info.set_tone_volume = C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice*3;							
					}

//					if(C5Music_Info.now_helpsleep_volume >0)
//					{
//						KeepFlag = 0x01;
//						if(C5Music_Info.now_helpsleep_volume-3<=0)
//						{
//							C5Music_Info.set_helpsleep_volume = 1;
//						}
//						else
//						{
//							C5Music_Info.set_helpsleep_volume = C5Music_Info.now_helpsleep_volume-3;
//						}
//					}					
					break;
				case 0x07: //设定音乐音量
					if( DevMusicCtrlState.CtrlCont.CtrlVoice <= MUSICVOICELEVELMAX )  //内容      
					{
						KeepFlag = 0x01;
						KeepFlag1 = 0x03;
//						C5Music_Info.set_music_volume = UINT8DATACONVER(DevMusicCtrlState.CtrlCont)*3;
						C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice = DevMusicCtrlState.CtrlCont.CtrlVoice;   //设置音乐音量前先将值赋值给对应的当前背景音乐状态位     2022-06-28
						C5Music_Info.set_music_volume = C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice*3;
					}
					break;
				case 0x08: //设定提示音音量
					if( DevMusicCtrlState.CtrlCont.CtrlVoice <= MUSICVOICELEVELMAX)  //内容     
					{
						KeepFlag = 0x01;
						KeepFlag1 = 0x03;
//						C5Music_Info.set_tone_volume = UINT8DATACONVER(DevMusicCtrlState.CtrlCont)*3;
						C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice = DevMusicCtrlState.CtrlCont.CtrlVoice;  //设置提示音音量前先将值赋值给对应的当前背景音乐状态位     2022-06-28
						C5Music_Info.set_tone_volume = C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice*3;
					}					
					break;
				case 0x09: //设定门铃音量
					if( DevMusicCtrlState.CtrlCont.CtrlVoice <= MUSICVOICELEVELMAX )  //内容
					{
						KeepFlag = 0x01;
						KeepFlag1 = 0x03;
//						C5Music_Info.set_door_volume = UINT8DATACONVER(DevMusicCtrlState.CtrlCont)*3;
						C5Music_Info.BackMusicState[2].CtrlCont.CtrlVoice = DevMusicCtrlState.CtrlCont.CtrlVoice;  //设置门铃、欢迎词音量前先将值赋值给对应的当前背景音乐状态位     2022-06-28
						C5Music_Info.set_door_volume = C5Music_Info.BackMusicState[2].CtrlCont.CtrlVoice*3;
					}					
					break;
				case 0x0A: //设置绝对音量   2023-02-27
//					Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"设定绝对音量：%d",UINT8DATACONVER(DevMusicCtrlState.CtrlCont));
//					if(UINT8DATACONVER(DevMusicCtrlState.CtrlCont) <= MUSICVOICELEVELMAX)  //内容
//					{
//						KeepFlag = 0x01;
//						KeepFlag1 = 0x01;
//						C5Music_Info.set_playback_volume = UINT8DATACONVER(DevMusicCtrlState.CtrlCont)*3;
//					}
//					break;
//				case 0x0B: //设置全局音量   2023-02-27
					Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"设定全局百分比音量：%d",DevMusicCtrlState.CtrlCont.CtrlVoice);
					if(DevMusicCtrlState.CtrlCont.CtrlVoice <= MUSICVOICELEVELMAX)
					{
						KeepFlag = 0x01;
						KeepFlag1 = 0x02;
						C5Music_Info.set_global_volume = DevMusicCtrlState.CtrlCont.CtrlVoice*10;
					}
					break;
				case 0x0C:  //设定助眠音乐音量
					if(DevMusicCtrlState.CtrlCont.CtrlVoice <= MUSICVOICELEVELMAX)  //内容     
					{
						KeepFlag = 0x01;
						C5Music_Info.helpsleep_volume = DevMusicCtrlState.CtrlCont.CtrlVoice*3;
					}	
					break;
			}
			break;
		case 0x01:  //开机
			break; 
		case 0x02:  //关机
			break;
		case 0x03:  //场景开时播放
		case 0x04:  //场景关时播放
			Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"执行背景音乐控制，回路:%d 状态: %04X",DevOutputLoop, DevOutputType);				
			switch(DevMusicCtrlState.DevMusicCtrlWay.CtrlDir)      //
			{
				case 0x00:  //音乐文件夹
//							BUS_C5MUSIC_Warning_Dir(DevAddrOut,0x0D,BLV_C5MUSIC_Single_Play);	//按键提示音
					break;
				case 0x01:  //提示音文件夹
					Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"Tone Index:%d",DevMusicCtrlState.CtrlCont.CtrlVoice);
					switch(DevMusicCtrlState.CtrlCont.CtrlVoice)
					{
						case 0x01:   //提示音
						case 0x06:   //清理模式
						case 0x09:   //勿扰模式
						case 11:     //空调开机
						case 12:     //空调关机
						case 18:     //预约退房
						case 19:     //取消退房
						case 20:     //SOS紧急呼叫已开启
						case 21:     //SOS紧急呼叫已关闭
						case 22:     //取消清理
						case 23:     //取消勿扰
						case 24:     //是否需要退房
						case 160:    //制冷模式
						case 161:    //制热模式
						case 162:    //送风模式
						case 163:    //低风速
						case 164:    //中风速
						case 165:    //高风速
						case 167:
						case 168:
						case 169:
							BUS_C5MUSIC_Warning_Dir(DevAddrOut,DevMusicCtrlState.CtrlCont.CtrlVoice,BLV_C5MUSIC_Forestall);	//抢先播放
							break;
						default:
							BUS_C5MUSIC_Warning_Dir(DevAddrOut,DevMusicCtrlState.CtrlCont.CtrlVoice,BLV_C5MUSIC_Single_Play);	//单曲播放 									
							break;
					}
					break;
				case 0x02:  //助眠文件夹
					BUS_C5MUSIC_Helpsleep_Dir(DevAddrOut, BLV_C5MUSIC_Helpsleep_Dir, 0x01);
					break;
				case 0x03:  //门铃文件夹
					BUS_C5MUSIC_Doorbell_Dir(DevAddrOut, 0x05);
					break;
				case 0x04:  //欢迎词文件夹
					BUS_C5MUSIC_Greet_Dir(DevAddrOut, DevMusicCtrlState.CtrlCont.CtrlVoice, BLV_C5MUSIC_Single_Play);	//欢迎词  单曲播放
					break;
				case 0x05:  //助眠文件夹 冥想
					BUS_C5MUSIC_Helpsleep_Dir(DevAddrOut,BLV_C5MUSIC_Helpsleep1_Dir,0x01);
					break;
				case 0x06:  //助眠文件夹 海浪
					BUS_C5MUSIC_Helpsleep_Dir(DevAddrOut,BLV_C5MUSIC_Helpsleep2_Dir,0x01);
					break;
				case 0x07:  //助眠文件夹 森林
					BUS_C5MUSIC_Helpsleep_Dir(DevAddrOut,BLV_C5MUSIC_Helpsleep3_Dir,0x01);							
					break;
			}
			break;
	}
	if(KeepFlag)
	{
		if(KeepFlag1==0x02)
		{
			C5Music_Info.adjust_volume_type |= 0x02;   //设置全局音量   2023-02-27
			C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
		}
		else if(KeepFlag1 == 0x03)
		{
			C5Music_Info.set_playback_volume = 0;     //操作回路音量就不要再发播放音量了，不然设置不能生效
			C5Music_Info.adjust_volume_type |= 0x10;
			C5Music_Info.control_flag |= C5MUSIC_Set_Volume_Flag;
		}
		
		
		BUS_Public.check = 0x00;
		BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&C5Music_Info, sizeof(BUS_C5MUSIC_INFO));
		SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),DevAddrOut);/*将数据保存*/
		SRAM_DMA_Write_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),DevAddrOut+Dev_Privately);

		Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"BLV背景音乐音量调节: 音量：%d", C5Music_Info.BackMusicState[0].CtrlCont.CtrlVoice);
		Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"BLV提示音乐音量调节: 音量：%d", C5Music_Info.BackMusicState[1].CtrlCont.CtrlVoice);	
		Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"BLV门铃音乐音量调节: 音量：%d", C5Music_Info.BackMusicState[2].CtrlCont.CtrlVoice);
		
	}	
//	BUS_C5MUSIC_Set_LoopVolume_2(DevAddrOut, DevOutputLoop, C5Music_Info.BackMusicState[DevOutputLoop].CtrlCont.CtrlVoice*3);  //音量的值放大3倍传入
}

uint16_t Dev_Music_Loop_State(uint32_t devaddr, uint16_t DevOutputLoop)      //2023-02-28
{	
	BUS_C5MUSIC_INFO C5Music_Info;      //开关局部变量
	uint8_t status = 0x00;
	
	if(devaddr == 0x00)	return 0x00;
	
	SRAM_DMA_Read_Buff((uint8_t *)&C5Music_Info,sizeof(BUS_C5MUSIC_INFO),devaddr+Dev_Privately);	
	
	if(C5Music_Info.now_playback_type == 0x01)    //房间音乐
	{
		if(C5Music_Info.now_playback_status == 0x00)     //播放
		{
			status = 0x01;
		}
		else if(C5Music_Info.now_playback_status == 0x01)  //暂停 
		{
			status = 0x02;
		}
	}
	return status;
}
