?? pc_comm.h
字號:
/******************************************************************************
* Module: PC_Comm.C
* Modified by: X.C.Zheng WeiHua
* Modified on: Date: 2003-12-06 17:29
* Copyright(c) WeiHua Tech Ltd.
* Description: Communication with PC.
******************************************************************************/
#include "ecrsys.h"
#ifdef PC_COMM /* Support the PC communication function */
/************************************************************************
Command codes of the communication protocol
************************************************************************/
#define PLU_DWN 0x01 /* PLU parameter down-load */
#ifdef SCANNER /* Support the scanner function */
#define PLU_IDX_DWN 0x02 /* PLU index table down-load */
#endif /* End SCANNER */
#define SYS_PARA_DWN 0x03 /* System parameter down-load */
#define CLERK_DWN 0x04 /* Clerk parameter down-load */
#define TTL_DESC_DWN 0x05 /* Total description down-load */
#define RFND_DWN 0x06 /* Refund parameter down-load */
//#define WLCM_BOTM_MSG_DWN 0x07 /* Welcome & Trailer message down-load */
#define KB_POS_LAYOUT_DWN 0x07 // POS Keyboard layout down-load
#define DEPT_DWN 0x08 /* Department parameter down-load */
#define PER_DWN 0x09 /* Percent parameter down-load */
#define RAM_LOGO_DWN 0x0A /* Ram Logo down-load */
#define SNGL_PLU_DWN 0x0B /* Single PLU down-load */
#ifdef STOCK /* Suppor the stock function */
#define PLU_STOCK_DWN 0x0C /* PLU stock down-load */
#define SNGL_PLU_STOCK_DWN 0x0D /* Single PLU stock down-load */
#endif /* End STOCK */
#define KEY_LAYOUT_DWN 0x0E /* Keyboard layout down-load */
#define WLCM_MSG_DWN 0xA1 /* Welcome message down-load */
#define BOTM_MSG_DWN 0xA2 /* Trailer message down-load */
#define VAT_DWN 0xA3 /* VAT rate down-load */
#define TAX_DWN 0xA4 /* Tax rate down-load */
#define PCASH_DWN 0xA5 /* PCASH parameter down-load */
#ifdef FCE_FUNC /* Support the FCE function */
#define FCE_DWN 0xA6 /* FCE parameter down-load */
#endif /* End FCE_FUNC */
#ifdef VER_RSNT /* Support the restaurant function */
#define TABLE_DWN 0xA7 /* Table parameter down-load */
#define WAITER_DWN 0xA8 /* Waiter parameter down-load */
#endif /* End VER_RSNT */
#define REGI_DESC_DWN 0xA9 /* Register descriptor down-load */
#define KP_RP_FLAG_DWN 0xAB /* KP/RP flag down-load */
#define PLUTAB_DWN 0xB2 /* PLU relation table down-load */
#ifdef ELEC_SCALE
#define SCALEPLU_PARA_DWN 0xB3 /* Scale PLU parameter down-load */
#define SCALEPLU_DATA_DWN 0xB4 /* Scale PLU table data down-load */
#endif
#define HAND_SHAKE 0x20 /* Version No. gets */
#define ECHO_OK 0x21 /* ECHO OK */
#define ECHO_ER 0x22 /* ECHO Error */
#define ECHO_STATUS 0x23 /* ECHO the status */
#define ECHO_EXIT_COMM 0x99 /* Exit the communication process */
#define PLU_UP 0x31 /* PLU parameter up -load */
#ifdef SCANNER /* Suport the scanner function */
#define PLU_IDX_UP 0x32 /* PLU index table up -load */
#endif /* End SCANNER */
#define SYS_PARA_UP 0x33 /* System parameter up -load */
#define CLERK_UP 0x34 /* Clerk parameter up -load */
#define TTL_DESC_UP 0x35 /* Total description up -load */
#define RFND_UP 0x36 /* Refund parameter up-load */
//#define WLCM_BOTM_MSG_UP 0x37 /* Welcome & Trailer message up -load */
#define KB_POS_LAYOUT_UP 0x37 // POS Keyboard layout up-load
#define DEPT_UP 0x38 /* Department parameter up -load */
#define PER_UP 0x39 /* Percent parameter up -load */
#define SNGL_PLU_UP 0x3F /* Single PLU up-load */
#ifdef STOCK /* Support the stock function */
#define PLU_STOCK_UP 0x3C /* PLU stock up-load */
#define SNGL_PLU_STOCK_UP 0x3D /* Single PLU stock up-load */
#endif /* End STOCK */
#define KEY_LAYOUT_UP 0x3E /* Keyboard layout up-load */
#define WLCM_MSG_UP 0xC1 /* Welcome message up-load */
#define BOTM_MSG_UP 0xC2 /* Trailer message up-load */
#define VAT_UP 0xC3 /* VAT rate up-load */
#define TAX_UP 0xC4 /* Tax rate up-load */
#define PCASH_UP 0xC5 /* PCASH parameter up-load */
#ifdef FCE_FUNC /* Support the FCE function */
#define FCE_UP 0xC6 /* FCE parameter up-load */
#endif /* End FCE_RUNC */
#ifdef VER_RSNT /* Support the restaurant function */
#define TABLE_UP 0xC7 /* Table parameter up-load */
#define WAITER_UP 0xC8 /* Waiter parameter up-load */
#endif /* End VER_RSNT */
#define REGI_DESC_UP 0xC9 /* Register descriptor up-load */
#define KP_RP_FLAG_UP 0xCB /* KP/RP flag up-load */
#ifdef ELEC_JRNL
#define SALE_JRNL_UP 0xCC /* Sale journal up-load */
#define DC_JRNL_UP 0xCD /* Discount journal up-load */
#define RM_JRNL_UP 0xCE /* Return Merchandise journal up-load */
#define SALE_JRNL_UP2 0xCF /* Sale journal up-load (Second way) */
#define DC_JRNL_UP2 0xD0 /* Discount journal up-load (Second way) */
#define RM_JRNL_UP2 0xD1 /* Return Merchandise journal up-load (Second way) */
#endif
#define PLUTAB_UP 0xE2 /* PLU relation table up-load */
#ifdef ELEC_SCALE
#define SCALEPLU_PARA_UP 0xE3 /* Scale PLU parameter up-load */
#define SCALEPLU_DATA_UP 0xE4 /* Scale PLU table data up-load */
#endif
#ifdef PC_TEST
#define PST_UP 0xAA /* Tax rate up-load */
#define PST_DWN 0xCA /* Tax rate up-load */
#endif
#define DAILY_RPT_UP_X 0x40 /* Daily report up-load (X) */
#define DAILY_RPT_UP_Z 0x41 /* Daily report up-load (Z) */
#define PTD_RPT_UP_X 0x42 /* Period report up-load (X) */
#define PTD_RPT_UP_Z 0x43 /* Period report up-load (Z) */
#define DAILY_PLU_UP_X 0x44 /* Daily PLU report up-load (X) */
#define DAILY_PLU_UP_Z 0x45 /* Daily PLU report up-load (Z) */
#define PTD_PLU_UP_X 0x46 /* Period PLU report up-load (X) */
#define PTD_PLU_UP_Z 0x47 /* Period PLU report up-load (Z) */
#define DAILY_CLERK_UP_X 0x48 /* Daily clerk report up-load (X) */
#define DAILY_CLERK_UP_Z 0x49 /* Daily clerk report up-load (Z) */
#define PTD_CLERK_UP_X 0x4A /* Period clerk report up-load (X) */
#define PTD_CLERK_UP_Z 0x4B /* Period clerk report up-load (Z) */
#ifdef VER_RSNT /* Support the restaurant function */
#define TOT_TABLE_UP_X 0x4C /* Total table report up-load (X) */
#define TOT_TABLE_UP_Z 0x4D /* Total table report up-load (Z) */
#endif /* End VER_RSNT */
#define HOURLY_RPT_UP_X 0x4E /* Hourly sales report up-load (X) */
#define HOURLY_RPT_UP_Z 0x4F /* Hourly sales report up-load (Z) */
#ifdef VER_RSNT /* Support the restaurant function */
#define ACITVE_TABLE_UP_X 0x50 /* Active table sales report up-load (X) */
#define WAITER_RPT_UP_X 0x52 /* Waiter sales report up-load (X) */
#define WAITER_RPT_UP_Z 0x53 /* Waiter sales report up-load (Z) */
#endif /* End VER_RSNT */
/* The report defind area, reserved */
/*--------------------------------------*
The error code define.
*--------------------------------------*/
#define COMM_TIME_OVER 1 /* Communication time over. (When 3s not received the demand data) */
#define NON_EXIST_CMD 2 /* Nonexistent command code. */
#define NOT_MATCH_FORMAT 3 /* The received data's format error. */
#define CS_ERR 4 /* Check sum error. */
#define PLU_NOT_BLANK 5 /* PLU total amount & quantity not blank. */
#define REPORT_NOT_VOID 6 /* Not all the reports data is void. */
#define WORK_MODE_ERROR 7 /* Work mode error */
#define DEPT_NOT_BLANK 8 /* DEPT total amount & quantity not blank. */
#define SAME_PLU_INDEX 9 /* The same PLU index */
#define NO_HARD_CTRL_LOCK 10 /* The hard control lock scan not exists */
#define VAT_MODE_ERR 11 /* Not in the VAT mode */
#define TAX_MODE_ERR 12 /* Not in the tax mode */
#define PLU_RELATION_TABLE 13 /* The attribute of PLU is different in ECR and PC */
/*--------------------------------------*
The other code define.
*--------------------------------------*/
#ifdef ELEC_JRNL
#define EJ_REQ 0x01 /* Request */
#define EJ_NEXT 0x02 /* Next */
#define EJ_RETRY 0x03 /* Retry */
#define EJ_EXIT 0x09 /* Exit */
#define EJ_ECHO_OK ECHO_OK /* Echo OK */
#define EJ_ECHO_ER ECHO_ER /* Echo error */
#define EJ_ER_REQ EJ_REQ /* Require error */
#define EJ_ER_NEXT EJ_NEXT /* Next error */
#define EJ_ER_RETRY EJ_RETRY /* Retry error */
#define EJ_ER_OTHER 0x04 /* Other error */
#define EJ_UP_CON 0x01 /* EJ up-load not finished */
#define EJ_UP_FIN 0x02 /* EJ up-load is finished */
#endif
/*-----------------------------------------------*
The communication function.
*-----------------------------------------------*/
byte Get_Data(void);
byte Verify_CS(byte *vfy_str, word length, byte check_sum);
byte Wr_Long_Str_Uart(byte port, byte *str, word len);
byte HandShake(void);
void PC_Comm_Port_Init(char flag);
void Send_Error_Info(byte Error_Type);
void Send_Succeed_Info(void);
void Test_Send_Data(void);
void Test_Rpt_Send_Data(void);
void PC_Comm_Exit_Send(void);
void Write_Head(void);
void PC_Comm_Para_Init(void);
void PC_Comm_Restore(void);
void Read_Data_PC(void);
void Send_Data_PC(void);
void CalCS(byte *src_str, word length, byte *check_sum);
#ifdef SCANNER /* Support the scanenr function */
void Sngl_PLU_Index_Update(void);
#endif /* End SCANNER */
long Qty_Format_Change(long quantity, byte flag);
#ifdef ELEC_JRNL
void Send_EJ_Error_Info(byte flag1, byte error_type);
void Set_EJ_Send(void);
void Clr_EJ_Send(void);
BOOL Chk_EJ_Send(byte clr_flag);
void Set_EJ_Up(void);
void Set_EJ_Sta(byte status);
void EJ_Bak_Tax(void);
#endif
void Do_PLU_Dwn(void);
#ifdef SCANNER /* Support the scanner function */
void Do_PLU_Idx_Dwn(void);
#endif /* End SCANNER */
void Do_Sys_Para_Dwn(void);
void Do_Clerk_Dwn(void);
void Do_Ttl_Desc_Dwn(void);
void Do_Rfnd_Dwn(void);
//void Do_Wlcm_Botm_Msg_Dwn(void);
void Do_Dept_Dwn(void);
void Do_Per_Dwn(void);
void Do_Ram_Logo_Dwn(void);
void Do_Sngl_PLU_Dwn(void);
#ifdef STOCK /* Support the stock function */
void Do_PLU_Stock_Dwn(void);
void Do_Sngl_PLU_Stock_Dwn(void);
#endif /* End STOCK */
void Do_Key_Layout_Dwn(void);
void Do_KB_POS_Layout_Dwn(void);
void Do_Wlcm_Msg_Dwn(void);
void Do_Botm_Msg_Dwn(void);
void Do_VAT_Dwn(void);
void Do_Tax_Dwn(void);
void Do_PCASH_Dwn(void);
#ifdef FCE_FUNC /* Support hte FCE function */
void Do_FCE_Dwn(void);
#endif /* End FCE_FUNC */
#ifdef VER_RSNT /* Support the restaurant function */
void Do_Table_Dwn(void);
void Do_Waiter_Dwn(void);
#endif /* End VER_RSNT */
void Do_Regi_Desc_Dwn(void);
void Do_KP_RP_Flag_Dwn(void);
void Do_PLU_relation_tabl_Dwn(void);
#ifdef ELEC_SCALE
void Do_Scale_PLU_Para_Dwn(void);
void Do_Scale_PLU_Data_Dwn(void);
#endif
void Do_PLU_Up(void);
#ifdef SCANNER /* Support the scanner fucntion */
void Do_PLU_Idx_Up(void);
#endif /* End SCANNER */
void Do_Sys_Para_Up(void);
void Do_Clerk_Up(void);
void Do_Ttl_Desc_Up(void);
void Do_Rfnd_Up(void);
//void Do_Wlcm_Botm_Msg_Up(void);
void Do_Dept_Up(void);
void Do_Per_Up(void);
void Do_Sngl_PLU_Up(void);
#ifdef STOCK /* Support the stock function */
void Do_PLU_Stock_Up(void);
void Do_Sngl_PLU_Stock_Up(void);
#endif /* End STOCK */
void Do_Key_Layout_Up(void);
void Do_KB_POS_Layout_Up(void);
void Do_Wlcm_Msg_Up(void);
void Do_Botm_Msg_Up(void);
void Do_VAT_Up(void);
void Do_Tax_Up(void);
void Do_PCASH_Up(void);
#ifdef FCE_FUNC /* Support hte FCE function */
void Do_FCE_Up(void);
#endif /* End FCE_FUNC */
#ifdef VER_RSNT /* Support the restaurant function */
void Do_Table_Up(void);
void Do_Waiter_Up(void);
#endif /* End VER_RSNT */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -