📄 lcddrv.c
字号:
/****************************************************************
** *
** FILE : LCDDrv.C *
** COPYRIGHT : (c) 2001 .Xiamen Yaxon NetWork CO.LTD *
** *
** *
** By : CCH 2002.1.15 *
****************************************************************/
#define SRC_LCDDRV
#include "includes.h"
#include "version.h"
#include "public.h"
#include "tools.h"
#include "stream.h"
#include "uart_drv.h"
#include "timetask.h"
#include "systime.h"
#include "gpsrecer.h"
#include "pdumode.h"
#include "alarmer.h"
#include "at_core.h"
#include "sm_list.h"
#include "sysframe.h"
#include "systask.h"
#include "gprsdrv.h"
#include "phonedrv.h"
#include "monitor.h"
#include "callrht.h"
#include "lcddrv.h"
#include "lcdrecv.h"
#include "lcdlist.h"
#if EN_BLACKBOX >0
void HdlMsgBlkBox21H(void);
#endif
#if EN_LCD > 0 /* EN_LCD */
typedef unsigned long ip_addr;
char * parse_ipad(ip_addr *, unsigned *, char *);
/*
********************************************************************************
* DEFINE CONFIG PARAMETERS
********************************************************************************
*/
#define LCD_ACK 0x01
#define LCD_NAK 0x02
#define PERIOD_QUERY SECOND, 30
#define LCD_CHECKING 0x02 //yyy
#define LCD_CHECKED 0X03 //yyy
#define LCD_NOTIME 0X04 //yyy
/*
********************************************************************************
* DEFINE MODULE VARIANT
********************************************************************************
*/
static INT8U buffer[LCD_BUFSIZE];
static BOOLEAN comok;
static STREAM strm, *wstrm;
static TMR_TSK *querytmr;
static INT8U AckBuf[5];
static void SendLCDAck(INT8U type, INT8U ack)
{
buffer[0] = ack;
RequestSend_LCD(LCD_ATTR_COMMON, type, buffer, 1, 0);
}
static void Informer_0x80(INT8U result)
{
if (result == _SUCCESS)
result = LCD_ACK;
else {
result = LCD_NAK;
}
SendLCDAck(0x81, result);
}
static void Informer_0x84(INT8U result)
{
if (result == _SUCCESS)
result = LCD_ACK;
else {
result = LCD_NAK;
}
SendLCDAck(0x85, result);
}
static void Informer_0x70(INT8U result)
{
if (result == _SUCCESS)
result = LCD_ACK;
else {
result = LCD_NAK;
}
SendLCDAck(0x71, result);
}
static void Informer_0x30(INT8U result)
{
if (result == _SUCCESS)
result = LCD_ACK;
else
result = LCD_NAK;
SendLCDAck(0x31, result);
}
static void Informer_0xD3(INT8U result)
{
if (result == _SUCCESS)
result = LCD_ACK;
else
result = LCD_NAK;
SendLCDAck(0xD2, result);
}
/*
********************************************************************************
* Handler: HdlMsg_0x03
********************************************************************************
*/
static void HdlMsg_0x03(void)
{
HWORD_UNION ret;
ret = GetDatumData((DATUM_STRUCT *)buffer);
RequestSend_LCD(LCD_ATTR_COMMON, 0x04, buffer, ret.bytes.low, 0);
}
/*
********************************************************************************
* Handler: HdlMsg_0x05
********************************************************************************
*/
static void HdlMsg_0x05(void)
{
if (PubParaValid(MYTEL_)) {
RequestSend_LCD(LCD_ATTR_COMMON, 0x06, MyTel.tel, MyTel.len, 0);
} else {
RequestSend_LCD(LCD_ATTR_COMMON, 0x06, 0, 0, 0);
}
}
/*
********************************************************************************
* Handler: HdlMsg_0x07
********************************************************************************
*/
static void HdlMsg_0x07(void)
{
INT8U len;
InitStrm(&strm, (STREAMMEM *)buffer, sizeof(buffer));
len = GetSysTime_Time((TIME_STRUCT *)GetStrmPtr(&strm));
MovStrmPtr(&strm, len);
len = GetSysTime_Date((DATE_STRUCT *)GetStrmPtr(&strm));
MovStrmPtr(&strm, len);
RequestSend_LCD(LCD_ATTR_COMMON, 0x08, GetStrmStartPtr(&strm), GetStrmLen(&strm), 0);
}
/*
********************************************************************************
* Handler: HdlMsg_0x70
********************************************************************************
*/
static void HdlMsg_0x70(void)
{
INT8U *tel;
INT8U tellen;
INT16U attrib;
wstrm = GetSYSFrameStream();
ASMSYSFrameHead_MODE2(wstrm, EgCode.egcode, 0x0541);
WriteDATA_Strm(wstrm, &lcdrecv.buffer[2], lcdrecv.len - 2);
if (PubParaValid(ATTEMPERTEL_)) {
tel = AttemperTel.tel;
tellen = AttemperTel.len;
} else {
tel = 0;
tellen = 0;
}
attrib = GetServiceAttrib(SER_ATTEMPER);
if (!SendSYSFrame_MODE2(wstrm, tel, tellen, attrib, Informer_0x70)) {
Informer_0x70(_FAILURE);
}
}
/*
********************************************************************************
* Handler: HdlMsg_0x71
********************************************************************************
*/
static void HdlMsg_0x71(void)
{
ConfirmSend_LCD(0x70, _SUCCESS);
}
/*
********************************************************************************
* Handler: HdlMsg_0x7a 电召抢答 add by qzc
********************************************************************************
*/
static void Informer_0x76(INT8U result)
{
if (result == _SUCCESS)
result = 0x01;
else {
result = 0x00;
}
SendLCDAck(0x76, result);
}
static void HdlMsg_0x7a(void)
{
INT8U *tel;
INT8U tellen;
INT16U attrib;
wstrm = GetSYSFrameStream();
ASMSYSFrameHead_MODE2(wstrm, EgCode.egcode, 0x057c);
if (PubParaValid(ATTEMPERTEL_)) {
tel = AttemperTel.tel;
tellen = AttemperTel.len;
} else {
tel = 0;
tellen = 0;
}
attrib = GetServiceAttrib(SER_ATTEMPER);
if(!SendSYSFrame_MODE2(wstrm,tel,tellen,SM_ATTR_SUCCESS|attrib,Informer_0x76))
Informer_0x76(_FAILURE);
}
/*
********************************************************************************
* Handler: HdlMsg_0x7b 电召结果报告 add by qzc
********************************************************************************
*/
static void HdlMsg_0x7b(void)
{
INT8U *tel;
INT8U tellen;
INT16U attrib;
INT16U TempLen;
wstrm = GetSYSFrameStream();
ASMSYSFrameHead_MODE2(wstrm, EgCode.egcode, 0x057e);
TempLen=CodeX_To_Code6(MODE_CODE8,AckBuf,&lcdrecv.buffer[2],1,sizeof(AckBuf));
WriteDATA_Strm(wstrm,AckBuf,TempLen);
//WriteBYTE_Strm(wstrm,lcdrecv.buffer[2]);
if (PubParaValid(ATTEMPERTEL_)) {
tel = AttemperTel.tel;
tellen = AttemperTel.len;
} else {
tel = 0;
tellen = 0;
}
attrib = GetServiceAttrib(SER_ATTEMPER);
if(!SendSYSFrame_MODE2(wstrm,tel,tellen,SM_ATTR_SUCCESS|attrib,Informer_0x76))
Informer_0x76(_FAILURE);
}
/*
********************************************************************************
* Handler: HdlMsg_0xD1
********************************************************************************
*/
static void HdlMsg_0xD1(void)
{
ConfirmSend_LCD(0xD0, _SUCCESS);
}
/*
********************************************************************************
* Handler: HdlMsg_0xD3
********************************************************************************
*/
static void HdlMsg_0xD3(void)
{
INT8U *tel;
INT8U tellen;
INT16U attrib;
wstrm = GetSYSFrameStream();
ASMSYSFrameHead_MODE2(wstrm, EgCode.egcode, 0x2141);
WriteDATA_Strm(wstrm, &lcdrecv.buffer[2], lcdrecv.len - 2);
if (PubParaValid(ATTEMPERTEL_)) {
tel = AttemperTel.tel;
tellen = AttemperTel.len;
} else {
tel = 0;
tellen = 0;
}
attrib = GetServiceAttrib(SER_ATTEMPER);
if (!SendSYSFrame_MODE2(wstrm, tel, tellen, attrib, Informer_0xD3)) {
Informer_0xD3(_FAILURE);
}
}
/*
********************************************************************************
* Handler: HdlMsg_0x10
********************************************************************************
*/
static void HdlMsg_0x10(void)
{
INT8U ack;
if (DialDTMF(PHONE_COM, lcdrecv.buffer[2])) {
ack = LCD_ACK;
} else {
ack = LCD_NAK;
}
SendLCDAck(0x11, ack);
}
/*
********************************************************************************
* Handler: HdlMsg_0x12
********************************************************************************
*/
static void HdlMsg_0x12(void)
{
INT8U result, ack;
if (!CallRHTPass(CALLRHT_DIALED, lcdrecv.buffer[2], &lcdrecv.buffer[3])) {
SendLCDAck(0x13, 0x05);
return;
}
if (!AlarmerPermitTalk()) {
SendLCDAck(0x13, 0x02);
return;
}
////result = RingupPhone(PHONE_COM, CHA_LCD, &lcdrecv.buffer[3], lcdrecv.buffer[2], 0);
result = RingupPhone(PHONE_COM, CHA_HANDSFREE, &lcdrecv.buffer[3], lcdrecv.buffer[2], 0);
switch (result)
{
case PHONE_ACCEPT:
ack = 0x01;
break;
case PHONE_BUSY:
ack = 0x02;
break;
case PHONE_ERROR:
ack = 0x02;
break;
case PHONE_NOSIM:
ack = 0x03;
break;
case PHONE_NONETWORK:
case PHONE_SEARCHINGNETWORK:
ack = 0x04;
break;
default:
ack = 0x02;
break;
}
SendLCDAck(0x13, ack);
}
/*
********************************************************************************
* Handler: HdlMsg_0x14
********************************************************************************
*/
static void HdlMsg_0x14(void)
{
INT8U ack;
////if (PickupPhone(PHONE_COM, CHA_LCD, 0)) {
if (PickupPhone(PHONE_COM, CHA_HANDSFREE, 0)) {
ack = LCD_ACK;
} else {
ack = LCD_NAK;
}
SendLCDAck(0x15, ack);
}
/*
********************************************************************************
* Handler: HdlMsg_0x16
********************************************************************************
*/
static void HdlMsg_0x16(void)
{
INT8U ack;
if (HangupPhone(PHONE_COM, 0)) {
ack = LCD_ACK;
} else {
ack = LCD_NAK;
}
SendLCDAck(0x17, ack);
}
/*
********************************************************************************
* Handler: HdlMsg_0x18
********************************************************************************
*/
static void HdlMsg_0x18(void)
{
ConfirmSend_LCD(0x19, _SUCCESS);
}
/*
********************************************************************************
* Handler: HdlMsg_0x20
********************************************************************************
*/
static void HdlMsg_0x20(void)
{
ConfirmSend_LCD(0x21, _SUCCESS);
}
/*
********************************************************************************
* Handler: HdlMsg_0x21
********************************************************************************
*/
static void HdlMsg_0x21(void)
{
#if EN_BLACKBOX >0
HdlMsgBlkBox21H();
#endif
}
/*
********************************************************************************
* Handler: HdlMsg_0x22
********************************************************************************
*/
static void HdlMsg_0x22(void)
{
ConfirmSend_LCD(0x23, _SUCCESS);
}
/*
********************************************************************************
* Handler: HdlMsg_0x24
********************************************************************************
*/
static void HdlMsg_0x24(void)
{
SendLCDAck(0x25, GetSignalIntensity());
}
/*
********************************************************************************
* Handler: HdlMsg_0x26
********************************************************************************
*/
static void HdlMsg_0x26(void)
{
/* INT8U curchannel, ack;
curchannel = GetVoiceChannel(PHONE_COM);
if (curchannel == CHA_LCD) {
ack = LCD_ACK;
ChangeVoiceChannel(PHONE_COM, CHA_HANDSFREE);
} else if (curchannel == CHA_HANDSFREE) {
ack = LCD_ACK;
ChangeVoiceChannel(PHONE_COM, CHA_LCD);
} else {
ack = LCD_NAK;
}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -