
/**
  ******************************************************************************
  * @file    BLV_485_Dev_FreegoLockFun.c
  * @author  BLW RCU  development Team
  * @version V1.0.0
  * @date    2021年11月02日
  * @brief   微信锁驱动总表         可以控制开锁关锁，以及得到锁的状态
	*          目前仅用于微信锁
	* 
  ******************************************************************************
  */

#include "includes.h"

#include "BLV_485_Dev_FreegoLockFun.h"
#include "string.h"

#define LOCKCYCLEWAITTIMEOUT       5000    //无线锁轮询超时等待时间    控制结束后便进入轮询
#define WEIXINCYCLEMAX  50
#define WEIXINCYCLEMIN  1

#define FREEGOMESSAGEWAITTIME 200  //发送透传内容灯带时间
#define FREEGOCYCLEWAITTIME    400  //发送轮询报文
#define FREEGOCTRLWAITTIME    200  //发送控制报文
#define FREEGOASKWAITTIME     20    //回复确认报文

#define FREEGOCYCLEENSURECMD   0x02  //收到轮询回复，下发确认报文
#define FREEGOTOUCENSURECMD    0xB1  //收到透传上报，下发确认报文
#define FREEGOMACGETENSURECMD    0xC1  //收到联网请求，下发主机MAC  一般上电时会得到一次

#define FREEGOWXLOCKASKLEN     0x07
#define FREEGOWXLOCKASKMACLEN     19

#define FREEGOHEADLEN    0x06        //福瑞狗报文头长度
#define FREEGOMACLEN     0x06        //福瑞狗MAC地址长度
#define FREEGONETSTATELEN 0x01       //联网状态1个字节

void Freego_Rs485_WxLock_Pro(uint8_t *Data, CFG_Dev_AddP CfgDevAdd);

uint8_t Freego_Rs485_WxLock_CtrlCycle(uint32_t dev_addr); 
uint8_t Freego_WxLock_Read(uint32_t dev_addr,uint32_t data_addr,uint16_t len);
void Freego_WxLock_Ctrl(Device_Public_Information_G *BUS_Public, RS485_WxLock_INFOP Rs485WxLockInfo,uint32_t dev_addr);
void Freego_WxLock_ToucSend(Device_Public_Information_G *BUS_Public, RS485_WxLock_INFOP Rs485WxLockInfo,uint32_t dev_addr);
void Freego_WxLock_Cycle(Device_Public_Information_G *BUS_Public, RS485_WxLock_INFOP Rs485WxLockInfo);
void Freego_Rs485_WxLock_Ask(Device_Public_Information_G *BUS_Public, RS485_WxLock_INFOP Rs485WxLockInfo, uint8_t Cmd, uint8_t *Data, uint8_t DataLen);

/*******************************************************************************
* @Function Name  : BLW_RS485_FreegoLockFun_Init 
* @Description    : 添加设备到链表 - 主动设备
* @Input          : 
	@type	: 添加的设备类型
	@addr	: 添加的设备地址
	@polling_cf		：设备的数据发送回调函数
	@processing_cf	：设备的数据处理回调函数
* @Return         : None
*******************************************************************************/
void Freego_RS485_WxLockFun_Init(Device_Public_Information_G *BUS_Public, RS485_WxLock_INFO *Rs485WxLockInfo)
{
//	Device_Public_Information_G BUS_Public;
//	RS485_WxLock_INFO Rs485WxLockInfo;
	
//	memset(&BUS_Public,0,sizeof(Device_Public_Information_G));
//	memset(&Rs485WxLockInfo,0,sizeof(RS485_WxLock_INFO));
	
//	BUS_Public.addr = devaddr;		//设备地址
//	BUS_Public.type = DEV_RS485_WxLock;		//设备类型
//	BUS_Public.port = Active_Port;		//设备发送端口
//	BUS_Public.baud = 9600;		//设备发送波特率
//	BUS_Public.retry_num = 0x03;	//设备数据重发次数
//	BUS_Public.wait_time = 0x0064;	//设备数据发送等待回复时间 - 100ms
	BUS_Public->polling_cf = (uint32_t)&Freego_Rs485_WxLock_CtrlCycle;
	BUS_Public->processing_cf = (uint32_t)&Freego_WxLock_Read;
	

	
	
}


