BscImmed.c /
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSCIMMED_C
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include "Common.h"
#include "XCore.h"
#include "XPrtEng.h"
#include "XComm.h"
#include "XFunction.h"
#include "..\Parser.h"
#include "..\ParserUtil.h"
#include "BscImmed.h"
/******************************************************************************
* *
* L O C A L D E F I N E S *
* *
******************************************************************************/
#define IMM_CMD_TITLE_LEN (sizeof(ImmCmdTitle) - 1)
#define IMM_CMD_TOTAL (sizeof(ImmCmdEntry) / sizeof(_CmdEntry))
/******************************************************************************
* *
* L O C A L T Y P E D E F S *
* *
******************************************************************************/
typedef struct
{
CHAR *keyword;
VOID (*func)(INT);
}_ImmCmdEntry;
/******************************************************************************
* *
* L O C A L F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
VOID IMM_InquiryStatus(INT);
VOID IMM_InquiryExtStatus(INT);
VOID IMM_InquiryRibbonStatus(INT);
VOID IMM_Reset(INT);
VOID IMM_QuitAuto(INT);
VOID IMM_CancelAuto(INT);
VOID IMM_CloseImmed(INT);
/******************************************************************************
* *
* L O C A L I N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
#if defined(__HITACHI__)
#pragma section ISR
#endif
CONST CHAR ImmCmdTitle[] = "\x1b!";
CONST _ImmCmdEntry ImmCmdEntry[] =
{
{"?", IMM_InquiryStatus},
{"S", IMM_InquiryExtStatus},
{"T", IMM_InquiryRibbonStatus},
{"R", IMM_Reset},
{"Q", IMM_QuitAuto},
{"C", IMM_CancelAuto},
{"D", IMM_CloseImmed},
};
#if defined(__HITACHI__)
#pragma section
#endif
/******************************************************************************
* *
* L O C A L U N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
STATIC INT ImmReceivePtr;
STATIC BOOL ImmCommandEnable;
VOID InitialImmCmd(VOID)
{
ImmReceivePtr = 0;
ImmCommandEnable = TRUE;
}
BOOL CtrlImmedCmd(BOOL Flag)
{
BOOL backup = ImmCommandEnable;
ImmCommandEnable = Flag;
return backup;
}
#if defined(__HITACHI__)
#pragma section ISR
#endif
#if defined(__HITACHI__)
#pragma inline(CheckImmedCmd)
#endif
INT CheckImmedCmd(CHAR Data, CHAR *pString, INT Port)
{
INT i;
if (ImmCommandEnable)
{
if (ImmReceivePtr >= IMM_CMD_TITLE_LEN)
{
for (i = 0; i < IMM_CMD_TOTAL; i++)
{
if (*(ImmCmdEntry[i].keyword) == Data)
{
ImmReceivePtr = 0;
ImmCmdEntry[i].func(Port);
return 0;
}
}
}
else if (Data == ImmCmdTitle[ImmReceivePtr])
{
ImmReceivePtr += 1;
return 0;
}
if (ImmReceivePtr)
{
for (i = 0; i < ImmReceivePtr; i++)
{
*pString = ImmCmdTitle[i];
pString += 1;
}
*pString = Data;
ImmReceivePtr = 0;
return (i + 1);
}
}
*pString = Data;
return 1;
}
/******************************************************************************
Bit Status
0 Carriage opened (TTP-243, 243M)
1 Paper jam
2 Out of paper
3 Out of ribbon
4 Pause (TTP-243, 243M) Reserved (TTP-242)
5 Printing
6 Cover opened (TTP-243M), Reserved (TTP-242,243)
7 Error
******************************************************************************/
VOID IMM_InquiryStatus(INT Port)
{
_eMotorStatus MotorStatus = GetMotorStatus();
WORD JobError = GetJobErrorState();
BOOL JobLock = CheckJobLock();
BYTE Status;
Status = 0x00;
#if defined(CARRIAGE_OPEN_MODEL)
if (IsCarriageOpen() && pPrintCfg->CarriageOpen)
Status |= 0x01;
#endif
if (JobError & ERROR_PAPER_JAM)
Status |= 0x02;
if (JobError & ERROR_PAPER_EMPTY)
Status |= 0x04;
if (JobError & ERROR_RIBBON_JAM || JobError & ERROR_RIBBON_EMPTY)
Status |= 0x08;
if (JobLock)
Status |= 0x10;
if (MotorStatus == STATUS_MOTOR_FORWARD || MotorStatus == STATUS_MOTOR_BACKWARD)
Status |= 0x20;
if (JobError & ERROR_CUTTER ||
JobError & ERROR_TPH_OVERHEAT ||
JobError & ERROR_MOTOR_OVERHEAT)
Status |= 0x80;
CommWrite(Port, &Status, sizeof(BYTE), 0);
}
/*
* Response <STX> [four-byte status] <ETX> <CR> <LF>
*/
VOID IMM_InquiryExtStatus(INT Port)
{
_eJobMonitor JobMonitor = GetJobMonitor();
WORD JobError = GetJobErrorState();
BOOL JobLock = CheckJobLock();
BYTE Status[8] = { STX_CHAR, 0x40, 0x40, 0x40, 0x40, ETX_CHAR, CR_CHAR, LF_CHAR };
/*
* Response Status Byte #1 (message)
*
* Bit 7 - Always 0
* Bit 6 - Always 1
* Bit 5 - Paused
* Bit 4.3.2.1.0
* (B) 0 0 0 1 0 - Retract From Presented Distance
* (C) 0 0 0 1 1 - Cutting
* (E) 0 0 1 0 1 - Printer Error
* (F) 0 0 1 1 0 - Form Feed
* (K) 0 1 0 1 1 - Waiting to Press Print Key
* (L) 0 1 1 0 0 - Waiting to Take Label
* (P) 1 0 0 0 0 - Printing Batch
* (W) 1 0 1 1 1 - Imaging
*/
if (JobLock)
Status[1] |= 0x20;
if (JobMonitor == MONITOR_RETRACT) //回退
Status[1] |= 0x02; /*(B)*/
if (JobMonitor == MONITOR_CUTTING)
Status[1] |= 0x03; /*(C)*/
if (JobMonitor == MONITOR_ERROR)
Status[1] |= 0x05; /*(E)*/
if (JobMonitor == MONITOR_FORM_FEED)
Status[1] |= 0x06; /*(F)*/
if (JobMonitor == MONITOR_PRESS_KEY)
Status[1] |= 0x0B; /*(K)*/
if (JobMonitor == MONITOR_TAKE_LABEL)
Status[1] |= 0x0C; /*(L)*/
if (JobMonitor == MONITOR_PRINTING)
Status[1] |= 0x10; /*(P)*/
if (JobMonitor == MONITOR_IMAGING)
Status[1] |= 0x17; /*(W)*/
/*
* Response Status Byte #2 (warning)
*
* Bit 7 - Always 0
* Bit 6 - Always 1
* Bit 5 - Bad Dots (verifier detected a failure)
* Bit 4 - (reserved)
* Bit 3 - Receive Buffer Full
* Bit 2 - Low Battery
* Bit 1 - Ribbon Low
* Bit 0 - Paper Low
*/
if (UartRxBufferFull())
Status[2] |= 0x08;
/*
* Response Status Byte #3 (error)
*
* Bit 7 - Always 0
* Bit 6 - Always 1
* Bit 5 - (reserved)
* Bit 4 - Insufficient Memory
* Bit 3 - Cutter Jammed
* Bit 2 - (reserved)
* Bit 1 - Step Motor Overheat
* Bit 0 - Print Head Overheat
*/
if (IsMemoryFailed())
Status[3] |= 0x10;
if (JobError & ERROR_CUTTER)
Status[3] |= 0x08;
if (JobError & ERROR_MOTOR_OVERHEAT)
Status[3] |= 0x02;
if (JobError & ERROR_TPH_OVERHEAT)
Status[3] |= 0x01;
/*
* Response Status Byte #4 (error)
*
* Bit 7 - Always 0
* Bit 6 - Always 1
* Bit 5 - Print Head Open
* Bit 4 - (reserved)
* Bit 3 - Ribbon Jam
* Bit 2 - Ribbon Empty
* Bit 1 - Paper Jam
* Bit 0 - Paper Empty
*/
#if defined(CARRIAGE_OPEN_MODEL)
if (IsCarriageOpen() && pPrintCfg->CarriageOpen)
Status[4] |= 0x20;
#endif
if (JobError & ERROR_RIBBON_JAM)
Status[4] |= 0x08;
if (JobError & ERROR_RIBBON_EMPTY)
Status[4] |= 0x04;
if (JobError & ERROR_PAPER_JAM)
Status[4] |= 0x02;
if (JobError & ERROR_PAPER_EMPTY)
Status[4] |= 0x01;
CommWrite(Port, Status, sizeof(Status), 0);
}
/******************************************************************************
Bit 7 - The Sensor has Detected Ribbon
Bit 6 - The Encoder has Detected Ribbon
Bit 5 - (reserved)
Bit 4 - (reserved)
Bit 3 - (reserved)
Bit 2 - Ribbon Empty (Sensor detect)
Bit 1 - Ribbon Fracture (Encoder)
Bit 0 - Ribbon Hold (Encoder)
******************************************************************************/
VOID IMM_InquiryRibbonStatus(INT Port)
{
WORD JobError = GetJobErrorState();
BYTE Status = 0;
#if defined(RIBBON_MODEL)
if (GetRibbonCheck(CHECK_RIBBON_COLORLESS))
Status |= 0x80;
if (GetRibbonCheck(CHECK_RIBBON_ENCODER))
Status |= 0x40;
if (JobError & ERROR_RIBBON_EMPTY)
Status |= 0x04;
if (JobError & ERROR_RIBBON_JAM)
Status |= 0x03;
#endif
CommWrite(Port, &Status, sizeof(BYTE), 0);
}
VOID IMM_Reset(INT Port)
{
PrinterReboot();
}
/* for KP200 Plus */
VOID IMM_QuitAuto(INT Port)
{
_PrintCfg *pImmedCfg = GrabPrintConfig();
if (sBasicData.UseHandle)
{
pImmedCfg->IgnoreAutoRun = TRUE;
PrinterReboot();
}
}
VOID IMM_CancelAuto(INT Port)
{
_PrintCfg *pImmedCfg = GrabPrintConfig();
pImmedCfg->IgnoreAutoRun = TRUE;
PrinterReboot();
}
VOID IMM_CloseImmed(INT Port)
{
CtrlImmedCmd(FALSE);
}
BscImmed.h
#ifndef BSCIMMED_H
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSCIMMED_H
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
/******************************************************************************
* *
* G L O B A L D E F I N E S *
* *
******************************************************************************/
/******************************************************************************
* *
* S T R U C T U R E D E F I N I T I O N S *
* *
******************************************************************************/
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - N O I N I T I A L I Z E R S *
* *
******************************************************************************/
#ifdef BSCIMMED_C
#define EXTERN
#else
#define EXTERN extern
#endif
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - I N I T I A L I Z E R S *
* *
******************************************************************************/
/******************************************************************************
* *
* F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
VOID InitialImmCmd(VOID);
BOOL CtrlImmedCmd(BOOL);
INT CheckImmedCmd(CHAR, CHAR *, INT);
#undef EXTERN
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif
BscReport.c ///
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSCREPORT_C
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include "Common.h"
#include "XCore.h"
#include "XKey.h"
#include "XFlash.h"
#include "XProFile.h"
#include "XFileSys.h"
#include "XPrtEng.h"
#include "XDisplay.h"
#include "XCodePage.h"
#include "XFunction.h"
#include "XAppVer.h"
#include "..\Epl2\Epl2Func.h"
#include "..\Tspl\TsplFunc.h"
#include "..\Parser.h"
#include "..\ParserUtil.h"
#include "BscReport.h"
/******************************************************************************
* *
* L O C A L D E F I N E S *
* *
******************************************************************************/
#if defined(TSPL) && defined(TSPL_VER_1)
#define REPORT_LANG LANG_TSPL
#define REPORT_FONT "3"
#define REPORT_LINEH 26
#define REPORT_FONT_WIDTH 16
#elif defined(TSPL) && defined(TSPL_VER_2)
#define REPORT_LANG LANG_TSPL
#if defined(TDP225) || defined(TTP225)
#define REPORT_FONT "1"
#define REPORT_LINEH 18
#define REPORT_FONT_WIDTH 10
#elif defined(TPH_DPI_600)
#define REPORT_FONT "4"
#define REPORT_LINEH 42
#define REPORT_FONT_WIDTH 24
#else
#define REPORT_FONT "1"
#define REPORT_LINEH 18
#define REPORT_FONT_WIDTH 16
#endif
#elif defined(EPL2)
#define REPORT_LANG LANG_EPL
#define REPORT_FONT "3.EFT"
#if defined(TPH_DPI_200)
#define REPORT_LINEH 26
#define REPORT_FONT_WIDTH 14
#elif defined(TPH_DPI_300) || defined(TPH_DPI_600)
#define REPORT_LINEH 40
#define REPORT_FONT_WIDTH 20
#endif
#elif defined(ZPL2)
#define REPORT_LANG LANG_ZPL
#define REPORT_FONT "D.FNT"
#define REPORT_LINEH 26
#define REPORT_FONT_WIDTH 12
#elif defined(DPL)
#define REPORT_LANG LANG_DPL
#define REPORT_FONT "2DMX.BMF"
#if defined(TPH_DPI_200)
#define REPORT_LINEH 26
#define REPORT_FONT_WIDTH 12
#elif defined(TPH_DPI_300) || defined(TPH_DPI_600)
#define REPORT_LINEH 32
#define REPORT_FONT_WIDTH 17
#endif
#endif
#if defined(TDP225) || defined(TTP225) || defined(TTP323)
#define REPORT_WIDTH (INT)(TPH_DPI * 2)
#else
#define REPORT_WIDTH (INT)(TPH_DPI * 3)
#endif
#if defined(LEFT_ALIGN)
#define REPORT_X (INT)(MM_DOT * 2)
#elif defined(CENTER_ALIGN)
#define REPORT_X (INT)(MM_DOT * 8)//((TPH_WIDTH_DOT - REPORT_WIDTH) / 2 + (INT)(MM_DOT * 2))
#endif
#define REPORT_Y 10
#define PATTERN_LEN 80
#define REPORT_LANG_ENG 0
#define REPORT_LANG_PRO 1
#define CODEPAGE_850 10
/******************************************************************************
* *
* L O C A L T Y P E D E F S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L I N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L U N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
STATIC SHORT ReportLang;
STATIC CHAR ReportAdvertise[64];
/******************************************************************************
*
* Function:
*
*
* Description:
*
*
* Input:
* None
*
* Output:
* None.
*
******************************************************************************/
VOID InitialBscReport(VOID)
{
CHAR Buf[128];
ReportLang = REPORT_LANG_ENG;
#if defined(TSPL)
if (GetProfileString("TESTSELF LANGUAGE", Buf))
{
if (strcmp("Portuguese", Buf) == 0)
ReportLang = REPORT_LANG_PRO;
}
#endif
strcpy(ReportAdvertise, "");
if (GetProfileString("TESTSELF ADVERTISEMENT", Buf))
strcpy(ReportAdvertise, Buf);
}
REPORT *VersionReport(REPORT *Report, BOOL Close, _OutputWay OutWay)
{
_PrintCfg Conf = *pPrintCfg; // copy print config
Conf.Direction = 1;
Conf.Mirror = 0;
if (Report == NULL)
Report = OpenReport(OutWay);
WriteReport(Report, "%s Version: %s", ModelName, VerName);
if (Close)
{
CloseReport(Report, &Conf, REPORT_X, REPORT_Y, REPORT_LINEH, REPORT_FONT, REPORT_LANG);
return NULL;
}
return Report;
}
REPORT *ChecksumReport(REPORT *Report, BOOL Close, _OutputWay OutWay)
{
_PrintCfg Conf = *pPrintCfg; // copy print config
Conf.Direction = 1;
Conf.Mirror = 0;
if (Report == NULL)
Report = OpenReport(OutWay);
WriteReport(Report, "CHECKSUM: %08X", CalculateCheckSum());
if (Close)
{
CloseReport(Report, &Conf, REPORT_X, REPORT_Y, REPORT_LINEH, REPORT_FONT, REPORT_LANG);
return NULL;
}
return Report;
}
#if defined(DEFAULT_MCARD_MODEL)
REPORT *MemoryCardReport(REPORT *Report, BOOL Close, _OutputWay OutWay)
{
_PrintCfg Conf = *pPrintCfg; // copy print config
_FlashInfo *info;
ULONG addr;
INT n;
Conf.Direction = 1;
Conf.Mirror = 0;
if (Report == NULL)
Report = OpenReport(OutWay);
addr = MEMORY_CARD_ADDR;
for (n = 1; n <= 4; n++)
{
if ((info = GetFlashInfo(addr)) == _NULL)
WriteReport(Report, "MEMCARD FLASH %d FALSE", n);
else
WriteReport(Report, "MEMCARD FLASH %d OK", n);
addr += info->BankSize;
}
if (Close)
{
CloseReport(Report, &Conf, REPORT_X, REPORT_Y, REPORT_LINEH, REPORT_FONT, REPORT_LANG);
return NULL;
}
return Report;
}
#endif
REPORT *BtConfigReport(REPORT *Report, BOOL Close, _OutputWay OutWay)
{
#if defined(UART2_BT)
_PrintCfg Conf = *pPrintCfg; // copy print config
Conf.Direction = 1;
Conf.Mirror = 0;
if (Report == NULL)
Report = OpenReport(OutWay);
if(Conf.BtSetting.enble)
{
WriteReport(Report, "%s: %s", "BT", "YES");
WriteReport(Report, "%s: %s", "BT NAME", Conf.BtSetting.name);
WriteReport(Report, "%s: %s", "BT PIN", Conf.BtSetting.pin);
WriteReport(Report, "%s: %s", "BT ADDRESS", Conf.BtSetting.mac);
WriteReport(Report, "%s: %s", "BT VERSIONS", Conf.BtSetting.ver);
}
else
{
WriteReport(Report, "%s: %s", "Bluetooth", "NO");
}
if (Close)
{
CloseReport(Report, &Conf, REPORT_X, REPORT_Y, REPORT_LINEH, REPORT_FONT, REPORT_LANG);
return NULL;
}
#endif
return Report;
}
#if defined(NUTNET)
REPORT *IpConfigReport(REPORT *Report, BOOL Close, _OutputWay OutWay)
{
_PrintCfg Conf = *pPrintCfg; // copy print config
Conf.Direction = 1;
Conf.Mirror = 0;
if (Report == NULL)
Report = OpenReport(OutWay);
WriteReport(Report, "%s: %s", "HOST NAME", Conf.confos.hostname);
WriteReport(Report, "%s: %02X-%02X-%02X-%02X-%02X-%02X", "MAC ADDRESS",
Conf.confnet.cdn_mac[0], Conf.confnet.cdn_mac[1],
Conf.confnet.cdn_mac[2], Conf.confnet.cdn_mac[3],
Conf.confnet.cdn_mac[4], Conf.confnet.cdn_mac[5]);
WriteReport(Report, "%s: %s", "DHCP ENABLED", Conf.confnet.cdn_cip_addr ? "NO" : "YES");
WriteReport(Report, "%s: %s", "IP ADDRESS", inet_ntoa(GetNetworkIP(ITEM_IP_ADDRESS)));
WriteReport(Report, "%s: %s", "SUBNET MASK", inet_ntoa(GetNetworkIP(ITEM_SUBNET_MASK)));
WriteReport(Report, "%s: %s", "DEFAULT GATEWAY", inet_ntoa(GetNetworkIP(ITEM_GATEWAY)));
if (Close)
{
CloseReport(Report, &Conf, REPORT_X, REPORT_Y, REPORT_LINEH, REPORT_FONT, REPORT_LANG);
return NULL;
}
return Report;
}
#endif
REPORT *SelfTestReport(REPORT *Report, BOOL Close, _OutputWay OutWay)
{
CONST STATIC CHAR *Baud[] = { "0","1200","2400","4800","9600","19200","38400","57600","115200" };
CONST STATIC CHAR *Parity[] = { "N","O","E" };
CONST STATIC CHAR *DataBits[] = { "7","8" };
CONST STATIC CHAR *Stop[] = { "1","2" };
CONST STATIC CHAR *PrintInfoName[] = {"PRINTER INFO.", "INFORMA" "\x80\xe5" "ES DA IMPRESSORA" };
// CONST STATIC CHAR *PrintInfoName[] = {"»úÆ÷ÅäÖãº", "INFORMA" "\x80\xe5" "ES DA IMPRESSORA" };
CONST STATIC CHAR *VersionName[] = {"Version", "VERS" "\xc7" "O" };
CONST STATIC CHAR *SerialNoName[] = {"SERIAL NO.", "SERIAL NO." };
CONST STATIC CHAR *MileageName[] = {"MILAGE(m)", "MILHAGEM (m)" };
CONST STATIC CHAR *CheckSumName[] = {"CHECKSUM", "SOMA DE LEITURA" };
CONST STATIC CHAR *SerialPortName[] = {"SERIAL PORT", "PORTA SERIAL" };
CONST STATIC CHAR *CodePageName[] = {"CODE PAGE", "C" "\xe0" "DIGO DE P" "\xb5" "GINA" };
CONST STATIC CHAR *CountryCodeName[] = {"COUNTRY CODE", "C" "\xe0" "DIGO DO PA" "\xd6" "S" };
CONST STATIC CHAR *SpeedName[] = {"SPEED", "VELOCIDADE" };
CONST STATIC CHAR *InchName[] = {"INCH", "POLEGADAS" };
CONST STATIC CHAR *DensityName[] = {"DENSITY", "TEMPERATURA" };
CONST STATIC CHAR *SizeName[] = {"SIZE", "TAMANHO" };
#if defined(GRAPHIC_PRODUCT)
CONST STATIC CHAR *BlineName[] = {"BLACK MARK", "sensor de marca negra" };
#else
CONST STATIC CHAR *BlineName[] = {"BLINE", "sensor de marca negra" };
#endif
CONST STATIC CHAR *GapName[] = {"GAP", "ESPA" "\x80" "AMENTO" };
CONST STATIC CHAR *TransparenceName[] = {"TRANSPARENCE", "TRANSPAR" "\xd2" "NCIA" };
_PrintCfg Conf = *pPrintCfg; // copy print config
BYTE CodePage = CODEPAGE_850;
Conf.Direction = 1;
Conf.Mirror = 0;
#if defined(TSPL)
SetCodePageCross(LANG_TSPL, &CodePage, TsplRemapChar);
#elif defined(EPL2)
SetCodePageCross(LANG_EPL, &CodePage, EplRemapChar);
#endif
if (Report == NULL)
Report = OpenReport(OutWay);
WriteReport(Report, "%s", PrintInfoName[ReportLang]);
// ch_20220428
// PatternReport(Report, PATTERN_LEN); // ch_20220427 : correct the wrong position of Self-Testing.
WriteReport(Report, "%s %s: %s %s", ModelName, VersionName[ReportLang], VerName, ExtModelName);
if (strlen(ReportAdvertise))
WriteReport(Report, "%s", ReportAdvertise);
#ifndef GRAPHIC_PRODUCT
WriteReport(Report, "%s: %s", SerialNoName[ReportLang], pPrintRec->SerialNumberName);
WriteReport(Report, "%s: %d", MileageName[ReportLang], pPrintRec->DotMilage / (INT)(MM_DOT * 1000));
#endif
WriteReport(Report, "%s: %08X %s", CheckSumName[ReportLang], CalculateCheckSum(), IsProfileReady() ? "XPF" : "");
WriteReport(Report, "%s: %s,%s,%s,%s",
SerialPortName[ReportLang],
Baud[Conf.UartSetting.Baud],
Parity[Conf.UartSetting.Parity],
DataBits[Conf.UartSetting.DataBits],
Stop[Conf.UartSetting.Stop] );
WriteReport(Report, "%s: %s", CodePageName[ReportLang], CodePageNameTable[Conf.CodePage]);
WriteReport(Report, "%s: %s", CountryCodeName[ReportLang], CountryNameTable[Conf.Country]);
WriteReport(Report, "%s: %s %s", SpeedName[ReportLang], ToSpeedString(Conf.Speed), InchName[ReportLang]);
WriteReport(Report, "%s: %.1f", DensityName[ReportLang], Conf.fDensity);
// ch_20220428
// WriteReport(Report, "%s: %.2f , %.2f",SizeName[ReportLang], (FLOAT)Conf.PaperWidth / TPH_DPI, Conf.fPaperSize / TPH_DPI);
// ch_20220428
// if (Conf.SensorMode == GAP_MODE)
// WriteReport(Report, "%s: %.2f , %.2f", GapName[ReportLang], Conf.fGapSize / TPH_DPI, Conf.fGapOffset / TPH_DPI);
// else if (Conf.SensorMode == BLINE_MODE)
// WriteReport(Report, "%s: %.2f , %.2f", BlineName[ReportLang], Conf.fBlineSize / TPH_DPI, Conf.fBlineOffset / TPH_DPI);
// else if (Conf.SensorMode == CONTINUE_MODE_R)
// WriteReport(Report, "%s: %.2f , %.2f", BlineName[ReportLang], (FLOAT)0, (FLOAT)0);
// else
// WriteReport(Report, "%s: %.2f , %.2f", GapName[ReportLang], (FLOAT)0, (FLOAT)0);
if (Conf.SensorMode == GAP_MODE)
WriteReport(Report, "%s: %d ", TransparenceName[ReportLang], Conf.GapInten);
#if defined(TTP243_PCB) || defined(TDP643_PCB) || defined(TTP244M_PCB) || defined(TTP243PP_PCB)
else if (Conf.SensorMode == BLINE_MODE)
WriteReport(Report, "%s: %d ", TransparenceName[ReportLang], Conf.GapInten);
#else
else if (Conf.SensorMode == BLINE_MODE)
WriteReport(Report, "%s: %d ", TransparenceName[ReportLang], Conf.BlineInten);
#endif
else
WriteReport(Report, "%s: %d ", TransparenceName[ReportLang], Conf.ContinuousInten);
if (Close)
{
CloseReport(Report, &Conf, REPORT_X, REPORT_Y, REPORT_LINEH, REPORT_FONT, REPORT_LANG);
Report = NULL;
}
#if defined(TSPL)
SetCodePageCross(LANG_TSPL, &pPrintCfg->CodePage, TsplRemapChar);
#elif defined(EPL2)
SetCodePageCross(LANG_EPL, &pPrintCfg->EplCodePage, EplRemapChar);
#endif
return Report;
}
REPORT *FileReport(REPORT *Report, BOOL Close, _OutputWay OutWay)
{
CONST STATIC CHAR *FileListName[] = {"FILE LIST", "LISTA DE ARQUIVOS" };
CONST STATIC CHAR *DramFileName[] = {"DRAM FILE:", "ARQUIVO(S) NA DRAM:" };
CONST STATIC CHAR *FlashFileName[] = {"FLASH FILE:", "ARQUIVO(S) NA FLASH:" };
CONST STATIC CHAR *ExtFlashFileName[] = {"EXT.FLASH FILE:", "ARQUIVO(S) NA EXT.FLASH:" };
CONST STATIC CHAR *CardFileName[] = {"CARD FILE:", "ARQUIVO(S) NA EXT.FLASH:" };
CONST STATIC CHAR *FileEndName[] = {"FILE(S)", "ARQUIVO (S)" };
CONST STATIC CHAR *TotalDramName[] = {"PHYSICAL DRAM:", "DRAM TOTAL:" };
CONST STATIC CHAR *AvailDramName[] = {"AVAILABLE DRAM:", "DRAM DISPON" "\xd6" "VEL:" };
CONST STATIC CHAR *TotalFlashName[] = {"PHYSICAL FLASH:", "FLASH TOTAL:" };
CONST STATIC CHAR *AvailFlashName[] = {"AVAILABLE FLASH:", "FLASH DISPON" "\xd6" "VEL:" };
CONST STATIC CHAR *TotalExtFlashName[] = {"PHYSICAL EXT.FLASH:", "EXT.FLASH TOTAL:" };
CONST STATIC CHAR *AvailExtFlashName[] = {"AVAILABLE EXT.FLASH:", "EXT.FLASH DISPON" "\xd6" "VEL:" };
CONST STATIC CHAR *TotalCardName[] = {"PHYSICAL CARD:", "EXT.FLASH TOTAL:" };
CONST STATIC CHAR *EndFileListName[] = {"END OF FILE LIST", "FIM DA LISTA DE ARQUIVOS" };
_PrintCfg Conf = *pPrintCfg; // copy print config
BYTE CodePage = CODEPAGE_850;
_FileList List;
Conf.Direction = 1;
Conf.Mirror = 0;
#if defined(TSPL)
SetCodePageCross(LANG_TSPL, &CodePage, TsplRemapChar);
#elif defined(EPL2)
SetCodePageCross(LANG_EPL, &CodePage, EplRemapChar);
#endif
if (Report == NULL)
Report = OpenReport(OutWay);
WriteReport(Report, "**************************************");
WriteReport(Report, "%s:", FileListName[ReportLang]);
WriteReport(Report, "%-24s %3d %s", DramFileName[ReportLang], GetFileTotal(DRAM_DEVICE, "*.*"), FileEndName[ReportLang]);
// ch_20220428
// OpenList(&List, DRAM_DEVICE);
// while (NextFile(&List, "*.*"))
// WriteReport(Report, "%-18s %7d BYTES", List.FileName, List.FileSize);
// WriteReport(Report, "");
#if 0
WriteReport(Report, "%-24s %3d %s", FlashFileName[ReportLang], GetFileTotal(FLASH_DEVICE, "*.*"), FileEndName[ReportLang]);
OpenList(&List, FLASH_DEVICE);
while (NextFile(&List, "*.*"))
WriteReport(Report, "%-18s %7d BYTES", List.FileName, List.FileSize);
WriteReport(Report, "");
#endif
#if defined(FLASH_MCARD_MODEL) || defined(SDCARD_MODEL)
if (IsCardDevice())
{
#if defined(FLASH_MCARD_MODEL)
WriteReport(Report, "%-24s %3d %s", ExtFlashFileName[ReportLang], GetFileTotal(CARD_DEVICE, "*.*"), FileEndName[ReportLang]);
#elif defined(SDCARD_MODEL)
WriteReport(Report, "%-24s %3d %s", CardFileName[ReportLang], GetFileTotal(CARD_DEVICE, "*.*"), FileEndName[ReportLang]);
#endif
OpenList(&List, CARD_DEVICE);
while (NextFile(&List, "*.*"))
{
if (List.FileSize > 9999999)
WriteReport(Report, "%-18s %7d KBYTES", List.FileName, (List.FileSize / 1024));
else
WriteReport(Report, "%-18s %7d BYTES", List.FileName, List.FileSize);
}
WriteReport(Report, "");
}
#endif
// ch_20220428
// WriteReport(Report, "%-20s %5d KBYTES", TotalDramName[ReportLang], PhysicalSpace(DRAM_DEVICE));
// WriteReport(Report, "%-20s %5d KBYTES FREE", AvailDramName[ReportLang], FreeSpace(DRAM_DEVICE));
// WriteReport(Report, "%-20s %5d KBYTES", TotalFlashName[ReportLang], PhysicalSpace(FLASH_DEVICE));
// WriteReport(Report, "%-20s %5d KBYTES FREE", AvailFlashName[ReportLang], FreeSpace(FLASH_DEVICE));
#if defined(FLASH_MCARD_MODEL)
if (IsCardDevice())
{
WriteReport(Report, "%-21s %4d KBYTES", TotalExtFlashName[ReportLang], PhysicalSpace(CARD_DEVICE));
WriteReport(Report, "%-21s %4d KBYTES FREE", AvailExtFlashName[ReportLang], FreeSpace(CARD_DEVICE));
}
#elif defined(SDCARD_MODEL)
if (IsCardDevice())
{
INT space = PhysicalSpace(CARD_DEVICE);
if (space > 9999)
WriteReport(Report, "%-21s %4d MBYTES", TotalCardName[ReportLang], (space / 1024));
else
WriteReport(Report, "%-21s %4d KBYTES", TotalCardName[ReportLang], space);
}
#endif
WriteReport(Report, "%s", EndFileListName[ReportLang]);
WriteReport(Report, "**************************************");
if (Close)
{
CloseReport(Report, &Conf, REPORT_X, REPORT_Y, REPORT_LINEH, REPORT_FONT, REPORT_LANG);
Report = NULL;
}
#if defined(TSPL)
SetCodePageCross(LANG_TSPL, &pPrintCfg->CodePage, TsplRemapChar);
#elif defined(EPL2)
SetCodePageCross(LANG_EPL, &pPrintCfg->EplCodePage, EplRemapChar);
#endif
return Report;
}
VOID DumpText(REPORT *Report)
{
CONST STATIC CHAR *DumpModeName[] = {"NOW IN DUMP MODE", "AGORA EM MODO DIAGN" "\xe0" "STICO" };
CONST STATIC CHAR *BlankStr[] = {" ", "", "", ""}; // ch_20220520
CONST STATIC CHAR *SupplierName[] = {"MADE BY PUTY TECH.", "", "", ""}; // ch_20220520
_PrintCfg Conf = *pPrintCfg; // copy print config
BYTE CodePage = CODEPAGE_850;
CHAR TextBuf[TPH_WIDTH_DOT / REPORT_FONT_WIDTH + 1];
INT MaxLen = ((Conf.PaperWidth - 10) / REPORT_FONT_WIDTH - 2) / 8 * 2;
INT Length = 0;
INT X = REPORT_FONT_WIDTH;
INT Y = REPORT_Y;
BYTE Data;
Conf.Direction = 1;
Conf.Mirror = 0;
#if defined(TSPL)
SetCodePageCross(LANG_TSPL, &CodePage, TsplRemapChar);
#elif defined(EPL2)
SetCodePageCross(LANG_EPL, &CodePage, EplRemapChar);
#endif
if (Report == NULL)
Report = OpenReport(OUTPUT_LABEL);
WriteReport(Report, "%s", DumpModeName[ReportLang]);
WriteReport(Report, "%s", BlankStr[0]); // ch_20220520
WriteReport(Report, "%s", SupplierName[0]); // ch_20220520
// ch_20220428
CloseReport(Report, &Conf, REPORT_X, REPORT_Y, REPORT_LINEH, REPORT_FONT, REPORT_LANG);
// CloseReport4SelfTestPrint(Report, &Conf, REPORT_X, REPORT_Y, REPORT_LINEH, REPORT_FONT, REPORT_LANG); // ch_20220210
WaitWorkJobEnd();
Conf.Direction = 0;
#if defined(LEFT_ALIGN)
X += (TPH_WIDTH_DOT - Conf.PaperWidth);
#elif defined(CENTER_ALIGN)
X += (TPH_WIDTH_DOT - Conf.PaperWidth) >> 1;
#endif
memset(TextBuf, 0, sizeof(TextBuf));
memset(TextBuf, ' ', MaxLen + 1);
Length = 0;
#if defined(LCD_MODEL)
SetDisplayStatus(DIS_DUMP_MODE);
#endif
// ch_20211230
// GetKey(FEED_KEY);
// while (!GetKey(FEED_KEY))
// {
// if (!GetByte(&Data))
// continue;
// TextBuf[Length] = Data ? Data : ' ';
// sprintf(TextBuf + MaxLen + 1 + Length * 3, " %02X", Data);
// if (++Length >= MaxLen)
// {
// Y = PrintLine(X, Y, REPORT_Y, REPORT_FONT, REPORT_LINEH, TextBuf, &Conf, REPORT_LANG);
// memset(TextBuf, ' ', MaxLen + 1);
// Length = 0;
// }
// }
if (Length)
Y = PrintLine(X, Y, REPORT_Y, REPORT_FONT, REPORT_LINEH, TextBuf, &Conf, REPORT_LANG);
if (Y > REPORT_Y)
Y = CheckPrint((INT)Conf.fPaperSize, REPORT_Y, REPORT_LINEH, &Conf);
#if defined(LCD_MODEL)
ClrDisplayStatus(DIS_DUMP_MODE);
#endif
#if defined(TSPL)
SetCodePageCross(LANG_TSPL, &pPrintCfg->CodePage, TsplRemapChar);
#elif defined(EPL2)
SetCodePageCross(LANG_EPL, &pPrintCfg->EplCodePage, EplRemapChar);
#endif
}
VOID ConfigReport(VOID)
{
CONST STATIC CHAR *Baud[] = { "0","1200","2400","4800","9600","19200","38400","57600","115200" };
CONST STATIC CHAR *Parity[] = { "N","O","E" };
CONST STATIC CHAR *DataBits[] = { "7","8" };
CONST STATIC CHAR *Stop[] = { "1","2" };
CONST STATIC CHAR *Sensor[] = { "GAP","BLACK MARK","CONTINUOUS(T)","CONTINUOUS(R)","CONTINUOUS(F)" };
CONST STATIC CHAR *MotDir[] = { "FORWARD","BACKWARD","NULL" };
CONST STATIC CHAR *PrtOut[] = { "OFF","TEAR","PEEL","CUTTER" };
CONST STATIC CHAR *Debug[] = { "LABEL","RS232","OFF" };
CONST STATIC CHAR *Whether[] = { "OFF","ON" };
SendString("\r\n");
SendPrintf("%s Version: %s %s\r\n", ModelName, VerName, ExtModelName);
SendPrintf("Soruce Rev: %s\r\n", SrcRevName);
SendPrintf("Checksum: %08X %s\r\n", CalculateCheckSum(), IsProfileReady() ? "TCF" : "");
SendPrintf("Label Milage: %d\r\n", pPrintRec->LabelMilage);
SendPrintf("Dot Milage: %d\r\n", pPrintRec->DotMilage);
SendPrintf("Cut Counter: %d\r\n", pPrintRec->CutCounter);
#if defined(NUTOS)
SendPrintf("Host Name: %s\r\n", pPrintCfg->confos.hostname);
#endif
#if defined(NUTNET)
SendPrintf("Ethernet: %s\r\n", GetThreadByName("ethernet") ? "YES" : "NO");
SendPrintf("MAC Address: %02X-%02X-%02X-%02X-%02X-%02X\r\n",
pPrintCfg->confnet.cdn_mac[0],
pPrintCfg->confnet.cdn_mac[1],
pPrintCfg->confnet.cdn_mac[2],
pPrintCfg->confnet.cdn_mac[3],
pPrintCfg->confnet.cdn_mac[4],
pPrintCfg->confnet.cdn_mac[5] );
SendPrintf("Last Used IP: %s\r\n", inet_ntoa(pPrintCfg->confnet.cdn_ip_addr));
SendPrintf("Subnet Mask: %s\r\n", inet_ntoa(pPrintCfg->confnet.cdn_ip_mask));
SendPrintf("Default Gateway: %s\r\n", inet_ntoa(pPrintCfg->confnet.cdn_gateway));
SendPrintf("Configured IP: %s\r\n", inet_ntoa(pPrintCfg->confnet.cdn_cip_addr));
SendPrintf("Primary DNS Address: %s\r\n", inet_ntoa(pPrintCfg->confnet.cdn_pdns));
SendPrintf("Secondary DNS Address: %s\r\n", inet_ntoa(pPrintCfg->confnet.cdn_sdns));
SendPrintf("E-mail Notification: %s\r\n", Whether[pPrintCfg->confsmtp.notify != 0]);
SendPrintf("SMTP Authentication: %s\r\n", Whether[pPrintCfg->confsmtp.auth != 0]);
SendPrintf("SMTP Server Address: %s\r\n", pPrintCfg->confsmtp.server);
SendPrintf("E-mail Account Name: %s\r\n", pPrintCfg->confsmtp.username);
SendPrintf("E-mail Account Password: %s\r\n", pPrintCfg->confsmtp.password);
SendPrintf("Sender E-mail Address: %s\r\n", pPrintCfg->confsmtp.sender);
SendPrintf("Receiver E-mail Address: %s\r\n", pPrintCfg->confsmtp.receiver);
#endif
#if defined(UART2_BT)
SendPrintf("Bluetooth : %s\r\n", pPrintCfg->BtSetting.enble? "YES" : "NO");
SendPrintf("Bluetooth Name: %s\r\n", pPrintCfg->BtSetting.name);
SendPrintf("Bluetooth Pin: %s\r\n", pPrintCfg->BtSetting.pin);
SendPrintf("Bluetooth Address: %s\r\n",pPrintCfg->BtSetting.mac);
SendPrintf("Bluetooth Versions: %s\r\n", pPrintCfg->BtSetting.ver);
#endif
SendPrintf("GPI Setting: ...\r\n");
SendPrintf("GPO Setting: ...\r\n");
SendPrintf("Key Setting: ...\r\n");
SendPrintf("Serial Port: %s,%s,%s,%s\r\n",
Baud[pPrintCfg->UartSetting.Baud],
Parity[pPrintCfg->UartSetting.Parity],
DataBits[pPrintCfg->UartSetting.DataBits],
Stop[pPrintCfg->UartSetting.Stop] );
SendPrintf("Sensor Mode: %s\r\n", Sensor[pPrintCfg->SensorMode]);
SendPrintf("Motor Direction: %s\r\n", MotDir[pPrintCfg->MotorDir]);
SendPrintf("Print Out: %s\r\n", PrtOut[pPrintCfg->PrintOutMode]);
SendPrintf("Debug Mode: %s\r\n", Debug[pPrintCfg->DebugMode]);
SendPrintf("Density: %.1f\r\n", pPrintCfg->fDensity);
SendPrintf("Paper Size: %.1f\r\n", pPrintCfg->fPaperSize);
SendPrintf("Gap Size: %.1f\r\n", pPrintCfg->fGapSize);
SendPrintf("Gap Offset: %.1f\r\n", pPrintCfg->fGapOffset);
SendPrintf("Black Mark Size: %.1f\r\n", pPrintCfg->fBlineSize);
SendPrintf("Black Mark Offset: %.1f\r\n", pPrintCfg->fBlineOffset);
SendPrintf("Direction: %d\r\n", pPrintCfg->Direction);
SendPrintf("Mirror: %s\r\n", Whether[pPrintCfg->Mirror]);
SendPrintf("Carriage Open: %s\r\n", Whether[pPrintCfg->CarriageOpen]);
SendPrintf("Test Burn: %s\r\n", Whether[pPrintCfg->TestBurn]);
SendPrintf("Tear Mode: %s\r\n", Whether[pPrintCfg->TearMode]);
SendPrintf("Reverse the gap sensor signal: %s\r\n", Whether[pPrintCfg->GapReverse]);
SendPrintf("Automatic sensor reference: %s\r\n", Whether[pPrintCfg->AutoSensorRef]);
SendPrintf("Measure Before Printing: %s\r\n", Whether[pPrintCfg->Measure]);
SendPrintf("Calibrate Before Printing: %s\r\n", Whether[pPrintCfg->Calibrate]);
SendPrintf("Ribbon Flag: %s\r\n", Whether[pPrintCfg->RibbonFlag]);
SendPrintf("Ribbon Encoder: %s\r\n", Whether[pPrintCfg->RibbonEncoder]);
SendPrintf("Ignore Auto Run: %s\r\n", Whether[pPrintCfg->IgnoreAutoRun]);
SendPrintf("Reprint: %s\r\n", Whether[pPrintCfg->Reprint]);
SendPrintf("Print Key: %s\r\n", Whether[pPrintCfg->PrintKey]);
SendPrintf("Reprint Key: %s\r\n", Whether[pPrintCfg->ReprintKey]);
SendPrintf("Cutter Back: %s\r\n", Whether[pPrintCfg->CutterBack]);
SendPrintf("Suppress Back: %s\r\n", Whether[pPrintCfg->SuppressBack]);
SendPrintf("Firmware Checksum: %08X\r\n", pPrintCfg->Checksum);
SendPrintf("Profile Checksum: %08X\r\n", pPrintCfg->ProfileChecksum);
SendPrintf("Cutter Pieces: %d\r\n", pPrintCfg->CutterPieces);
SendPrintf("Print Key Counter: %d\r\n", pPrintCfg->PrintKeyCnt);
SendPrintf("Reprint Key Counter: %d\r\n", pPrintCfg->ReprintKeyCnt);
SendPrintf("Gap Reference: %d\r\n", pPrintCfg->GapRef);
SendPrintf("Black Mark Reference: %d\r\n", pPrintCfg->BlineRef);
SendPrintf("Continuous Reference: %d\r\n", pPrintCfg->ContinuousRef);
SendPrintf("Ribbon Reference: %d\r\n", pPrintCfg->RibbonRef);
SendPrintf("Continue Paper Feed: %d\r\n", pPrintCfg->ContinuePaperFeed);
SendPrintf("Paper Width: %d\r\n", pPrintCfg->PaperWidth);
SendPrintf("Over Heat: %d\r\n", pPrintCfg->OverHeat);
SendPrintf("Print Heat: %d\r\n", pPrintCfg->PrintHeat);
SendPrintf("Motor Over Heat: %d\r\n", pPrintCfg->MotorOverHeat);
SendPrintf("Motor Move Heat: %d\r\n", pPrintCfg->MotorMoveHeat);
SendPrintf("Over Head: %d\r\n", pPrintCfg->OverHead);
SendPrintf("Limit Feed: %d\r\n", pPrintCfg->LimitFeed);
SendPrintf("Wait Job Time: %d\r\n", pPrintCfg->WaitJobTime);
SendPrintf("Feed Length: %d\r\n", pPrintCfg->FeedLength);
SendPrintf("Network Raw Data Port: %d\r\n", pPrintCfg->NetRawPort);
SendPrintf("Adjust Head: %d\r\n", pPrintCfg->AdjustHead);
SendPrintf("Offset: %d\r\n", pPrintCfg->OffsetDis);
SendPrintf("Reference X: %d\r\n", pPrintCfg->ReferenceX);
SendPrintf("Reference Y: %d\r\n", pPrintCfg->ReferenceY);
SendPrintf("Shift X: %d\r\n", pPrintCfg->ShiftDisX);
SendPrintf("Shift Y: %d\r\n", pPrintCfg->ShiftDisY);
SendPrintf("Speed: %s Inch\r\n", ToSpeedString(pPrintCfg->Speed));
SendPrintf("Language: %d\r\n", pPrintCfg->Language);
SendPrintf("Country Code: %s\r\n", CountryNameTable[pPrintCfg->Country]);
SendPrintf("Code Page: %s\r\n", CodePageNameTable[pPrintCfg->CodePage]);
SendPrintf("Gap Intension: %d\r\n", pPrintCfg->GapInten);
SendPrintf("Black Mark Intension: %d\r\n", pPrintCfg->BlineInten);
SendPrintf("Continuous Intension: %d\r\n", pPrintCfg->ContinuousInten);
SendPrintf("Ribbon Intension: %d\r\n", pPrintCfg->RibbonInten);
SendPrintf("LED Select: %02X\r\n", pPrintCfg->LedSelect);
SendPrintf("Auto Run: %s\r\n", pPrintCfg->AutoRun);
SendPrintf("Input Prefix 1: %s 2: %s 3: %s 4: %s\r\n",
pPrintCfg->InputPrefix[0],
pPrintCfg->InputPrefix[1],
pPrintCfg->InputPrefix[2],
pPrintCfg->InputPrefix[3]);
SendPrintf("Input Suffix 1: %s 2: %s 3: %s 4: %s\r\n",
pPrintCfg->InputSuffix[0],
pPrintCfg->InputSuffix[1],
pPrintCfg->InputSuffix[2],
pPrintCfg->InputSuffix[3]);
}
VOID ProfileReport(VOID)
{
SendString("PROFILE LIST\r\n");
ProfileList();
}
BscReport.h /
#ifndef BSCREPORT_H
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSCREPORT_H
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
/******************************************************************************
* *
* G L O B A L D E F I N E S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* S T R U C T U R E D E F I N I T I O N S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - N O I N I T I A L I Z E R S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - I N I T I A L I Z E R S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
VOID InitialBscReport(VOID);
REPORT *VersionReport(REPORT *, BOOL, _OutputWay);
REPORT *ChecksumReport(REPORT *, BOOL, _OutputWay);
REPORT *MemoryCardReport(REPORT *, BOOL, _OutputWay);
REPORT *IpConfigReport(REPORT *, BOOL, _OutputWay);
REPORT *BtConfigReport(REPORT *, BOOL, _OutputWay);
REPORT *SelfTestReport(REPORT *, BOOL, _OutputWay);
REPORT *FileReport(REPORT *, BOOL, _OutputWay);
VOID DumpText(REPORT *);
VOID ConfigReport(VOID);
VOID ProfileReport(VOID);
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif
BscUtil.c /
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSCUTIL_C
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include <stdlib.h>
#include <string.h>
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include "Common.h"
#include "XCore.h"
#include "BscUtil.h"
/******************************************************************************
* *
* L O C A L D E F I N E S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L T Y P E D E F S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L I N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
/******************************************************************************
* *
* L O C A L U N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
/******************************************************************************
*
* Function:
*
*
* Description:
*
*
* Input:
* None
*
* Output:
* None.
*
******************************************************************************/
BOOL BscGetToken(_eTokenEndMode Mode, CHAR *pToken, INT Limit)
{
CHAR EndChar;
INT Len;
RemoveSpace();
Len = 0;
while (Len < Limit - 1)
{
Len += GetToken(pToken + Len, &EndChar, " \t\r\n\x0c\x1a,;", Limit - Len);
if (CheckChar(EndChar, " \t") && (Mode == SPACE_END || Mode == BACK_WITH_SPACE))
break;
else if (CheckChar(EndChar, "\r\n\x0c\x1a,;"))
break;
}
if (Len == 0)
{
BackByte(EndChar);
return FALSE;
}
else if (!CheckTokenEnd(Mode, EndChar))
return FALSE;
// remove last space
while (CheckChar(*(pToken + Len - 1), " \t") && Len)
*(pToken + (--Len)) = '\0';
return TRUE;
}
BOOL BscGetSize(_eTokenEndMode Mode, INT *pInteger)
{
CHAR Token[STRING_LEN];
INT TokLen;
FLOAT Unit;
if (!BscGetToken(Mode, Token, sizeof(Token)))
return FALSE;
TokLen = strlen(Token);
while (TokLen && CheckChar(Token[TokLen - 1], " \t"))
TokLen -= 1;
Unit = TPH_DPI;
if (TokLen > 2 && memcmp(&Token[TokLen - 2], "mm", 2) == 0)
Unit = MM_DOT;
else if (TokLen > 3 && memcmp(&Token[TokLen - 3], "dot", 3) == 0)
Unit = (FLOAT)1;
*pInteger = atoi(Token) * Unit;
return TRUE;
}
BOOL BscGetNumber(_eTokenEndMode Mode, INT *pInteger)
{
CHAR Token[INTEGER_MAX_LEN];
if (!BscGetToken(Mode, Token, sizeof(Token)))
return FALSE;
*pInteger = atoi(Token);
return TRUE;
}
BOOL BscGetString(_eTokenEndMode Mode, CHAR *pString, INT Limit)
{
CHAR EndChar;
INT Len;
RemoveSpace();
Len = 0;
while (Len < Limit - 1)
{
GetToken(pString + Len, &EndChar, " \t\"\r\n\x0c\x1a,;", Limit - Len);
if (EndChar == '"')
{
while (Len < Limit - 1)
{
Len += GetToken(pString + Len, &EndChar, "\"\r\n", Limit - Len);
if (EndChar == '"')
{
if (Mode == STRING_END)
return TRUE;
break;
}
else
{
BackByte(EndChar);
return FALSE;
}
}
}
else if (CheckChar(EndChar, " \t") && (Mode == SPACE_END || Mode == BACK_WITH_SPACE))
break;
else if (CheckChar(EndChar, "\r\n\x0c\x1a,;"))
break;
}
// can be an empty string
// if (Len == 0)
// {
// BackByte(EndChar);
// return FALSE;
// }
if (!CheckTokenEnd(Mode, EndChar))
return FALSE;
return TRUE;
}
BOOL BscGetFileDevice(_eFileDevice *device)
{
CHAR data;
RemoveSpace();
data = NextByte();
if (data == 'F')
{
*device = FLASH_DEVICE;
RemoveSpace();
data = NextByte();
if (!CheckTokenEnd(COMMA_END, data))
return FALSE;
}
else if (data == 'E')
{
*device = CARD_DEVICE;
RemoveSpace();
data = NextByte();
if (!CheckTokenEnd(COMMA_END, data))
return FALSE;
}
else
{
*device = DRAM_DEVICE;
BackByte(data);
}
return TRUE;
}
BscUtil.h ///
#ifndef BSCUTIL_H
/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define BSCUTIL_H
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include "..\ParserUtil.h"
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
/******************************************************************************
* *
* G L O B A L D E F I N E S *
* *
******************************************************************************/
/******************************************************************************
* *
* S T R U C T U R E D E F I N I T I O N S *
* *
******************************************************************************/
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - N O I N I T I A L I Z E R S *
* *
******************************************************************************/
#ifdef BSCUTIL_C
#define EXTERN
#else
#define EXTERN extern
#endif
/******************************************************************************
* *
* G L O B A L V A R I A B L E S - I N I T I A L I Z E R S *
* *
******************************************************************************/
/******************************************************************************
* *
* F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
BOOL BscGetToken(_eTokenEndMode, CHAR *, INT);
BOOL BscGetSize(_eTokenEndMode, INT *);
BOOL BscGetNumber(_eTokenEndMode, INT *);
BOOL BscGetString(_eTokenEndMode, CHAR *, INT);
BOOL BscGetFileDevice(_eFileDevice *);
#undef EXTERN
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif