sasasa
/*****************************************************************************************
文件:app_touch.c
编者:张永辉 2013年6月24日
2013年6月25日 去掉了开机密码
*****************************************************************************************/
#include "includes.h"
#include "GUI.h"
#include "bsp.h"
#include "bsptouch.h"
#include "bspdbg.h"
#include "jpgfile.h"
#include "JpegToBmp.h"
#include "\embed\source\lib\basetype.h"
#include "fun.h"
#include "app_touch.h"
/*****************************************************************************************
触摸屏按下检测
*****************************************************************************************/
#define TOUCHC_NUM 17 //检测点数目
static struct g_CheakPiontChekd
{
u32 beIsin; //上次是否在本范围内
u32 x0;
u32 y0;
u32 x1;
u32 y1;
}chd[TOUCHC_NUM];
//***********************设置要检测的点***************************************************
void TouchcSet(u32 index,u32 x0,u32 y0,u32 x1,u32 y1)
{
chd[index].x0 = x0;
chd[index].y0 = y0;
chd[index].x1 = x1;
chd[index].y1 = y1;
}
/*************************检测某个点的按下,或者放开事件**********************************
返回: 0没有发生
1有进入该区域
2有离开该区域
*/
int TouchcClickUpDown(u32 index)
{
u32 x,y;
u32 yes = ;
if (index >= TOUCHC_NUM)
{
return ;
}
x = BspTouchGetX();
y = BspTouchGetY();
//本次在范围内
if((x > chd[index].x0 && x < chd[index].x1) && (y > chd[index].y0 && y < chd[index].y1))
{
//若上次不在范围内===被按下了
if(chd[index].beIsin == )
{
yes = ;
if(index !=) //0号测试用的,不叫
{
//蜂鸣器声音
BspBeepOne();
}
}
chd[index].beIsin = ;
}else
//本次不在范围内
{
//若上次在范围内===被按松开了
if(chd[index].beIsin == )
{
yes = ;
}
chd[index].beIsin = ; //不在范围内
}
return yes;
}
/*************************显示图片,并与某个键号绑定**************************************
参数:keyNum == 0时表示不帮键号
注: 绑定后,便可以根据键号,查询是否按下或放开了
VS2008使用函数此处不能命中,于是用宏了
*/
GUI_JPEG_INFO jpeginfo;
#define TouchcJpeg(pDATA,X0,Y0,keyNum)\
{\
if(keyNum>=)\
{\
GUI_JPEG_Draw(pDATA,sizeof(pDATA),X0,Y0);\
if(keyNum > )\
{\
GUI_JPEG_GetInfo(pDATA,sizeof(pDATA),&jpeginfo);\
TouchcSet(keyNum,X0,Y0,(X0+jpeginfo.XSize),(Y0+jpeginfo.YSize));\
}\
}\
}
//从内存调用解码后的数据,直接显示,在M3上显示速度明显提高
//参数:keyNum == 0时表示不绑定键号
//换成本函数后,毛击VS2008会死机,原因不明
void TouchcBmp(GUI_BITMAP * pBMP,int X0,int Y0,int keyNum) //TouchcBmp(BMP
{
int x1;
int y1;
x1 = X0 + pBMP->XSize;
y1 = Y0+pBMP->YSize;
if (keyNum >= )
{
//从内存显示图片
GUI_DrawBitmap(pBMP,X0,Y0);
if (keyNum > )
{
//绑定建号
TouchcSet(keyNum,X0,Y0,x1,y1);
}
}
}
//输入框
void TouchcInput(int X0,int Y0,int X1,int Y1,int keyNum)
{
//实验
//GUI_DrawLine(X0,Y0,X1,Y0);
//GUI_DrawLine(X1,Y0,X1,Y1);
//GUI_DrawLine(X0,Y0,X0,Y1);
//GUI_DrawLine(X0,Y1,X1,Y1);
TouchcSet(keyNum,X0,Y0,X1,Y1);
}
/*****************************************************************************************
功能函数支持
*****************************************************************************************/
void StateFun_j_jar_n(void);
void TouchcJpeg_beep(void);
u32 StateFun_PreSent_Covert(u32 i);//将百分比转换成指针的角度
void StateFun_Press_n(void); //主页面要显示的指针和数值
void StateFun_Press_4page(void); //4页面要显示的 指针和数值
void StateFun_GasCheck(void); //气体检测时要显示的数值
bool StateFun_GasCheck_isAlm(void);
bool StateHardErrCheck_fun_IsAnyErr(void);
bool StateSysAlarm_fun_IsAnyAlm(void);
void StateFun_DisAllFunKey(u32 KeyIndex); //显示功能按键
void TouchcJpeg_LngChromaAlm(u32 Index); //气体浓度报警图标,报警时显示红色图标
void TouchcJpeg_HardCheck(u32 KeyIndex); //硬件故障,报警时显示红色图标
void TouchcBmp_SysAlm(u32 KeyIndex); //系统报警,报警时显示红色图标
void TouchcJpeg_Red_bmp_alm(void);
void BeepForAllAlm(void);
/*****************************************************************************************
状态机
*****************************************************************************************/
//------------------状态定义------------
#define C_SETUP_LOG 1 //启动显示LOG
#define C_MAIN_PAGE 2 //主页面状态
#define C_PASSWD 3 //输入密码状态
#define C_GAS_CHECK 4 //检测
#define C_SYS_ALARM 5 //系统报警
#define C_HARD_ERR_CHECK 6 //
#define C_4PAGE 7 //4页面
#define C_PASSWD_SET 8 //密码设置
#define C_4PAGE_SET 9 //气瓶参数设置
#define C_SYS_SET 10 //系统设置
#define C_IDLE 11 //启动显示LOG
#define C_KEYBORD 12 //启动键盘输入
//------------------状态声明------------
u32 StateSetUp(void);
u32 StateMainPage(void);
u32 StatePassWd(void);
u32 StateGasCheck(void);
u32 StateSysAlarm(void);
u32 StateHardErrCheck(void);
u32 State4page(void);
u32 StatePasswdSet(void);
u32 State4pageSet(void);
u32 StateSysSet(void);
u32 StateKeyBord(void);
//------------------变量----------------
u32 StateBc = C_SETUP_LOG; //前一个状态
u32 State = C_SETUP_LOG; //当前状态
u32 MainPageJarNum = ; //在主页面显示的瓶号
u32 StatNum = ; //进入某个状态的计数器,刚进入时等于0。
u32 StateChgReq = ; //状态切换申请,由子状态发起,主状态在切换前清除
u32 StateMsgForm = ; //消息发出者 == 状态值(状态间消息传递)
u32 StateMsg1; //消息内容
u32 StateMsg2;
u32 StateMsg3;
u32 refurbish1; //需要刷新的量
u32 refurbish2;
u32 refurbish3;
u32 refurbish4;
float refurbish1f;
float refurbish2f;
float refurbish3f;
float refurbish4f;
float refurbish5f;
float refurbish6f;
float refurbish7f;
float refurbish8f;
//**************************************状态机调度函数************************************
//调用总入口,每20ms调用一次
void app_touch_test(void)
{
//---------------按键测试函数-------
u32 x,y;
BspTouchBeginOnce();
x = BspTouchGetX();
y = BspTouchGetY();
TouchcSet(,,,,);
if(TouchcClickUpDown())
{
DBG_S("xxx = ");DBG_U32N(x);
DBG_S("yyy = ");DBG_U32N(y);
}
//--------------状态机开始----------
switch(State)
{
case C_SETUP_LOG:
State = StateSetUp();
break;
case C_IDLE:
case C_MAIN_PAGE:
State = StateMainPage();
break;
case C_PASSWD:
State = StatePassWd();
break;
case C_GAS_CHECK:
State = StateGasCheck();
break;
case C_SYS_ALARM:
State = StateSysAlarm();
break;
case C_HARD_ERR_CHECK:
State = StateHardErrCheck();
break;
case C_4PAGE:
State = State4page();
break;
case C_PASSWD_SET:
State = StatePasswdSet();
break;
case C_4PAGE_SET:
State = State4pageSet();
break;
case C_SYS_SET:
State= StateSysSet();
break;
case C_KEYBORD:
State= StateKeyBord();
break;
default:
State = C_MAIN_PAGE;
break;
}
//--------------状态改变时的操作----
if(StateBc != State)
{
StateBc = State;
StatNum = ; //保证刚进入状态时为0
}else
{
StatNum++;
}
}
/***************************************键盘输入*****************************************/
/*
入参: StateMsgForm, 键盘输入结束后要返回的地方
StateMsg1 键盘X位置
StateMsg2 键盘Y位置
输出: StateMsgForm = C_KEYBORD
StateMsg1 = 0 取消
StateMsg1 = 1 确定
StateMsg2; 确定时,键盘输入的数值
*/
#define KEYH 40 //每个键盘格子的长,宽
#define KEYL 40
static int keyvaule = ;
static int keyvaulelen = ;
u32 StateKeyBord(void)
{
u32 Click;
u32 i;
//在此可以检测 StateMsgForm 判断键盘请求来源
//刚开始进本状态
if (StatNum==)
{
//显示背景
TouchcBmp(&BMP.j_keybord,StateMsg1,StateMsg2,); TouchcInput(StateMsg1+,StateMsg2+,StateMsg1+,StateMsg2+,);//关闭 //格子开始的相对位置
StateMsg1 +=;
StateMsg2 +=;
TouchcInput(StateMsg1 ,StateMsg2,StateMsg1+KEYH ,StateMsg2+KEYL,); //按键1
TouchcInput(StateMsg1+KEYH ,StateMsg2,StateMsg1+KEYH*,StateMsg2+KEYL,); //按键2
TouchcInput(StateMsg1+KEYH*,StateMsg2,StateMsg1+KEYH*,StateMsg2+KEYL,); //按键3
TouchcInput(StateMsg1+KEYH*,StateMsg2,StateMsg1+KEYH*,StateMsg2+KEYL,); //按键 CLR
StateMsg2 +=KEYL;
TouchcInput(StateMsg1 ,StateMsg2,StateMsg1+KEYH ,StateMsg2+KEYL,); //按键4
TouchcInput(StateMsg1+KEYH ,StateMsg2,StateMsg1+KEYH*,StateMsg2+KEYL,); //按键5
TouchcInput(StateMsg1+KEYH*,StateMsg2,StateMsg1+KEYH*,StateMsg2+KEYL,); //按键6
TouchcInput(StateMsg1+KEYH*,StateMsg2,StateMsg1+KEYH*,StateMsg2+KEYL,); //按键 回退
StateMsg2 +=KEYL;
TouchcInput(StateMsg1 ,StateMsg2,StateMsg1+KEYH ,StateMsg2+KEYL,); //按键7
TouchcInput(StateMsg1+KEYH ,StateMsg2,StateMsg1+KEYH*,StateMsg2+KEYL,); //按键8
TouchcInput(StateMsg1+KEYH*,StateMsg2,StateMsg1+KEYH*,StateMsg2+KEYL,); //按键9
TouchcInput(StateMsg1+KEYH*,StateMsg2,StateMsg1+KEYH*,StateMsg2+KEYL,); //按键 - 取消
StateMsg2 +=KEYL;
TouchcInput(StateMsg1 ,StateMsg2,StateMsg1+KEYH ,StateMsg2+KEYL,); //按键10 0
TouchcInput(StateMsg1+KEYH ,StateMsg2,StateMsg1+KEYH*,StateMsg2+KEYL,); //按键11 .
TouchcInput(StateMsg1+KEYH*,StateMsg2,StateMsg1+KEYH*+KEYH,StateMsg2+KEYL,);//按键12 确定 占2个格子 //还原其值
StateMsg1 -= ;
StateMsg2 -=;
StateMsg2 -=KEYL*;
GUI_SetTextMode(GUI_TEXTMODE_NORMAL);
GUI_SetColor();
GUI_SetBkColor((GUI_COLOR)-); //
//GUI_SetTextMode(GUI_TEXTMODE_TRANS); //文本模式==透明模式
GUI_SetFont(&GUI_Font16B_ASCII); //数字大小
DBG_S("State = StateKeyBord.\n");
//键值初始化
keyvaulelen = ;
keyvaule = ;
}
//输入数字检测
for (i = ;i<= ;i++)
{
Click = TouchcClickUpDown(i);
if(Click==)
{
//密码长度限制
if (keyvaulelen>=)
{
break;
}
keyvaulelen++;
keyvaule = keyvaule* + i%; //10代表0
DBG_U32N(i);
GUI_DispDecAt(keyvaule,StateMsg1+,StateMsg2+,keyvaulelen);
}
}
//清除
Click = TouchcClickUpDown();
if(Click==)
{
DBG_U32N();
keyvaule = ;
keyvaulelen = ;
GUI_DispStringAt(" ",StateMsg1+,StateMsg2+);
}
//回退
Click = TouchcClickUpDown();
if(Click==)
{
//密码长度限制
if (keyvaulelen > )
{
keyvaule = keyvaule/;
keyvaulelen--;
DBG_U32N();
GUI_DispStringAt(" ",StateMsg1+,StateMsg2+);
GUI_DispDecAt(keyvaule,StateMsg1+,StateMsg2+,keyvaulelen);
//GUI_SetTextMode(GUI_TEXTMODE_TRANS); //文本模式==透明模式
}
}
//取消
Click = TouchcClickUpDown();
if(Click==)
{
StateChgReq = StateMsgForm; //返回原来的状态
StateMsgForm = C_KEYBORD;
StateMsg1 = ; //表示取消
return C_IDLE;
}
//关闭按钮
Click = TouchcClickUpDown(); //返回原来的状态
if(Click==)
{
StateChgReq = StateMsgForm; //返回原来的状态
StateMsgForm = C_KEYBORD;
StateMsg1 = ; //表示取消
return C_IDLE;
} //确定
Click = TouchcClickUpDown(); //返回原来的状态
if(Click==)
{
StateChgReq = StateMsgForm;
StateMsgForm = C_KEYBORD;
StateMsg1 = ; //表示确定
StateMsg2 = keyvaule; //返回键值
return C_IDLE;
} return C_KEYBORD;
}
//**************************************主页面********************************************
u32 StateMainPage(void)
{
u32 Click;
//状态切换申请
if(StateChgReq != )
{
switch(StateChgReq)
{
//此三个状态会相互转移,或回到主界面
case C_SYS_SET:
StateChgReq = ;
return C_SYS_SET;
case C_4PAGE_SET:
StateChgReq = ;
return C_4PAGE_SET;
case C_PASSWD_SET:
StateChgReq = ;
return C_PASSWD_SET;
case C_KEYBORD:
StateChgReq = ;
return C_KEYBORD;
case C_PASSWD:
StateChgReq = ;
return C_PASSWD;
case C_MAIN_PAGE:
StateChgReq = ;
return C_MAIN_PAGE;
default:
StateChgReq = ;
break;
}
}
//显示主页面
if (StatNum==)
{
//主页面
TouchcBmp(&BMP.j_manpage,,,);
StateFun_j_jar_n(); //显示第n瓶
JarSetnSet(MainPageJarNum); //设置瓶号
StateFun_Press_n(); //显示瓶子压力,应该有刷新
//显示功能按钮,并绑定按键号
TouchcBmp(&BMP.j_but_forward_up, ,,);
TouchcBmp(&BMP.j_but_back_up , ,,);
TouchcBmp(&BMP.j_but_4page_up , ,,);
TouchcJpeg_LngChromaAlm();//TouchcBmp(&BMP.j_but_gas_up , 180,226,4);
TouchcJpeg_HardCheck();//TouchcJpeg( j_but_had_check_up, 240,226,5);
TouchcBmp_SysAlm();//TouchcBmp(&BMP.j_but_alarm_up, 300,226,6);
TouchcJpeg_beep(); //显示声音是否关闭
TouchcBmp(&BMP.j_but_set_up, ,,);
DBG_S("State = StateMainPage\n"); }
//界面刷新
if (StatNum%==)
{
StateFun_Press_n();
//是否显示红色图标刷新
//TouchcJpeg_Red_bmp_alm();
TouchcJpeg_LngChromaAlm();
TouchcJpeg_HardCheck();
TouchcBmp_SysAlm(); //检测是否有异常,然后蜂鸣器报警
BeepForAllAlm();
}
//根据按键号,检测每个按键的按下、放开状态
//【按键1】 瓶号切换:递增
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcBmp(&BMP.j_but_forward_down,,,);
}
if(Click==) //放开
{
TouchcBmp(&BMP.j_but_forward_up,,,);
MainPageJarNum++; //MainPageJarNum=[1 4]
if(MainPageJarNum > JarNumberGet()) //根据设置,最多显示不同的号
{
MainPageJarNum = ;
}
StatNum = (u32)-; //如此,会刷新本界面
}
//【按键2】瓶号切换:递减
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcBmp(&BMP.j_but_back_down,,,);
}
if(Click==) //放开
{
TouchcBmp(&BMP.j_but_back_up,,,);
MainPageJarNum--;
if(MainPageJarNum <= )
{
MainPageJarNum = JarNumberGet();
}
StatNum = (u32)-; //如此,会刷新本界面
}
//【按键3】显示4个页面
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcBmp(&BMP.j_but_4page_down , ,,);
}
if(Click==) //放开
{
return C_4PAGE;
}
//【按键4】气体检测
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcBmp(&BMP.j_but_gas_down , ,,);
}
if(Click==) //放开
{
return C_GAS_CHECK;
}
//【按键5】 硬件故障检测
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcBmp(&BMP.j_but_had_check_down,,,);
}
if(Click==) //放开
{
return C_HARD_ERR_CHECK;
}
//【按键6 】系统报警检测
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcBmp(&BMP.j_but_alarm_down, ,,);
}
if(Click==) //放开状态转移
{
return C_SYS_ALARM;
}
//【按键7】 关闭/开启声音
Click = TouchcClickUpDown();
if(Click==) //按下
{
if (BeepIsOnGet())
{
BeepSet(false);
}else
{
BeepSet(true);
}
TouchcJpeg_beep();
}
//【按键8】 系统设置
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcBmp(&BMP.j_but_set_down, ,,);
}
if(Click==) //放开
{
//return C_SYS_SET; //可以直接进入该界面
return C_PASSWD;
}
return C_IDLE;
}
//**************************************系统设置******************************************
#define CC 3
//是否显示指针
void StateSysSet_IsDisplayPointer(bool yes)
{
if(yes == false)
{
TouchcBmp(&BMP.j_but_no,,,);
TouchcBmp(&BMP.j_but_yes,,,);
}else
{
TouchcBmp(&BMP.j_but_yes,,,);
TouchcBmp(&BMP.j_but_no,,,);
}
}
//是否可燃气体检测
void StateSysSet_IsGasCkeck(bool yes)
{
if(yes == false)
{
TouchcBmp(&BMP.j_but_no,,,);
TouchcBmp(&BMP.j_but_yes,,,);
}else
{
TouchcBmp(&BMP.j_but_yes,,,);
TouchcBmp(&BMP.j_but_no,,,);
}
}
//是否低液位报警
void StateSysSet_IsLowAlarm(bool yes)
{
if(yes == false)
{
TouchcBmp(&BMP.j_but_no,,,);
TouchcBmp(&BMP.j_but_yes,,,);
}else
{
TouchcBmp(&BMP.j_but_yes,,,);
TouchcBmp(&BMP.j_but_no,,,);
}
}
//复选框:瓶子个数
void StateSysSet_JarNumber(u32 num)
{
//瓶个数选择
TouchcBmp(&BMP.j_but_no,,,);
TouchcBmp(&BMP.j_but_no,,,);
TouchcBmp(&BMP.j_but_no,,,);
TouchcBmp(&BMP.j_but_no,, ,);
switch(num)
{
case :
TouchcBmp(&BMP.j_but_yes,,,);
break;
case :TouchcBmp(&BMP.j_but_yes,,,);
break;
case :TouchcBmp(&BMP.j_but_yes,,,);
break;
case :TouchcBmp(&BMP.j_but_yes,, ,);
break;
}
}
u32 StateSysSet(void)
{
u32 Click;
int i;
//显示主页面
if (StatNum==)
{
//显示黑色底,以覆盖不必要的按钮
TouchcBmp(&BMP.j_back_480x60,,,);
//主页面
TouchcBmp(&BMP.j_sys_set,,,);
//横条显示
TouchcBmp(&BMP.j_but_sys_set,,,);
//显示功能按钮,并绑定按键号
TouchcBmp(&BMP.j_but_forward_up, ,,);
TouchcBmp(&BMP.j_but_back_up , ,,);
TouchcBmp(&BMP.j_but_manpage_up, ,,);
//复选框:瓶子个数
StateSysSet_JarNumber(JarNumberGet()); //键号 = 3 4 5 6
//复选框:是否低液位报警
StateSysSet_IsLowAlarm(IsGasLowAlarmGet()); //键号 = 9 10
//复选框:是否进行气体浓度监测
StateSysSet_IsGasCkeck(IsGasCkeckGet()); //键号 = 11 12
//复选框:是否显示指针
StateSysSet_IsDisplayPointer(IsDisplayPointerGet()); //键号 = 13 14 TouchcBmp(&BMP.j_but_enter_up,,,); //确定键 DBG_S("State = StateSysSet\n");
}
//复选框:瓶个数选择
for (i = ; i <= ;i++ )
{
Click = TouchcClickUpDown(+i); //3 4 5 6
if(Click==)
{
JarNumberSet(i);
StateSysSet_JarNumber(JarNumberGet());
}
}
//复选框:是否低液位报警
Click = TouchcClickUpDown();
if(Click == )
{
IsGasLowAlarmSet(true);
StateSysSet_IsLowAlarm(IsGasLowAlarmGet());
}
Click = TouchcClickUpDown();
if(Click == )
{
IsGasLowAlarmSet(false);
StateSysSet_IsLowAlarm(IsGasLowAlarmGet());
}
//复选框:是否进行气体浓度监测
Click = TouchcClickUpDown();
if(Click == )
{
IsGasCkeckSet(true);
StateSysSet_IsGasCkeck(IsGasCkeckGet());
}
Click = TouchcClickUpDown();
if(Click == )
{
IsGasCkeckSet(false);
StateSysSet_IsGasCkeck(IsGasCkeckGet());
}
//复选框:是否显示指针
Click = TouchcClickUpDown();
if(Click == )
{
IsDisplayPointerSet(true);
StateSysSet_IsDisplayPointer(IsDisplayPointerGet());
}
Click = TouchcClickUpDown();
if(Click == )
{
IsDisplayPointerSet(false);
StateSysSet_IsDisplayPointer(IsDisplayPointerGet());
}
//【按键1】
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_forward_down,,,);
}
if(Click==)
{
StateChgReq = C_PASSWD_SET;
return C_IDLE;
}
//【按键2】
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_back_down,,,);
}
if(Click==)
{
JarSetnSet();
StateChgReq = C_4PAGE_SET;
return C_IDLE;
}
//【按键8】
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcBmp(&BMP.j_but_manpage_dowm , ,,);
}
if(Click==) //放开状态转移
{
//PasswordOkSet(false); //
return C_IDLE;
} //【按键15】 确定
Click = TouchcClickUpDown();
if(Click==)
{
//将设置写入到EE
SysSet_ee(); TouchcBmp(&BMP.j_but_enter_down ,,,);
}
if(Click==)
{
TouchcBmp(&BMP.j_but_enter_up ,,,);
return C_SYS_SET;
}
return C_SYS_SET;
}
//**************************************更改密码******************************************
#define SUPER_PASSWD 10086 //超级密码
u32 StatePasswdSet(void)
{
int static newpasd;
int static newpasdstat = ;
u32 Click;
u32 i;
//显示主页面
if (StatNum==)
{
if(StateMsgForm!=C_KEYBORD)
{
//刚进入界面,当然全屏刷新
newpasdstat = ;
TouchcBmp(&BMP.j_passwd_set,,,);
}else
{
//从键盘返回,只能部分刷新了
GUI_DrawBitmap_area(&BMP.j_passwd_set,,,,,,);
}
//
TouchcBmp(&BMP.j_but_passwd_set,,,);
//显示功能按钮,并绑定按键号
TouchcBmp(&BMP.j_but_forward_up, ,,);
TouchcBmp(&BMP.j_but_back_up , ,,);
TouchcBmp(&BMP.j_but_manpage_up, ,,);
//确定取消键
TouchcBmp(&BMP.j_but_enter_up, ,,);
TouchcBmp(&BMP.j_but_cancel_up, ,,); ///输入框位置检测
TouchcInput(, ,,,); //源密码
TouchcInput(, ,,,); //新密码
TouchcInput(,,,,); //新密码 GUI_SetColor(GUI_BLACK);
GUI_SetTextMode(GUI_TEXTMODE_TRANS); //文本模式==透明模式
//GUI_SetTextMode(GUI_TEXTMODE_NORMAL); //不透明
GUI_SetFont(&GUI_FontComic18B_ASCII);
DBG_S("State = StateSysSet\n");
}
//【按键3,4,5】
for (i = ;i < ;i++)
{
Click = TouchcClickUpDown(+i);
if(Click==)
{
StateMsgForm = C_PASSWD_SET; //键盘将返回到本状态
StateMsg1 = ; //键盘的起始位置
StateMsg2 = ;
StateMsg3 = +i; //键盘不会改变此值,当有多个输入时需要
//请求状态转移
StateChgReq = C_KEYBORD;
return C_IDLE;
}
}
//检测键盘的返回
if(StateMsgForm==C_KEYBORD)
{
StateMsgForm = ;
//按键3,获取到键盘的值了
if(StateMsg3==)
{
//确定键
if(StateMsg1==)
{
//GUI_DispDecAt(keyvaule,240+2,128+2,keyvaulelen);
GUI_DispStringAt("******",+,+);
GUI_DrawBitmap_area(&BMP.j_passwd_set,,,+,+,,);
if(PasswordGet()==keyvaule || keyvaule == SUPER_PASSWD)
{
//密码通过
GUI_DispStringAt("ok ",,);
newpasdstat |= ;
}else
{
//密码检测失败
GUI_DispStringAt("err",,);
newpasdstat &= ~;
}
}
//取消键
if(StateMsg1==)
{
//获取到的键值
}
}
//新密码
if(StateMsg3==)
{
//确定键
if(StateMsg1==)
{
GUI_DispStringAt("******",,);
GUI_DrawBitmap_area(&BMP.j_passwd_set,,,+*,+,,);
//if(newpasd==-2) //判断旧密码检验通过才行
//{
newpasd = keyvaule;
GUI_DispStringAt("ok ",,);
newpasdstat |= (<<);
//}else
//{
// GUI_DispStringAt("err",295,80);
//}
}
//取消键
if(StateMsg1==)
{
//获取到的键值
}
}
//新密码
if(StateMsg3==)
{
//确定键
if(StateMsg1==)
{
GUI_DispStringAt("******",,);
GUI_DrawBitmap_area(&BMP.j_passwd_set,,,+*,+,,);
//新密码设置成功
if(newpasd == keyvaule)
{
//PasswordSet(keyvaule);
GUI_DispStringAt("ok ",,);
newpasdstat |= (<<);
}else
{
GUI_DispStringAt("err",,);
newpasdstat &= ~(<<);
}
}
//取消键
if(StateMsg1==)
{
//获取到的键值
}
}
}
//【按键1】
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_forward_down,,,);
}
if(Click==)
{
JarSetnSet();
StateChgReq = C_4PAGE_SET;
return C_IDLE;
}
//【按键6】 确定
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_enter_down,,,);
}
if(Click==)
{
TouchcBmp(&BMP.j_but_enter_up,,,); GUI_DrawBitmap_area(&BMP.j_passwd_set,,,+*,+,,);
if(newpasdstat==) //可能会多次进入到此
{
//设置新密码
PasswordSet(newpasd); //保存到内存
PasswordSet_ee(newpasd); //保存到EE
GUI_SetColor(); //绿色
GUI_DispStringAt("Succeed!",,);
//保持密码到EE
}else
{
GUI_SetColor(GUI_RED);
GUI_DispStringAt("Fail ! ",,);
}
}
//【按键7】取消
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_cancel_down, ,,);
}
if(Click==)
{
TouchcBmp(&BMP.j_but_cancel_up, ,,);
//刷新整个界面,需要重新输入旧新密码
StatNum = (u32)-;
}
//【按键2】
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_back_down,,,);
}
if(Click==)
{
StateChgReq = C_SYS_SET;
return C_IDLE;
}
//【按键8】
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_manpage_dowm , ,,);
}
if(Click==)//回主界面
{
return C_IDLE;
}
return C_PASSWD_SET;
}
//**************************************4个气瓶设置***************************************
// 根据要设置的瓶号,显示标签
void State4pageSet_dis_page(u32 n)
{
switch(n)
{
case :
TouchcBmp(&BMP.j_but_jar1_set,,,);
break;
case :TouchcBmp(&BMP.j_but_jar2_set,,,);
break;
case :TouchcBmp(&BMP.j_but_jar3_set,,,);
break;
case :TouchcBmp(&BMP.j_but_jar4_set,, ,);
break;
}
} u32 State4pageSet(void)
{
u32 Click;
int i;
//显示主页面 当少于4个屏时,显示多余的瓶 其参数为0即可。
if (StatNum==)
{
GUI_SetTextMode(GUI_TEXTMODE_TRANS);
//主页面 可以设置的主页面
TouchcBmp(&BMP.j_4page_set,,,);
//气瓶设置标签
State4pageSet_dis_page(JarSetnGet());
//显示功能按钮,并绑定按键号
TouchcBmp(&BMP.j_but_forward_up, ,,);
TouchcBmp(&BMP.j_but_back_up , ,,);
TouchcBmp(&BMP.j_but_manpage_up, ,,);
//获取当前值
TouchcBmp(&BMP.j_but_get_value_up, ,,);
TouchcBmp(&BMP.j_but_get_value_up, ,,); //确定按钮
TouchcBmp(&BMP.j_but_enter_up,,,); //气瓶容量设置
TouchcInput(, ,,,);
TouchcInput(, ,,,);
TouchcInput(,,,,);
//本状态字体颜色
GUI_SetColor(GUI_RED);
GUI_SetFont(&GUI_Font8x12_ASCII);
//显示
GUI_GotoXY(, );GUI_DispDecMin(JarMaxGasGet()); //最大气罐容量
GUI_GotoXY(, );GUI_DispDecMin(JarGasLowPfGet()); //最小电容值
GUI_GotoXY(, );GUI_DispDecMin(JarGasHigPfGet()); //最大电容值
//显示实时值
GUI_GotoXY(, );GUI_DispDecMin(JarGasNowPfGet()); //实时电容
GUI_GotoXY(, );GUI_DispDecMin(JarGasNowGet()); //实时液位
GUI_GotoXY(, );GUI_DispFloatFix(JarPressNowGet(),,); //实时瓶压
GUI_GotoXY(, );GUI_DispFloatFix(JarBufferPressNowGet(),,); //实时缓冲压
GUI_GotoXY(, );GUI_DispDecMin(JarTemperatureNowGet()); //实时温度
//
DBG_S("State = State4pageSet :");DBG_U32N(JarSetnGet());
}
//实时刷新
if (StatNum%==)
{
//本状态字体颜色
GUI_SetTextMode(GUI_TEXTMODE_TRANS);
GUI_SetColor(GUI_RED);
GUI_SetFont(&GUI_Font8x12_ASCII);
//显示
//GUI_GotoXY(385, 57);GUI_DispDecMin(JarMaxGasGet()); //最大气罐容量
//GUI_GotoXY(385, 83);GUI_DispDecMin(JarGasLowPfGet()); //最小电容值
//GUI_GotoXY(385, 136);GUI_DispDecMin(JarGasHigPfGet()); //最大电容值
//显示实时值 实时覆盖,然后刷新
GUI_DrawBitmap_area(&BMP.j_4page_set,,,+*,+,,);
GUI_GotoXY(, );GUI_DispDecMin(JarGasNowPfGet()); //实时电容
GUI_DrawBitmap_area(&BMP.j_4page_set,,,+*,+,,);
GUI_GotoXY(, );GUI_DispDecMin(JarGasNowGet()); //实时液位
GUI_DrawBitmap_area(&BMP.j_4page_set,,,+*,+,,);
GUI_GotoXY(, );GUI_DispFloatFix(JarPressNowGet(),,); //实时瓶压
GUI_DrawBitmap_area(&BMP.j_4page_set,,,+*,+,,);
GUI_GotoXY(, );GUI_DispFloatFix(JarBufferPressNowGet(),,); //实时缓冲压
GUI_DrawBitmap_area(&BMP.j_4page_set,,,+*,+,,);
GUI_GotoXY(, );GUI_DispDecMin(JarTemperatureNowGet()); //实时温度
}
//【按键3】获取当前值,空瓶电容
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_get_value_down, ,,);
}
if(Click==)
{
TouchcBmp(&BMP.j_but_get_value_up, ,,);
}
//【按键4】获取当前值,满瓶电容
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_get_value_down, ,,);
}
if(Click==)
{
TouchcBmp(&BMP.j_but_get_value_up , ,,);
}
for (i = ;i<;i++)
{
//【按键5,6,7】气瓶容量设置 空瓶设置 满屏设置
Click = TouchcClickUpDown(+i);
if(Click==)
{
StateMsgForm = C_4PAGE_SET; //键盘将返回到本状态
StateMsg1 = ; //键盘的起始位置
StateMsg2 = ;
StateMsg3 = +i; //键盘不会改变此值,当有多个输入时需要
//请求状态转移
StateChgReq = C_KEYBORD;
return C_IDLE;
}
}
//检测键盘的返回
if(StateMsgForm==C_KEYBORD)
{
StateMsgForm = ;
if(StateMsg3==) //气瓶容量设置
{
//确定键
if(StateMsg1==)
{
//获取到的键值 keyvaule
GUI_SetTextMode(GUI_TEXTMODE_NORMAL);
GUI_DispStringAt(" ",, );
GUI_GotoXY(, );
GUI_DispDecMin(keyvaule);
JarMaxGasSet(keyvaule);
}
}
if(StateMsg3==) //空瓶设置
{
//确定键
if(StateMsg1==)
{
//获取到的键值 keyvaule
GUI_SetTextMode(GUI_TEXTMODE_NORMAL);
GUI_DispStringAt(" ",, );
GUI_GotoXY(, );
//不能大于最大值
if (keyvaule + > (int)JarGasHigPfGet())
{
keyvaule = (int)JarGasHigPfGet() - ;
}
GUI_DispDecMin(keyvaule);
JarGasLowPfSet(keyvaule);
}
}
if(StateMsg3==) //满屏设置
{
//确定键
if(StateMsg1==)
{
//获取到的键值 keyvaule
GUI_SetTextMode(GUI_TEXTMODE_NORMAL);
GUI_DispStringAt(" ",, );
GUI_GotoXY(, ); //最大值不能小于最小值+50pF
if(keyvaule < (int)(JarGasLowPfGet() + ))
{
keyvaule = (int)JarGasLowPfGet() + ;
} GUI_DispDecMin(keyvaule);
JarGasHigPfSet(keyvaule);
}
}
} //【按键10】确定
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_enter_down,,,);
}
if(Click==)
{
TouchcBmp(&BMP.j_but_enter_up,,,);
//保存数据到ee
JarGasSet_ee(JarSetnGet());
} //【按键1】
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_forward_down,,,);
}
if(Click==)
{
//根据标签,界面向前切换
if(JarSetnGet()==)
{
StateChgReq = C_SYS_SET;
}else
{
JarSetnSet( JarSetnGet() - );
StateChgReq = C_4PAGE_SET;
}
return C_IDLE;
}
//【按键2】
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_back_down,,,);
}
if(Click==)
{
//根据标签,界面向后切换
if(JarSetnGet()==)
{
StateChgReq = C_PASSWD_SET;
}else
{
JarSetnSet( JarSetnGet()+);
StateChgReq = C_4PAGE_SET;
}
return C_IDLE;
}
//【按键8】
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_manpage_dowm , ,,);
}
if(Click==)
{
return C_IDLE;
}
return C_4PAGE_SET;
}
//**************************************系统报警******************************************
void StateSysAlarm_fun(void)
{
int i;
int jarn = JarNumberGet();
for(i=;i < jarn;i++)
{
//液位高报警
if(IsLngHig(i+))
{
TouchcBmp(&BMP.j_alarm_yes,+i*,,);
}else
{
GUI_DrawBitmap_area(&BMP.j_sys_alarm,+i*,,++i*,+,+i*,);
}
//液位低报警
if(IsLngLow(i+))
{
TouchcBmp(&BMP.j_alarm_yes, + i*,+,);
}else
{
GUI_DrawBitmap_area(&BMP.j_sys_alarm, + i*,+,+ + i*,++, + i*,+);
}
//气瓶压力高报警
if(IsPressHig(i+))
{
TouchcBmp(&BMP.j_alarm_yes, + i*,+*,);;
}else
{
GUI_DrawBitmap_area(&BMP.j_sys_alarm, + i*,+*,+ + i*,++*, + i*,+*);
}
//气瓶压力低报警
if(IsPressLow(i+))
{
TouchcBmp(&BMP.j_alarm_yes, + i*,+*,);
}else
{
GUI_DrawBitmap_area(&BMP.j_sys_alarm, + i*,+*,+ + i*,++*, + i*,+*);
}
//缓冲压高报警
if(IsPressBufferHig(i+))
{
TouchcBmp(&BMP.j_alarm_yes, + i*,+*,);
}else
{
GUI_DrawBitmap_area(&BMP.j_sys_alarm, + i*,+*,+ + i*,++*, + i*,+*);
}
//缓冲压低报警
if(IsPressBufferLow(i+))
{
TouchcBmp(&BMP.j_alarm_yes, + i*,+*,);
}else
{
GUI_DrawBitmap_area(&BMP.j_sys_alarm, + i*,+*,+ + i*,++*, + i*,+*);
}
}
}
bool StateSysAlarm_fun_IsAnyAlm(void)
{
int i;
int jarn = JarNumberGet();
for(i=;i < jarn;i++)
{
//液位高报警
if(IsLngHig(i+))
{
return true;
}
//液位低报警
if(IsLngLow(i+))
{
return true;
}
//气瓶压力高报警
if(IsPressHig(i+))
{
return true;
}
//气瓶压力低报警
if(IsPressLow(i+))
{
return true;
}
//缓冲压高报警
if(IsPressBufferHig(i+))
{
return true;
}
//缓冲压低报警
if(IsPressBufferLow(i+))
{
return true;
}
}
return false;
}
u32 StateSysAlarm(void)
{
u32 Click;
//显示主页面
if (StatNum==)
{
TouchcBmp(&BMP.j_sys_alarm,,,); //本页主界面
StateSysAlarm_fun(); //高低液位检测
StateFun_DisAllFunKey(); //显示所有的功能按键,绑定1号键
TouchcBmp(&BMP.j_but_alarm_down, ,,);//显示按下的功能键
} if (StatNum%==)
{
//刷新
StateSysAlarm_fun(); //三个红色按钮的刷新
TouchcJpeg_LngChromaAlm();
TouchcJpeg_HardCheck();
//TouchcBmp_SysAlm(0); //检测是否有异常,然后蜂鸣器报警
BeepForAllAlm();
}
//按键8
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcBmp_SysAlm();//TouchcBmp(&BMP.j_but_alarm_up, 300,226,0);
}
if(Click==) //放开状态转移
{
return C_IDLE;
}
return C_SYS_ALARM;
}
//**************************************硬件故障检测**************************************
//故障检测,并显示相应的红色图标
void StateHardErrCheck_fun(void)
{
int i;
int jarn = JarNumberGet();
//没有使用的瓶子则不检测
for(i=;i< jarn ;i++)
{
//通信检测
if(IsTranFault(i+))
{
TouchcBmp(&BMP.j_alarm_yes,+i*,,);
}else
{
GUI_DrawBitmap_area(&BMP.j_hard_err_check,+i*,,++i*,+,+i*,);
}
//短路检测
if(IsJarCapShort(i+))
{
TouchcBmp(&BMP.j_alarm_yes,+i*,+,);
}else
{
GUI_DrawBitmap_area(&BMP.j_hard_err_check,+i*,+,++i*,++,+i*,+);
}
//断路检测
if(IsJarCapBreak(i+))
{
TouchcBmp(&BMP.j_alarm_yes, + i*,+*,);
}else
{
GUI_DrawBitmap_area(&BMP.j_hard_err_check,+i*,+* ,+ + i*,++*, + i*,+*);
} //气瓶压力检测
if(IsPressFault(i+))
{
TouchcBmp(&BMP.j_alarm_yes,+i*,+*,);
}else
{
GUI_DrawBitmap_area(&BMP.j_hard_err_check,+i*,+*,++i*,++*,+i*,+*);
}
//缓冲压检测
if(IsPressBufferFault(i+))
{
TouchcBmp(&BMP.j_alarm_yes,+i*,+*,);
}else
{
GUI_DrawBitmap_area(&BMP.j_hard_err_check,+i*,+*,++i*,++*,+i*,+*);
}
}
}
////故障检测,只要有任一个故障都返回true
bool StateHardErrCheck_fun_IsAnyErr(void)
{
int i;
int jarn = JarNumberGet();
//bool b = false;
//没有使用的瓶子则不检测
for(i=;i< jarn ;i++)
{
//通信检测
if(IsTranFault(i+))
{
return true;//b = true;
}
//短路检测
if(IsJarCapShort(i+))
{
return true;//b = true;
}
//断路检测
if(IsJarCapBreak(i+))
{
return true;//b = true;
}
//气瓶压力检测
if(IsPressFault(i+))
{
return true;//b = true;
}
//缓冲压检测
if(IsPressBufferFault(i+))
{
return true;//b = true;
}
}
return false;
}
u32 StateHardErrCheck(void)
{
u32 Click;
//显示主页面
if (StatNum==)
{
TouchcBmp(&BMP.j_hard_err_check,,,); //本页主界面
StateHardErrCheck_fun();
StateFun_DisAllFunKey(); //显示所有的功能按键,绑定1号键
TouchcBmp(&BMP.j_but_had_check_down, ,,); //显示按下的功能键
} //界面刷新
if (StatNum%==)
{
//显示是否故障刷新
StateHardErrCheck_fun(); //三个可能出现红色的图标
TouchcJpeg_LngChromaAlm();
//TouchcJpeg_HardCheck(0); 自身是按下的,不改变图标
TouchcBmp_SysAlm(); //检测是否有异常,然后蜂鸣器报警
BeepForAllAlm();
} //按键8
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcJpeg_HardCheck();//TouchcJpeg(j_but_had_check_up, 240,226,0);
}
if(Click==) //放开状态转移
{
return C_IDLE;
}
return C_HARD_ERR_CHECK;
}
//**************************************气体检测******************************************
u32 StateGasCheck(void)
{
u32 Click;
//显示主页面
if (StatNum==)
{
TouchcBmp(&BMP.j_gas_check,,,); //本页主界面
StateFun_DisAllFunKey(); //显示所有的功能按键,绑定1号键
TouchcBmp(&BMP.j_but_gas_down , ,,); //显示按下的功能键
StateFun_GasCheck(); //气体检测,并报警
} //界面刷新
if (StatNum%==)
{
//显示的文字刷新
StateFun_GasCheck(); //气体检测,并报警 //三个可能出现红色的图标
//TouchcJpeg_LngChromaAlm(0); 自身是按下的,不改变图标
TouchcJpeg_HardCheck();
TouchcBmp_SysAlm();
} //按键1
Click = TouchcClickUpDown();
if(Click==) //按下
{
//TouchcBmp(&BMP.j_but_gas_up , 180,226,0);
TouchcJpeg_LngChromaAlm();
}
if(Click==) //放开状态转移
{
return C_IDLE;
}
return C_GAS_CHECK;
}
/***************************************显示4个页面**************************************/
u32 State4page(void)
{
u32 Click;
//显示主页面
if (StatNum==)
{
TouchcBmp(&BMP.j_4page,,,);
StateFun_DisAllFunKey(); //显示所有的功能按键,绑定1号键
TouchcBmp(&BMP.j_but_4page_down , ,,); //显示被按下的按键,
StateFun_Press_4page(); //指针显示
}
//界面刷新
if (StatNum%==)
{
//TouchcBmp(&BMP.j_4page,0,0,0);
StateFun_Press_4page(); //指针显示 //三个可能出现红色的图标
TouchcJpeg_LngChromaAlm();
TouchcJpeg_HardCheck();
TouchcBmp_SysAlm(); //检测是否有异常,然后蜂鸣器报警
BeepForAllAlm();
} //按键1
Click = TouchcClickUpDown();
if(Click==) //按下
{
TouchcBmp(&BMP.j_but_4page_up , ,,);
}
if(Click==) //放开状态转移
{
return C_IDLE;
}
return C_4PAGE;
}
/***************************************输入密码*****************************************/
u32 StatePassWd(void)
{
u32 Click;
if(StatNum==)
{
TouchcBmp(&BMP.j_passwd,,,);
TouchcBmp(&BMP.j_but_enter_up,,,); //确定
TouchcBmp(&BMP.j_but_cancel_up,,,); //取消
//输入框位置检测
TouchcInput(,,,,);
GUI_SetTextMode(GUI_TEXTMODE_TRANS); //文本模式==透明模式
GUI_SetColor(GUI_RED);
GUI_SetFont(&GUI_FontComic18B_ASCII);
DBG_S("State = StatePassWd...\n");
}
//确定
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_enter_down,,,);
}
if(Click==)
{
//密码检测通过 keyvaule是静态变量,由键盘输入
if(PasswordGet()==keyvaule || keyvaule == SUPER_PASSWD)
{
StateChgReq = C_SYS_SET; //通过密码检测即可进入系统设置界面
keyvaule = PasswordGet() + ; //改变键值,防止碰巧
return C_IDLE;
}else
{
TouchcBmp(&BMP.j_but_enter_up,,,);
GUI_DispStringAt("Err",+,+);
}
}
//取消
Click = TouchcClickUpDown();
if(Click==)
{
TouchcBmp(&BMP.j_but_cancel_down,,,);
}
if(Click==)
{
//清除底部图像残留
TouchcBmp(&BMP.j_back_480x60,,-,);
return C_IDLE;
}
//请求键盘输入
Click = TouchcClickUpDown();
if(Click==)
{
StateMsgForm = C_PASSWD; //键盘将返回到本状态
StateMsg1 = ; //键盘的起始位置
StateMsg2 = ;
StateMsg3 = ; //键盘不会改变此值,当有多个输入时需要
//请求状态转移
StateChgReq = C_KEYBORD;
return C_IDLE;
}
//检测键盘的返回
if(StateMsgForm==C_KEYBORD)
{
StateMsgForm = ; //清除,否则重复检测到键盘
//按键3,获取到键盘的值了
if(StateMsg3==)
{
//确定键
if(StateMsg1==)
{
//获取到的键值
//GUI_DispDecAt(keyvaule,240+2,128+2,keyvaulelen);
GUI_DispStringAt("******",+,+);
//StateMsg2
if(PasswordGet()==keyvaule || keyvaule == SUPER_PASSWD)
{
//密码检测通过
//PasswordOkSet(true);
GUI_DispStringAt("OK!",+,+);
//return C_IDLE;
}else
{
//密码检测失败
GUI_DispStringAt("Err",+,+);
}
}
//取消键
if(StateMsg1==)
{
//获取到的键值
}
}
}
return C_PASSWD;
}
/***************************************开机启动*****************************************/
void FunInit(void);
u32 StateSetUp(void)
{
//刚开始进本状态
if (StatNum==)
{
TouchcJpeg(j_log,,,); //解码前,只能用此函数显示图片
DBG_S("State = StateSetUp...\n");
JpegToBmpAtMem(); //图片解码到内存
//JpegToBmpTest(); //测试函数
}
//while(1)
//{
// dis_bmp_test();
// OSTimeDly(10);
//}
//2秒后退出本状态
if(StatNum > )
{
//清除底部的图像。因为其他状态的图片不够大,否则有残留图像。
TouchcBmp(&BMP.j_back_480x60,,-,);
return C_IDLE;
}
return C_SETUP_LOG;
}
//======================================状态机的功能函数==================================
//**************************************是否需要声音提示********************************** void TouchcJpeg_beep(void)
{
if (BeepIsOnGet())
{
TouchcBmp(&BMP.j_but_voice_yes, ,,);
}else
{
TouchcBmp(&BMP.j_but_voice_no, ,,);
}
}
//根据本应用,只要在主页面、4个页面显示时刷新此3个按钮就可。因为其他的状态没有显示此3按钮
//当坐台有变化时,更新图标
void TouchcJpeg_Red_bmp_alm(void)
{
static bool isalm1;
static bool isalm2;
static bool isalm3;
if(isalm1 != StateFun_GasCheck_isAlm())
{
isalm1 = StateFun_GasCheck_isAlm();
if(chd[].beIsin==)
{ //按键没有按下时才可以改变图标
TouchcJpeg_LngChromaAlm();
}
}
if (isalm2 != StateHardErrCheck_fun_IsAnyErr())
{
isalm2 = StateHardErrCheck_fun_IsAnyErr();
if(chd[].beIsin==)
{ //按键没有按下时才可以改变图标
TouchcJpeg_HardCheck();
}
}
if (isalm3 != StateSysAlarm_fun_IsAnyAlm())
{
isalm3 = StateSysAlarm_fun_IsAnyAlm();
if(chd[].beIsin==)
{ //按键没有按下时才可以改变图标
TouchcBmp_SysAlm();
}
}
}
//只要有如何异常,都蜂鸣器报警
void BeepForAllAlm(void)
{
//如果蜂鸣器关闭则不名叫
if(BeepIsOnGet()==false)
{
return;
}
//主要是3个红色按钮所表示的项
if(StateFun_GasCheck_isAlm())
{
BspBeepAlm();
return;
}
if(StateHardErrCheck_fun_IsAnyErr())
{
BspBeepAlm();
return;
} //是否液位BEEP告警 == 不告警即所有的液位、压力高低都不报警
if(IsGasLowAlarmGet()==false)
{
return;
}
if(StateSysAlarm_fun_IsAnyAlm())
{
BspBeepAlm();
return;
}
} //TouchcJpeg_LngChromaAlm();
//TouchcJpeg_HardCheck();
//TouchcBmp_SysAlm();
void TouchcJpeg_LngChromaAlm(u32 KeyIndex)
{
//气体超标则使用红色图标
if(StateFun_GasCheck_isAlm())
{
TouchcBmp(&BMP.j_but_gas_alm , ,,KeyIndex);
}else
{
TouchcBmp(&BMP.j_but_gas_up , ,,KeyIndex);
}
}
//硬件检测,是否使用红色图标
void TouchcJpeg_HardCheck(u32 KeyIndex)
{
if(StateHardErrCheck_fun_IsAnyErr())
{
TouchcJpeg( j_but_had_check, ,,KeyIndex);
}else
{ //任一硬件问题都用红色图标
TouchcJpeg( j_but_had_check_up, ,,KeyIndex);
}
}
//系统检测,决定是否使用红色图标
void TouchcBmp_SysAlm(u32 KeyIndex)
{
if(StateSysAlarm_fun_IsAnyAlm())
{
TouchcBmp(&BMP.j_but_alarm, ,,KeyIndex);
}else
{
TouchcBmp(&BMP.j_but_alarm_up, ,,KeyIndex);
}
} //**************************************显示主页面左上角的瓶号****************************
void StateFun_j_jar_n(void)
{
switch(MainPageJarNum)
{
case :
TouchcBmp(&BMP.j_jar1,,,);
break;
case :
TouchcBmp(&BMP.j_jar2,,,);
break;
case :
TouchcBmp(&BMP.j_jar3,,,);
break;
case :
TouchcBmp(&BMP.j_jar4,,,);
break;
default:
break;
}
}
//**************************************主界面的指针 数组显示*****************************
#define countofarry(arry) (sizeof(arry)/sizeof(arry[0])) //求数组的组数
#define ANGLE(C) (C*100*3.14159265/18000) //角度,与幅度的转换
const GUI_POINT Points1[] = {{,},{-,},{,},{,}}; //主页面,小圈仪表的指针. 0°时在6点钟方向
GUI_POINT Points1c[countofarry(Points1)]; //副本,画图时使用
const GUI_POINT Points2[] = {{,},{-,},{,},{,}}; //主页面,大圈仪表的指针. 0°时在6点钟方向
GUI_POINT Points2c[countofarry(Points1)];
//将百分比转换成可以显示的角度
u32 StateFun_PreSent_Covert(u32 i)
{
//在图形上显示时 72 是满的,287是空的 287-72=215
i = - i;
i = (i* + )/; //[0,100]=[0,215]
i += ;
return i;
}
void StateFun_Press_n(void)
{
int i = ;
if (StatNum==)
{
//以下函数时全刷新
refurbish1 = (U32)-;
refurbish2 = (U32)-;
refurbish3 = (U32)-;
}
if (refurbish1 != JarGasNowGet())
{
refurbish1 = JarGasNowGet();
//区域覆盖
GUI_DrawBitmap_area(&BMP.j_manpage,,,,,,);
//在图形上显示时 72 是满的,287是空的 287-72=215
GUI_SetColor(GUI_RED); //设置颜色
GUI_SetDrawMode(GUI_DRAWMODE_TRANS); //这也是默认模式 异或模式 GUI_DRAWMODE_XOR
//液位 指针
i = JarGasNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points2c,Points2,countofarry(Points2),ANGLE(i)); //旋转多边形,有数据复制作用
GUI_FillPolygon(Points2c,countofarry(Points2),,); //绘制一个填充多边形 //显示文本
GUI_SetTextMode(GUI_TEXTMODE_TRANS); //文本模式==透明模式
GUI_SetBkColor((GUI_COLOR)-); //设置背景色==白色
GUI_SetColor(GUI_GREEN); //设置前景色,即字体颜色
GUI_SetFont(&GUI_FontComic18B_ASCII); //GUI_FontComic24B_ASCII 大了 GUI_FontComic18B_1系统崩溃
GUI_GotoXY(,);
GUI_DispDec(JarGasNowGet(),); //罐体液位
}
if(refurbish2 != JarPressNowGet())
{
refurbish2 = JarPressNowGet();
GUI_DrawBitmap_area(&BMP.j_manpage,,,,,,);
//液位 指针
GUI_SetColor(GUI_RED); //设置颜色
GUI_SetDrawMode(GUI_DRAWMODE_TRANS); //这也是默认模式 异或模式 GUI_DRAWMODE_XOR
i = JarPressNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i)); //旋转多边形,有数据复制作用
GUI_FillPolygon(Points1c,countofarry(Points1),,); //绘制一个填充多边形
//显示文本
GUI_SetTextMode(GUI_TEXTMODE_TRANS); //文本模式==透明模式
GUI_SetBkColor((GUI_COLOR)-); //设置背景色==白色
GUI_SetColor(GUI_GREEN); //设置前景色,即字体颜色
GUI_SetFont(&GUI_Font16B_ASCII); //GUI_FontComic24B_ASCII 大了 GUI_FontComic18B_1系统崩溃
GUI_GotoXY(,);
GUI_DispFloatFix(JarPressNowGet(),,); //瓶压
}
if (refurbish3 != JarBufferPressNowGet())
{
refurbish3 = JarBufferPressNowGet();
GUI_DrawBitmap_area(&BMP.j_manpage,,,,,,);
//液位 指针
GUI_SetColor(GUI_RED); //设置颜色
GUI_SetDrawMode(GUI_DRAWMODE_TRANS); //这也是默认模式 异或模式 GUI_DRAWMODE_XOR
i = JarBufferPressNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i)); //旋转多边形,有数据复制作用
GUI_FillPolygon(Points1c,countofarry(Points1),,); //绘制一个填充多边形
//显示文本
GUI_SetTextMode(GUI_TEXTMODE_TRANS); //文本模式==透明模式
GUI_SetBkColor((GUI_COLOR)-); //设置背景色==白色
GUI_SetColor(GUI_GREEN); //设置前景色,即字体颜色
GUI_SetFont(&GUI_Font16B_ASCII); //GUI_FontComic24B_ASCII 大了 GUI_FontComic18B_1系统崩溃
GUI_GotoXY(,);
GUI_DispFloatFix(JarBufferPressNowGet(),,); //缓冲压
}
/* 静态时的方法:
//在图形上显示时 72 是满的,287是空的 287-72=215
GUI_SetColor(GUI_RED); //设置颜色
GUI_SetDrawMode(GUI_DRAWMODE_TRANS); //这也是默认模式 异或模式 GUI_DRAWMODE_XOR
//----仪表盘指针绘制----
//瓶压 指针
//GUI_MagnifyPolygon(MainLittlePointsCopy,MainLittlePoints,countof(MainLittlePoints),1);//对多边形放大1倍 有复制作用
i = JarPressNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i)); //旋转多边形,有数据复制作用
GUI_FillPolygon(Points1c,countofarry(Points1),102,126); //绘制一个填充多边形
//缓冲压 指针
i = JarBufferPressNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i)); //旋转多边形,有数据复制作用
GUI_FillPolygon(Points1c,countofarry(Points1),375,126); //绘制一个填充多边形
//液位 指针
i = JarGasNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points2c,Points2,countofarry(Points2),ANGLE(i)); //旋转多边形,有数据复制作用
GUI_FillPolygon(Points2c,countofarry(Points2),237,114); //绘制一个填充多边形
//----显示数值:罐体容量 瓶压 缓冲压----
//显示文本
GUI_SetTextMode(GUI_TEXTMODE_TRANS); //文本模式==透明模式
GUI_SetBkColor((GUI_COLOR)-1); //设置背景色==白色
GUI_SetColor(GUI_GREEN); //设置前景色,即字体颜色
GUI_SetFont(&GUI_FontComic18B_ASCII); //GUI_FontComic24B_ASCII 大了 GUI_FontComic18B_1系统崩溃
GUI_GotoXY(220,158);
GUI_DispDec(JarGasNowGet(),3); //罐体液位
GUI_SetFont(&GUI_Font16B_ASCII); //GUI_FontComic24B_ASCII 大了 GUI_FontComic18B_1系统崩溃
GUI_GotoXY(85,160);
GUI_DispFloatFix(JarPressNowGet(),4,2); //瓶压
GUI_GotoXY(360,160);
GUI_DispFloatFix(JarBufferPressNowGet(),4,2); //缓冲压
*/
}
//**************************************4个页面时的指针 数值显示**************************
void StateFun_Press_4page(void)
{
static int i = ;
GUI_SetColor(GUI_RED); //设置颜色
GUI_SetDrawMode(GUI_DRAWMODE_TRANS); //这也是默认模式 异或模式 GUI_DRAWMODE_XOR
GUI_SetTextMode(GUI_TEXTMODE_TRANS);
if(StatNum==)
{
refurbish1 = (u32)-;
refurbish2 = (u32)-;
refurbish3 = (u32)-;
refurbish4 = (u32)-;
refurbish1f = (float)213.1;
refurbish2f = (float)213.1;
refurbish3f = (float)213.1;
refurbish4f = (float)213.1;
refurbish5f = (float)213.1;
refurbish6f = (float)213.1;
refurbish7f = (float)213.1;
refurbish8f = (float)213.1;
}
//--------------指针和液位值------------------
GUI_SetColor(GUI_RED); //设置颜色
JarSetnSet(); //罐1
if (refurbish1 != JarGasNowPerSentGet())
{
refurbish1 = JarGasNowPerSentGet();
//覆盖
GUI_DrawBitmap_area(&BMP.j_4page,,,,,,);
//指针
i = JarGasNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i));
GUI_FillPolygon(Points1c,countofarry(Points1),,);//中心点
//液位
GUI_SetColor(GUI_GREEN); //设置颜色
GUI_SetFont(&GUI_FontComic18B_ASCII);
GUI_GotoXY(,);
GUI_DispDec(JarGasNowGet(),);
}
JarSetnSet(); //罐2
if (refurbish2 != JarGasNowPerSentGet())
{
refurbish2 = JarGasNowPerSentGet();
//覆盖
GUI_DrawBitmap_area(&BMP.j_4page,,,,,,);
//指针
GUI_SetColor(GUI_RED);
i = JarGasNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i));
GUI_FillPolygon(Points1c,countofarry(Points1),,);
//液位
GUI_SetColor(GUI_GREEN);
GUI_SetFont(&GUI_FontComic18B_ASCII);
GUI_GotoXY(,);
GUI_DispDec(JarGasNowGet(),);
}
JarSetnSet(); //罐3
if (refurbish3 != JarGasNowPerSentGet())
{
refurbish3 = JarGasNowPerSentGet();
//覆盖
GUI_DrawBitmap_area(&BMP.j_4page,,,,,,);
//指针
GUI_SetColor(GUI_RED);
i = JarGasNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i));
GUI_FillPolygon(Points1c,countofarry(Points1),,);
//液位
GUI_SetColor(GUI_GREEN);
GUI_SetFont(&GUI_FontComic18B_ASCII);
GUI_GotoXY(,);
GUI_DispDec(JarGasNowGet(),);
}
JarSetnSet(); //罐4
if (refurbish4 != JarGasNowPerSentGet())
{
refurbish4 = JarGasNowPerSentGet();
//覆盖
GUI_DrawBitmap_area(&BMP.j_4page,,,,,,);
//指针
GUI_SetColor(GUI_RED);
i = JarGasNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i));
GUI_FillPolygon(Points1c,countofarry(Points1),,);
//液位
GUI_SetColor(GUI_GREEN);
GUI_SetFont(&GUI_FontComic18B_ASCII);
GUI_GotoXY(,);
GUI_DispDec(JarGasNowGet(),);
}
//-------------------瓶压---------------------
GUI_SetColor(GUI_GREEN);
GUI_SetFont(&GUI_Font16B_ASCII);
JarSetnSet();
if (refurbish1f != JarPressNowGet())
{
refurbish1f = JarPressNowGet();
GUI_DrawBitmap_area(&BMP.j_4page,,,+*,+,,);
GUI_GotoXY(,);
GUI_DispFloatFix(refurbish1f,,); //瓶压1
}
JarSetnSet();
if (refurbish2f != JarPressNowGet())
{
refurbish2f = JarPressNowGet();
GUI_DrawBitmap_area(&BMP.j_4page,,,+*,+,,);
GUI_GotoXY(,);
GUI_DispFloatFix(refurbish2f,,); //瓶压2
}
JarSetnSet();
if (refurbish3f != JarPressNowGet())
{
refurbish3f = JarPressNowGet();
GUI_DrawBitmap_area(&BMP.j_4page,,,+*,+,,);
GUI_GotoXY(,);
GUI_DispFloatFix(refurbish3f,,); //瓶压3
}
JarSetnSet();
if (refurbish4f != JarPressNowGet())
{
refurbish4f = JarPressNowGet();
GUI_DrawBitmap_area(&BMP.j_4page,,,+*,+,,);
GUI_GotoXY(,);
GUI_DispFloatFix(refurbish4f,,); //瓶压4
}
//---------------缓冲压-----------------------
JarSetnSet();
if (refurbish5f != JarBufferPressNowGet())
{
refurbish5f = JarBufferPressNowGet();
GUI_DrawBitmap_area(&BMP.j_4page,,,+*,+,,);
GUI_GotoXY(,);
GUI_DispFloatFix(refurbish5f,,);
}
JarSetnSet();
if (refurbish6f != JarBufferPressNowGet())
{
refurbish6f = JarBufferPressNowGet();
GUI_DrawBitmap_area(&BMP.j_4page,,,+*,+,,);
GUI_GotoXY(,);
GUI_DispFloatFix(refurbish6f,,); //瓶2
}
JarSetnSet();
if (refurbish7f != JarBufferPressNowGet())
{
refurbish7f = JarBufferPressNowGet();
GUI_DrawBitmap_area(&BMP.j_4page,,,+*,+,,);
GUI_GotoXY(,);
GUI_DispFloatFix(refurbish7f,,); //瓶3
}
JarSetnSet();
if (refurbish8f != JarBufferPressNowGet())
{
refurbish8f = JarBufferPressNowGet();
GUI_DrawBitmap_area(&BMP.j_4page,,,+*,+,,);
GUI_GotoXY(,);
GUI_DispFloatFix(refurbish8f,,); //瓶4
}
/* 之前的静态方式
//----仪表盘指针绘制----
//瓶1 瓶压 指针
JarSetnSet(1);
i = JarGasNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i));
GUI_FillPolygon(Points1c,countofarry(Points1),119,65); //中心点
//瓶2 瓶压 指针
JarSetnSet(2);
i = JarGasNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i));
GUI_FillPolygon(Points1c,countofarry(Points1),360,65);
//瓶3 瓶压 指针
JarSetnSet(3);
i = JarGasNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i));
GUI_FillPolygon(Points1c,countofarry(Points1),119,176);
//瓶4 瓶压 指针
JarSetnSet(4);
i = JarGasNowPerSentGet();
i = StateFun_PreSent_Covert(i);
GUI_RotatePolygon(Points1c,Points1,countofarry(Points1),ANGLE(i));
GUI_FillPolygon(Points1c,countofarry(Points1),360,176);
GUI_SetTextMode(GUI_TEXTMODE_TRANS); //文本模式==透明模式
GUI_SetBkColor((GUI_COLOR)-1); //设置背景色==白色
GUI_SetColor(GUI_GREEN); //设置前景色,即字体颜色
//罐体容量
GUI_SetFont(&GUI_FontComic18B_ASCII);
i = 6;
JarSetnSet(1);//设置将要取的瓶号
GUI_GotoXY(103,97);
GUI_DispDec(JarGasNowGet(),3); //罐1
JarSetnSet(2);
GUI_GotoXY(344,97);
GUI_DispDec(JarGasNowGet(),3); //罐2
JarSetnSet(3);
GUI_GotoXY(103,208);
GUI_DispDec(JarGasNowGet(),3); //罐3
JarSetnSet(4);
GUI_GotoXY(344,208);
GUI_DispDec(JarGasNowGet(),3); //罐4
//瓶压
GUI_SetFont(&GUI_Font16B_ASCII);
JarSetnSet(1);
GUI_GotoXY(32,97);
GUI_DispFloatFix(JarPressNowGet(),4,2); //瓶压1
JarSetnSet(2);
GUI_GotoXY(270,97);
GUI_DispFloatFix(JarPressNowGet(),4,2); //瓶压2
JarSetnSet(3);
GUI_GotoXY(32,210);
GUI_DispFloatFix(JarPressNowGet(),4,2); //瓶压3
JarSetnSet(4);
GUI_GotoXY(270,210);
GUI_DispFloatFix(JarPressNowGet(),4,2); //瓶压4
//缓冲压
JarSetnSet(1);
GUI_GotoXY(174,100);
GUI_DispFloatFix(JarBufferPressNowGet(),4,2); //瓶1
JarSetnSet(2);
GUI_GotoXY(413,100);
GUI_DispFloatFix(JarBufferPressNowGet(),4,2); //瓶2
JarSetnSet(3);
GUI_GotoXY(174,211);
GUI_DispFloatFix(JarBufferPressNowGet(),4,2); //瓶3
JarSetnSet(4);
GUI_GotoXY(413,211);
GUI_DispFloatFix(JarBufferPressNowGet(),4,2); //瓶4
*/
}
//**************************************气体检测******************************************
void StateFun_GasCheck(void)
{
//可燃气体浓度 0--100
u32 i;
GUI_SetTextMode(GUI_TEXTMODE_NORMAL);
//GUI_SetFont(&GUI_Font16B_ASCII);
GUI_SetFont(&GUI_Font8x12_ASCII);
GUI_SetColor(GUI_GREEN); //设置前景色,即字体颜色 //有报警则用红色字体,否则用绿色字体
if(IsBurntGasAlarm()) //
{
GUI_SetColor(GUI_RED);
}else
{
GUI_SetColor(GUI_GREEN);
}
i = BurntGasCheckGet();
GUI_GotoXY(,+);
GUI_DispDec(i,); if(IsBurntGasAlarm()) //
{
GUI_SetColor(GUI_RED);
}else
{
GUI_SetColor(GUI_GREEN);
}
i = BurntGasCheckGet();
GUI_GotoXY(,+);
GUI_DispDec(i,); if(IsBurntGasAlarm()) //
{
GUI_SetColor(GUI_RED);
}else
{
GUI_SetColor(GUI_GREEN);
}
i = BurntGasCheckGet();
GUI_GotoXY(,+);
GUI_DispDec(i,); if(IsBurntGasAlarm()) //
{
GUI_SetColor(GUI_RED);
}else
{
GUI_SetColor(GUI_GREEN);
}
i = BurntGasCheckGet();
GUI_GotoXY(,+);
GUI_DispDec(i,); if(IsBurntGasAlarm()) //
{
GUI_SetColor(GUI_RED);
}else
{
GUI_SetColor(GUI_GREEN);
}
i = BurntGasCheckGet();
GUI_GotoXY(,+);
GUI_DispDec(i,);
}
//检测是否有气体浓度超标。只有一个超,则认为是超标
bool StateFun_GasCheck_isAlm(void)
{
//bool fl = false;
u32 i;
for(i = ;i<= ;i++)
{
if(IsBurntGasAlarm(i))
{
return true;//fl = true;
}
}
return false;
}
//**************************************显示功能按键***************************************
//仅进行位置
void StateFun_DisAllFunKey(u32 KeyIndex)
{
//显示全部的功能按键
TouchcBmp(&BMP.j_but_forward_up, ,,);
TouchcBmp(&BMP.j_but_back_up , ,,);
TouchcBmp(&BMP.j_but_4page_up , ,,);
//TouchcBmp(&BMP.j_but_gas_up , 180,226,0);
TouchcJpeg_LngChromaAlm();
TouchcJpeg_HardCheck();//TouchcJpeg( j_but_had_check_up, 240,226,0);
TouchcBmp_SysAlm();//TouchcBmp(&BMP.j_but_alarm_up, 300,226,0);
TouchcJpeg_beep(); //显示声音是否关闭
TouchcBmp(&BMP.j_but_set_up, ,,);
//绑定键号,使按下任意键,即可检测到。
if(KeyIndex!= )
{
//绑定键号
TouchcSet(KeyIndex,,,,);
}
}
三个文件
sasasa的更多相关文章
- Linq语言性能比较
我不只一次听到不少做技术的朋友随口一句,“linq性能是最差的”,由于缺少具体的数字比照也就没在意,但心里隐隐觉得事实应该不是这样的,我记得我第一次听到有人贬低C# 3.0是在我工作后不久的一个夏季, ...
- sql 跨库查询备忘笔记
select * from OPENDATASOURCE( 'SQLOLEDB', 'Data Source=远程ip;User ID=sa;Password=密码' ).库名.dbo.表名 inse ...
- SQL Server跨库复制表数据错误的解决办法
SQL Server跨库复制表数据的解决办法 跨库复制表数据,有很多种方法,最常见的是写程序来批量导入数据了,但是这种方法并不是最优方法,今天就用到了一个很犀利的方法,可以完美在 Sql Serv ...
- hibernate.properties官方属性用例(可用于hibernate.cfg.xml属性参考)
######################### Query Language ######################### ## define query language constant ...
- hibernate数据库配置
在文件夹etc中 ## MySQL #hibernate.dialect org.hibernate.dialect.MySQLDialect #hibernate.dialect org.hiber ...
- C#学习笔记15:字符串、文件、目录的操作方法
字符串:不可变性 String str=”abcdf”; 将字符串转换为char数组:ToCharArray(); Char[] ch=str.ToCharAarray(); 将char数组转换为字符 ...
- hibernate.cfg.xml文件的配置模板和不同数据库的配置參数
(1)hibernate.cfg.xml文件的配置模板 <?xml version="1.0" encoding="UTF-8"?> <!DO ...
- Hibernate配置文件中配置各种数据库的driver、URL
hibernate.properties ######################### Query Language ######################### ## define qu ...
- SQL Server 跨库复制表方法小笔记
insert into tableA (column1,column2.....) SELECT * FROM OPENDATASOURCE('SQLOLEDB', 'Data Source=127. ...
随机推荐
- 使用rem来开发你的移动端网站
what is rem ? )css3中的计量元素大小的单位,类似px.pt.em. )一种相对根元素font-size的计算方式.1rem = <html>'s font-size px ...
- 集群tomcat+apache配置文档
http://wenku.baidu.com/link?url=M_Lt07e-9KTIHucYgJUCNSxkjWThUuQ2P8axn8q6YmY_yQw7NmijQoDA2wKmi_FQUxwO ...
- Compare接口
1.Comparable接口 此接口强行对实现它的每个类的对象进行整体排序.此排序被称为该类的自然排序 ,类的 compareTo 方法被称为它的自然比较方法 .实现此接口的对象列表(和数组)可以通过 ...
- linux 基础知识
一.命令的基本用法 (1).Linux里面的命令分为内置命令和独立的命令. (2).命令行的基本使用方法 Cli Syntax #命令和选项 ...
- JQuery_事件基础
JavaScript 有一个非常重要的功能,就是事件驱动.当页面完全加载后,用户通过鼠标或键盘触发页面中绑定事件的元素即可触发. jQuery 为开发者更有效率的编写事件行为, 封装了大量有益的事件方 ...
- 离线更新VSAN HCL数据库
从VSAN 6.0起,VSAN提供了Health Check功能,其中就包括VSAN HCL数据库,通过此运行状况检查验证用于 HCL 检查的 VMware 兼容性指南数据库是否是最新的.这些 VCG ...
- VMWARE里启动kylin16.0时出现'SMBus Host Controller not enabled'(还未进入系统)
在Vmware里安装完Ubuntu16.10,启动时出现'SMBus Host Controller not enabled'错误提示,进不到图形界面.网上搜了一下,解决办法是在图形界面里进终端窗口, ...
- url的内容及格式
url的内容及结构: url格式:
- systemctl命令用法详解
systemctl命令用法详解系统环境:Fedora 16binpath:/bin/systemctlpackage:systemd-units systemctl enable httpd.serv ...
- (转)再不用担心DataRow类型转换和空值了(使用扩展方法解决高频问题)
再不用担心DataRow类型转换和空值了(使用扩展方法解决高频问题) XML文档操作集锦(C#篇) webapi文档描述-swagger