/*门锁轮询控制函数*/
uint8_t Freego_Rs485_WxLock_CtrlCycle(uint32_t dev_addr)
{
//	static uint8_t CycleCnt = 0;
	uint8_t Ret = RS485OCCUPYNOTIME;
	RS485_WxLock_INFO  Rs485WxLockInfo;
	Device_Public_Information_G BUS_Public;
//	uint16_t DataLen;
//	uint8_t Crc_buf;
	uint8_t OnlineJudggeFlag = 0x00;   //判断标准  一定会回复

//	CfgDevAddRfGatewayHost = HostRunInfo.CfgDevAddGateway;
//	if(0x00 == dev_addr)
//	{
//		return Ret;
//	}
	

	SRAM_Read_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), dev_addr);  
	SRAM_Read_Buff((uint8_t *)&Rs485WxLockInfo, sizeof(RS485_WxLock_INFO), dev_addr+Dev_Privately);//
	
//	if(0x01 == Rs485WxLockInfo.WeixinCtrlFlag)
//	{
//		Rs485WxLockInfo.WeixinCtrlFlag = 0x00;
//		Dbg_Println(DBG_BIT_LOGIC_STATUS_bit,"福瑞狗请求开锁置位");		//				
//		Rs485WxLockInfo.WeixinAskLockFlag = 0x01;   //请求开锁标志置位
//	}

	if(0x01 == Rs485WxLockInfo.WeixinDownSendFlag)                       //下行标志
	{
		if(0x00 != Rs485WxLockInfo.WeixinDownSendCnt)
		{
			Rs485WxLockInfo.WeixinDownSendCnt--;   //递减
		}
		else if(0x00 == Rs485WxLockInfo.WeixinDownSendCnt)
		{
			Rs485WxLockInfo.WeixinDownSendFlag = 0;
		}
		Freego_WxLock_ToucSend(&BUS_Public, &Rs485WxLockInfo,dev_addr);//控制开锁
		OnlineJudggeFlag = 0x01;		
	}
	else
	{
		Freego_WxLock_Cycle(&BUS_Public, &Rs485WxLockInfo);//轮询微信锁
		Ret = RS485OCCUPYTIME;   //只有轮询即使不回复也会占用时间片
	}
	
//	{
//	//	if(DEV_IS_ONLINE == Rs485WxLockInfo.DevOffline)  //唯有在线，才会控制。意思就是先接收到锁的状态，才会在线
//		{
//			if(0x01 == Rs485WxLockInfo.WeixinTimeSetFlag)                       //设置微信锁睡眠时间
//			{
//				if(0x00 != Rs485WxLockInfo.WeixinTimeSetCnt)
//				{
//					Rs485WxLockInfo.WeixinTimeSetCnt--;   //递减
//				}
//				else if(0x00 == Rs485WxLockInfo.WeixinTimeSetCnt)
//				{
//					Rs485WxLockInfo.WeixinTimeSetFlag = 0;
//				}
////				WxLock_TimeSet(dev_addr, Rs485WxLockInfo.RfGatewayHostAddr);//控制开锁，控制开锁标志，在保证主机接收到微信锁的回复才会清0 控制微信开锁之后，到读取为锁关之前都是高速轮询
//				Ret = 0x01;
//			}
//			else if(0x01 == Rs485WxLockInfo.WeixinCtrlFlag)  //微信锁控制标志位
//			{
//				if(SysTick_1ms >= Rs485WxLockInfo.WeixinCycleCnt)  //超过时间   
//				{
//					Rs485WxLockInfo.WeixinCycleCnt = SysTick_1ms + LOCKCYCLEWAITTIMEOUT;
//					if(0x00 != Rs485WxLockInfo.WeixinCtrlSendCnt)
//					{
//						Rs485WxLockInfo.WeixinCtrlSendCnt--;   //递减
//					}
//					else if(0x00 == Rs485WxLockInfo.WeixinCtrlSendCnt)
//					{
//						Rs485WxLockInfo.WeixinCtrlFlag = 0;
//					}
//					Freego_WxLock_Ctrl(&BUS_Public, &Rs485WxLockInfo,dev_addr);//控制开锁，控制开锁标志，在保证主机接收到微信锁的回复才会清0 控制微信开锁之后，到读取为锁关之前都是高速轮询
//					Ret = 0x01;
//				}
//			}
//		}
//	}

	if(0x01 == OnlineJudggeFlag)
	{
		Ret = RS485OCCUPYTIME;    //唯有1才会赋值		
		/*通讯统计*/
		BLV_Communication_Record(&Rs485WxLockInfo.comm_record,0x01,0x00);
		
		if(Rs485WxLockInfo.DevSendCnt > WxLockCtrlSendMax)
		{
			if(Rs485WxLockInfo.DevOffline != DEV_IS_OFFLINE)
			{
				Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"FreegoWxLock DEV_IS_OFFLINE");
				LOG_Device_Online_Record(DEV_RS485_WxLock,SRAM_Read_Byte(dev_addr+Dev_Addr),LogInfo_Device_Offline);	//记录设备离线
			}
			Rs485WxLockInfo.DevOffline = DEV_IS_OFFLINE;   //判为离线
			if(Rs485WxLockInfo.DevOffline != Rs485WxLockInfo.DevOfflineLast)	//当前在线状态不等于上一次在线状态
			{
				Rs485WxLockInfo.DevOfflineLast = Rs485WxLockInfo.DevOffline;	//更新上一次在线状态
				Write_Device_Fault_State(BUS_Public.type,BUS_Public.addr,In_ErrFun_LineState,DEV_IS_OFFLINE);	//保存设备在线状态到SRAM
			}
		}
		else
		{
			Rs485WxLockInfo.DevSendCnt++;
		}
		
		/*每次遍历都会保存*/
		{
			BUS_Public.check = 0x00;
			BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&Rs485WxLockInfo, sizeof(RS485_WxLock_INFO));
			SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),dev_addr);/*将数据保存*/
			SRAM_DMA_Write_Buff((uint8_t *)&Rs485WxLockInfo,sizeof(RS485_WxLock_INFO),dev_addr+Dev_Privately);							
		}
		
	}

	return Ret;
}

//#define GatewayCTRLLEN     8         //微信锁控制报文

/**
  * @brief      门锁控制发送函数
  * @param  
  *    CfgDevAddOut        设备节点
  * @retval     无
  * @attention   只负责开锁
  */
void Freego_WxLock_ToucSend(Device_Public_Information_G *BUS_Public, RS485_WxLock_INFOP Rs485WxLockInfo,uint32_t dev_addr)
{
		                      //头   命令 校验   长度        地址  命令   校验  长度
	uint8_t SendData[FREEGOHEADLEN+WXLOCKDOWNMESSAGELEN] = {0xA7, 0xA0, 0x51, 0x03, 0x00, 0x00, 0x01};
	
	SendData[3] = Rs485WxLockInfo->WeixinDownMessageLen+0x02;  //长度赋值
	SendData[5] = BUS_Public->addr;
	memcpy(&SendData[FREEGOHEADLEN], Rs485WxLockInfo->WeixinDownMessage, Rs485WxLockInfo->WeixinDownMessageLen);
	SendData[2] = CheckSum_Overlook_Check(SendData, (FREEGOHEADLEN+Rs485WxLockInfo->WeixinDownMessageLen), 0x02);  //和校验取反


	
	

	{	
		MCU485_SendString(BUS_Public->port,SendData,(FREEGOHEADLEN+Rs485WxLockInfo->WeixinDownMessageLen));

		/*日志记录*/
		LOG_Device_COMM_Send_Control_Record(BUS_Public->port,BUS_Public->baud,SendData,FREEGOHEADLEN+Rs485WxLockInfo->WeixinDownMessageLen);
//		RS485_Port_SendFun(CfgDevAdd, SendBuf, GatewayCTRLLEN, LOCKCTRLTIMEOUT); 
	}		
}

/*门锁轮询函数*/
#define FREEGOWXLOCKCYCLELEN   0x07
void Freego_WxLock_Cycle(Device_Public_Information_G *BUS_Public, RS485_WxLock_INFOP Rs485WxLockInfo)
{
//	uint8_t SendData[10] =  {0x3D, 0x00, 0x13, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0x60, 0xB1};
	uint8_t SendData[FREEGOWXLOCKCYCLELEN] = {0xA5, 0x00, 0x00, 0x03, 0x00, 0x00,0x00};	  
	SendData[5] = BUS_Public->addr;
	
	SendData[2] = CheckSum_Overlook_Check(SendData, FREEGOWXLOCKCYCLELEN, 0x02);  //和校验取反
	
	MCU485_SendString(BUS_Public->port,SendData,FREEGOWXLOCKCYCLELEN);

}


#define IsMyData     0x00  
#define IsNotMyData  0x01

#define RECLENMAX    100   //超过100个字节，直接返回

/**
  * @name  			  无线微信锁接收处理函数
  * @param  
  *    dev_addr   设备信息地址
  *    data_addr  485数据包地址
  *    DataLen    数据包长度
  * @retval      1 是我的数据    2 不是我的数据
  * @attention   
	*              
  */
uint8_t Freego_WxLock_Read(uint32_t dev_addr,uint32_t data_addr,uint16_t DataLen)
{
	uint8_t Crc_buf;
	RS485_WxLock_INFO  Rs485WxLockInfo;   //微信锁局部变量
	uint8_t Ret = IsNotMyData;
	uint8_t Data[RECLENMAX];     //局部变量，用于存储485数据
//	uint8_t DevAddr = SRAM_Read_Byte(dev_addr+Dev_Addr);   //设备地址	
	Device_Public_Information_G BUS_Public;
	
	if((NULL == dev_addr) || (DataLen > RECLENMAX))   //传的参数异常就直接返回
	{
		return Ret;
	}
	SRAM_Read_Buff(Data, DataLen, data_addr);   //将485数据拷贝出来 
	SRAM_Read_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), dev_addr);
	SRAM_Read_Buff((uint8_t *)&Rs485WxLockInfo, sizeof(RS485_WxLock_INFO), dev_addr+Dev_Privately);
	
	if((Data[0] != 0xA5) && (Data[0] != 0xA6) && (Data[0] != 0xA7))  //唯有A5 A6 A7才继续运行
	{
		return Ret;
	}
	if((Data[5] != BUS_Public.addr) || (DataLen != Data[3]+0x04))
	{
		return Ret;    //地址不对，直接返回
	} 
	
	Crc_buf = CheckSum_Overlook_Check(Data, DataLen, 2);  //提前保存校验

	if(Crc_buf == Data[2])   //校验判断     是否是自己的类型
	{
		Ret = IsMyData;
		
		if(Rs485WxLockInfo.DevOffline != DEV_IS_ONLINE)
		{
			Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"Rs485WxLock DEV_IS_ONLINE");
			LOG_Device_Online_Record(DEV_RS485_WxLock,SRAM_Read_Byte(dev_addr+Dev_Addr),LogInfo_Device_Online);	//记录设备在线
		}
		
		Rs485WxLockInfo.DevSendCnt = 0x00;
		Rs485WxLockInfo.DevOffline = DEV_IS_ONLINE;    //设备在线
		BLV_Communication_Record(&Rs485WxLockInfo.comm_record,0x02,0x01);		//记录通讯成功
		if(Rs485WxLockInfo.DevOffline != Rs485WxLockInfo.DevOfflineLast)	//当前在线状态不等于上一次在线状态
		{
			Rs485WxLockInfo.DevOfflineLast = Rs485WxLockInfo.DevOffline;	//更新上一次在线状态
			Write_Device_Fault_State(BUS_Public.type,BUS_Public.addr,In_ErrFun_LineState,DEV_IS_ONLINE);	//保存设备在线状态到SRAM
		}
		switch(Data[0])
		{
			case 0xA5:   //
			case 0xA6:
			case 0xA7:
				switch(Data[1])  //命令
				{
					case 0xCC:  //蓝牙模块发指令到联网设备
							Freego_Rs485_WxLock_Ask(&BUS_Public, &Rs485WxLockInfo,FREEGOCYCLEENSURECMD,Data, DataLen);//需要立即回复一条0x02命令，告知对方自己已收到回复
						break;
					case 0x01:  //对于0xDD控制报文的确认回复
						switch(Data[6])   
						{
							case 0xE0:   //成功
								break;
						}
						break;
					case 0xC0:  //蓝牙主机请求联网设备信息
						Freego_Rs485_WxLock_Ask(&BUS_Public, &Rs485WxLockInfo, FREEGOMACGETENSURECMD, Data, DataLen);//需要立即回复一条0xC1命令，
						break;
					case 0xA1:  //对于0xA0透传数据的确认回复
						Rs485WxLockInfo.WeixinDownSendFlag = 0x00;
						break;
					case 0xB0:  //蓝牙主机需要透传到云端消息
						Freego_Rs485_WxLock_Ask(&BUS_Public, &Rs485WxLockInfo,FREEGOTOUCENSURECMD, Data, DataLen);//需要立即回复一条B1命令，表示已收到
						break;
				}
				break;
		}
		BUS_Public.check = 0x00;
		BUS_Public.check = DoubleData_CheckSum((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G), (uint8_t *)&Rs485WxLockInfo, sizeof(RS485_WxLock_INFO));
		SRAM_DMA_Write_Buff((uint8_t *)&BUS_Public, sizeof(Device_Public_Information_G),dev_addr);/*将数据保存*/
		SRAM_DMA_Write_Buff((uint8_t *)&Rs485WxLockInfo,sizeof(RS485_WxLock_INFO),dev_addr+Dev_Privately);		
	}
	return Ret;
}

/*RCU回复蓝牙主机模块的确认报文*/

void Freego_Rs485_WxLock_Ask(Device_Public_Information_G *BUS_Public, RS485_WxLock_INFOP Rs485WxLockInfo, uint8_t Cmd, uint8_t *Data, uint8_t DataLen)
{
	uint8_t SendData[FREEGOWXLOCKASKMACLEN];// = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};	
//	RS485_WxLock_INFOP  Rs485WxLockInfo;

//	Rs485WxLockInfo = CfgDevAdd->DevDataStruct;
	memset(SendData, 0x00, FREEGOWXLOCKASKMACLEN);  //全部清0
	SendData[5] = BUS_Public->addr; 
	switch(Cmd)
	{
		case FREEGOCYCLEENSURECMD:
			if(FREEGOWXLOCKASKLEN == DataLen)
			{
				SendData[0] = 0xA5;
				SendData[1] = FREEGOCYCLEENSURECMD;    //
				SendData[3] = 0x03;
				SendData[6] = 0xEA;   //直接回复成功
				switch(Data[6])
				{
					case 0x03:   //门锁斜舌动作；
						break;
					case 0x04:   //门锁反锁开启
						break;
					case 0x05:  //门锁反锁关闭
						break;
					case 0x06:   //门锁电机开启;
						Rs485WxLockInfo->WeixinLockState = CFG_Dev_CtrlWay_Is_Open;
						break;
					case 0x07: //门锁电机关闭；
						Rs485WxLockInfo->WeixinLockState = CFG_Dev_CtrlWay_Is_Close;
						break;
					case 0x08:  //门锁低电量预警；
						break;	
					case 0x09:  //门锁假锁现象；
						break;
					case 0xB1:  //请求立即通电
//						MQTT_Ele_Ctrl_Open();
						{
							UINT8 control[6] = {0};
							control[0] = 0x04;
							control[1] = 0x00;
							control[2] = LOOPCH01;
							control[3] = 0x00;
							control[4] = 0x01;
							control[5] = 0x00;
							DevActionCtrl(control, 6);			//取电 开
						}
						break;
					case 0xB2:  //请求立即总关断电
//						MQTT_Ele_Ctrl_Close();
						{
							UINT8 control[6] = {0};
							control[0] = 0x04;
							control[1] = 0x00;
							control[2] = LOOPCH01;
							control[3] = 0x00;
							control[4] = 0x02;
							control[5] = 0x00;
							DevActionCtrl(control, 6);			//取电 关
						}
						break;
				}
			}
			break;
		case FREEGOTOUCENSURECMD:
			if((DataLen>=0x06) && (DataLen <= WXLOCKUPMESSAGELEN + 0x06))
			{
				SendData[0] = 0xA7;
				SendData[1] = FREEGOTOUCENSURECMD;
				SendData[3] = 0x03;   
				SendData[6] = 0xEA;    //直接回复成功
				Rs485WxLockInfo->WeixinUpSendFlag = 0x01;  //上行标志
				Rs485WxLockInfo->WeixinUpMessageLen = DataLen-0x06;
				memcpy(Rs485WxLockInfo->WeixinUpMessage, &Data[6], (DataLen-0x06));//需要保存蓝牙主机发过来的透传内容
			}
			break;
		case FREEGOMACGETENSURECMD:
			if(FREEGOWXLOCKASKMACLEN == DataLen)  //长度必须为19个字节
			{
				SendData[0] = 0xA6;  //
				SendData[1] = FREEGOMACGETENSURECMD;
				SendData[3] = 0x0F;
				memcpy(&SendData[FREEGOHEADLEN], &Data[FREEGOHEADLEN], FREEGOMACLEN);      //拷贝蓝牙主机模块MAC地址6个字节
#if MQTT_EN 
				SendData[FREEGOHEADLEN+FREEGOMACLEN] = mqtt_info.sub_flag;  //HostRunInfo.SubcribePack_flag;  //1订阅成功  0未订阅成功
#endif
//				MacAddrCpy(&SendData[FREEGOHEADLEN+FREEGOMACLEN+FREEGONETSTATELEN]);   //拷贝主机mac地址
				memcpy(&SendData[FREEGOHEADLEN+FREEGOMACLEN+FREEGONETSTATELEN], MACAddr, DeviceID_LEN); //加设备MAC地址

			}
			break;
	}
	
	switch(Cmd)
	{
		case FREEGOCYCLEENSURECMD:
		case FREEGOTOUCENSURECMD:
			SendData[2] = CheckSum_Overlook_Check(SendData, FREEGOWXLOCKASKLEN, 0x02);  //和校验取反
			MCU485_SendString(BUS_Public->port,SendData,FREEGOWXLOCKASKLEN);
//			RS485_Port_SendFun(CfgDevAdd, SendData, FREEGOWXLOCKASKLEN, FREEGOASKWAITTIME);  
			break;
		case FREEGOMACGETENSURECMD:
			SendData[2] = CheckSum_Overlook_Check(SendData, FREEGOWXLOCKASKMACLEN, 0x02);  //和校验取反
			MCU485_SendString(BUS_Public->port,SendData,FREEGOWXLOCKASKLEN);
//			RS485_Port_SendFun(CfgDevAdd, SendData, FREEGOWXLOCKASKMACLEN, FREEGOASKWAITTIME);  			
			break;
	}

}

/*对门锁外设发过来的数据进行处理*/
void Freego_Rs485_WxLock_Pro(uint8_t *Data, CFG_Dev_AddP CfgDevAdd)
{
	RS485_WxLock_INFOP  Rs485WxLockInfo;
	
	Rs485WxLockInfo = CfgDevAdd->DevDataStruct;
//	Service.food_plate = Data[1];  //同步微信锁
	switch(Data[1])
	{
		case 0x01:
			Rs485WxLockInfo->WeixinLockState = DEV_CTRLWAY_OPEN;      //锁状态同步
			break;
		case 0x02:
			Rs485WxLockInfo->WeixinLockState = DEV_CTRLWAY_CLOSE;
			break;
		default:
			Rs485WxLockInfo->WeixinLockState = DEV_CTRLWAY_INVALID; //无效的，未初始化的
			break;

	}
	if(Rs485WxLockInfo->WeixinLockStateLast != Rs485WxLockInfo->WeixinLockState)  //
	{
		Rs485WxLockInfo->WeixinLockStateLast = Rs485WxLockInfo->WeixinLockState;
		Rs485WxLockInfo->WeixinLockAction = Rs485WxLockInfo->WeixinLockState;   //微信锁动作
//		Rs485WxLockInfo->WeixinLockUpFlag = 0x01;   //微信锁状态上报标志
	}
  Rs485WxLockInfo->DoorLockVoltage = Data[8] + (Data[9]<<8);   
	Rs485WxLockInfo->WeixinLockUpVol = Rs485WxLockInfo->DoorLockVoltage*10/6;  //电量百分比
//	Rs485WxLockInfo->DoorLockVoltageL = Data[2];//;  //0x88
//	Rs485WxLockInfo->DoorLockVoltageH = Data[3];//;  //0x13
	
}




