3822 lines
83 KiB
C
3822 lines
83 KiB
C
/**
|
||
******************************************************************************
|
||
* @file cmdhandle.c
|
||
* @author TMC Scan Team
|
||
* @version V1.0.0
|
||
* @date 09/07/2019
|
||
* @brief
|
||
******************************************************************************
|
||
*
|
||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||
* TIME. AS A RESULT, TMC SHALL NOT BE HELD LIABLE FOR ANY
|
||
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||
*
|
||
* <h2><center>© COPYRIGHT 2016 TMC</center></h2>
|
||
******************************************************************************
|
||
**/
|
||
|
||
#include <stdlib.h>
|
||
#include "global.h"
|
||
|
||
uint8_t g_SysModal = SYSMODE_CLOSE;
|
||
uint16_t gBufLen = 0x00;
|
||
|
||
|
||
uint8_t respSuccess[2] = {'O', 'K'};
|
||
uint8_t respError[3] = {'E', 'R','R'};
|
||
|
||
extern uint8_t gPackType;
|
||
extern uint32_t gFunTrace;
|
||
extern uint8_t gReceiveKey;
|
||
|
||
extern void AppScanCodeInit(void);
|
||
|
||
/**
|
||
* @function SetPackType
|
||
* @brief set comunication pack type
|
||
* @param[in] type
|
||
* @return ÎÞ
|
||
*/
|
||
void SetPackType(uint8_t type)
|
||
{
|
||
gPackType = type;
|
||
}
|
||
|
||
/**
|
||
* @function SetSysPackType
|
||
* @brief set comunication pack type as sys pack type
|
||
* @return ÎÞ
|
||
*/
|
||
void SetSysPackType(void)
|
||
{
|
||
gPackType = SYS_PACK_TYPE;
|
||
}
|
||
|
||
|
||
/**
|
||
* @function my_itoa
|
||
* @brief transfer an integer into string
|
||
* @param[in] n
|
||
* @param[out] buf
|
||
* @return length of string
|
||
*/
|
||
int my_itoa(long long n, char *buf)
|
||
{
|
||
int i, sign = 0, bits = 0;
|
||
|
||
if(n < 0)
|
||
{
|
||
buf[0] = '-';
|
||
n = -n;
|
||
buf = buf + 1;
|
||
sign = 1;
|
||
}
|
||
|
||
for(i = 19; i >= 0; i--)
|
||
{
|
||
buf[i] = (n % 10) + '0';
|
||
bits++;
|
||
n = n / 10;
|
||
|
||
if(n == 0)
|
||
{
|
||
break;
|
||
}
|
||
}
|
||
|
||
for(i = 0; i < bits; i++)
|
||
{
|
||
buf[i] = buf[20 - bits + i];
|
||
}
|
||
|
||
buf[bits] = 0;
|
||
return bits + sign;
|
||
}
|
||
|
||
//·µ»Ø×Ö·û´®³¤¶È
|
||
int my_strappend(char *dst, const char *src)
|
||
{
|
||
int i;
|
||
|
||
for(i = 0; src[i] != 0; i++)
|
||
{
|
||
dst[i] = src[i];
|
||
}
|
||
|
||
dst[i] = 0;
|
||
return i;
|
||
}
|
||
|
||
|
||
void print_int(const char *prv, int32_t x, const char *suf)
|
||
{
|
||
char msg[256];
|
||
char *str;
|
||
int n, off = 0;
|
||
str = msg;
|
||
n = my_strappend(str, prv);
|
||
str += n;
|
||
off += n;
|
||
n = my_itoa(x, str);
|
||
str += n;
|
||
off += n;
|
||
n = my_strappend(str, suf);
|
||
str += n;
|
||
off += n;
|
||
SetOutputData((uint8_t *)msg, off);
|
||
}
|
||
|
||
/**
|
||
* @function StringToHex
|
||
* @brief ½«16½øÖƵÄ×Ö·û´®×ª»»³É16½øÖÆÊý£¬²»Çø·Ö´óСд
|
||
* @param[in] pSrc Ô´Êý¾Ý
|
||
* @param[in] pDst ´æ·Å½á¹ûÊý¾Ý
|
||
* @param[in] pLen ³¤¶È
|
||
* @return ת»»ºÃ½á¹ûµÄ³¤¶È
|
||
*/
|
||
int StringToHex(uint8_t *pSrc, uint8_t *pDst, uint16_t pLen)
|
||
{
|
||
uint8_t *s = pSrc;
|
||
uint8_t high = 0, low = 0;
|
||
uint16_t tmplen = pLen, cnt = 0;
|
||
|
||
while(cnt < (tmplen / 2))
|
||
{
|
||
high = ((*s > '9') && ((*s <= 'F') || (*s <= 'f'))) ? *s - 48 - 7 : *s - 48;
|
||
low = ((*(++s) > '9') && ((*s <= 'F') || (*s <= 'f'))) ? *(s) - 48 - 7 : *(s) - 48;
|
||
pDst[cnt] = ((high & 0x0f) << 4 | (low & 0x0f));
|
||
s++;
|
||
cnt++;
|
||
}
|
||
|
||
if(tmplen % 2 != 0)
|
||
{
|
||
pDst[cnt] = ((*s > '9') && ((*s <= 'F') || (*s <= 'f'))) ? *s - 48 - 7 : *s - 48;
|
||
}
|
||
|
||
return tmplen / 2 + tmplen % 2;
|
||
}
|
||
|
||
/**
|
||
* @function StringToDec
|
||
* @brief ½«16½øÖƵÄ×Ö·û´®×ª»»³ÉÊ®½øÖÆ
|
||
* @param[in] pSrc Ô´Êý¾Ý
|
||
* @param[in] pLen ³¤¶È
|
||
* @return ת»»ºóµÄÊ®½øÖÆÊý
|
||
*/
|
||
uint32_t StringToDec(uint8_t *pSrc, uint8_t pLen)
|
||
{
|
||
uint8_t *s = pSrc;
|
||
uint32_t tmp = 0;
|
||
uint8_t cnt = 0, character;
|
||
uint32_t table[] = {0, 1, 10, 100, 1000, 10000, 100000, 1000000};
|
||
|
||
if(pLen > 7)
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
for(cnt = pLen; cnt > 0; cnt--)
|
||
{
|
||
character = ((*s > '9') && ((*s <= 'F') || (*s <= 'f'))) ? *s - 48 - 7 : *s - 48;
|
||
tmp += (character * table[cnt]);
|
||
s++;
|
||
}
|
||
|
||
return tmp;
|
||
}
|
||
|
||
//¸üÐÂÅäÖÃÇøµÄͬʱ¸üÐÂËã·¨ÅäÖÃ
|
||
uint8_t UpdateALCfg(void)
|
||
{
|
||
uint8_t bStatus;
|
||
|
||
gFunTrace = 29;
|
||
|
||
bStatus = UpdateCfg();
|
||
|
||
if(bStatus == TMC_OK)
|
||
{
|
||
AppScanCodeInit();
|
||
}
|
||
|
||
gFunTrace = 30;
|
||
|
||
return bStatus;
|
||
}
|
||
|
||
/**
|
||
* @function UpdateApp
|
||
* @brief дbootloaderÊ×Ò³£¬½øÈëbootloaer״̬
|
||
*/
|
||
uint8_t UpdateApp(BarData *pCode)
|
||
{
|
||
uint8_t status;
|
||
|
||
gFunTrace = 31;
|
||
|
||
if((pCode->bartype == Communication_Id) || (((TMC_GetTick() - gReturnBLCnt) < LIMIT_TIME)))
|
||
{
|
||
gFunTrace = 32;
|
||
status = WriteBLFirstPage();
|
||
gFunTrace = 33;
|
||
|
||
//·µ»ØÖµÊÇTMC_OK£¬ËµÃ÷дBLÊ×Ò³³É¹¦£¬¿ÉÒÔ½øÐи´Î»£¬½øÈëBL״̬
|
||
if(status == TMC_OK)
|
||
{
|
||
ResetChip(1);
|
||
}
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
//¶ÁÈ¡°æ±¾ÐÅÏ¢
|
||
uint8_t OutVersion(BarData *pCode)
|
||
{
|
||
SetPackType(PACK_TYPEA);
|
||
|
||
SetOutputData((uint8_t *)"S0000030", 8);
|
||
|
||
SetOutputData((uint8_t *)CVERSION, VERSIONLEN);
|
||
ReportData(pCode->bartype);
|
||
|
||
return TMC_NONE;
|
||
|
||
}
|
||
|
||
//»Ö¸´³ö³§ÉèÖÃ
|
||
uint8_t RestoreFactorySetting(BarData *pCode)
|
||
{
|
||
uint8_t pretype = gConfgBuf.comunitationType;
|
||
uint8_t status;
|
||
|
||
gFunTrace = 27;
|
||
|
||
status = RestoreCfg();
|
||
gFunTrace = 28;
|
||
AppScanCodeInit();
|
||
//´®¿Ú³õʼ»¯
|
||
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
||
|
||
//Èç¹ûͨÐŽӿÚûÓб仯£¬Ôò²»ÐèÒª¸´Î»
|
||
if(pretype != gConfgBuf.comunitationType)
|
||
{
|
||
ResetChip(2);
|
||
}
|
||
|
||
SetOutputData((uint8_t *)"S_CMD_FFFF",10);
|
||
|
||
return status;
|
||
}
|
||
|
||
uint8_t FC0RestoreFactorySetting(BarData *pCode)
|
||
{
|
||
uint8_t pretype = gConfgBuf.comunitationType;
|
||
uint8_t status;
|
||
|
||
gFunTrace = 27;
|
||
|
||
status = RestoreCfg();
|
||
gFunTrace = 28;
|
||
AppScanCodeInit();
|
||
//´®¿Ú³õʼ»¯
|
||
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
||
|
||
//Èç¹ûͨÐŽӿÚûÓб仯£¬Ôò²»ÐèÒª¸´Î»
|
||
if(pretype != gConfgBuf.comunitationType)
|
||
{
|
||
ResetChip(2);
|
||
}
|
||
|
||
SetOutputData((uint8_t *)"Fnclear0",8);
|
||
|
||
return status;
|
||
}
|
||
|
||
uint8_t KeyRestoreFactorySetting(BarData *pCode)
|
||
{
|
||
uint8_t pretype = gConfgBuf.comunitationType;
|
||
uint8_t status;
|
||
|
||
gFunTrace = 27;
|
||
|
||
status = RestoreCfg();
|
||
gFunTrace = 28;
|
||
AppScanCodeInit();
|
||
//´®¿Ú³õʼ»¯
|
||
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
||
|
||
//Èç¹ûͨÐŽӿÚûÓб仯£¬Ôò²»ÐèÒª¸´Î»
|
||
if(pretype != gConfgBuf.comunitationType)
|
||
{
|
||
ResetChip(2);
|
||
}
|
||
|
||
return status;
|
||
}
|
||
|
||
uint8_t Fn82RestoreFactorySetting(BarData *pCode)
|
||
{
|
||
uint8_t pretype = gConfgBuf.comunitationType;
|
||
uint8_t status;
|
||
|
||
gFunTrace = 27;
|
||
|
||
status = RestoreCfg();
|
||
gFunTrace = 28;
|
||
AppScanCodeInit();
|
||
//´®¿Ú³õʼ»¯
|
||
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
||
|
||
//Èç¹ûͨÐŽӿÚûÓб仯£¬Ôò²»ÐèÒª¸´Î»
|
||
if(pretype != gConfgBuf.comunitationType)
|
||
{
|
||
ResetChip(2);
|
||
}
|
||
|
||
SetOutputData((uint8_t *)"Fn82",4);
|
||
|
||
return status;
|
||
}
|
||
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇɨÂëÄ£¿éÃüÁעÒâɨÂëÄ£¿éʹÓÃʱ£¬DefaultCfg.scanCodeModeÓ¦ÉèÖÃΪ1£ºÃüÁî ģʽ
|
||
*********************************************************************************/
|
||
|
||
//ÃüÁîģʽÏ£¬¿ªÆôɨÂë(ÊÇ·ñдÈëÃüÁîģʽ£©
|
||
uint8_t ScanOn(BarData *pCode)
|
||
{
|
||
gCmdStartFlag = TRUE;
|
||
|
||
//Èç¹ûÊÇÃüÁîʱ¼äģʽÔò¿ªtimer
|
||
if(gConfgBuf.scanCodeMode == CMDTIMEMODE)
|
||
{
|
||
//¶¨Ê±Ôò¿ªÆô
|
||
TimerHSIClockCount(TIM5, START_TIMER);
|
||
}
|
||
|
||
SetOutputData((uint8_t *)"SR030301",8);
|
||
return TMC_OK;
|
||
}
|
||
//ÃüÁîģʽÏ£¬¹Ø±ÕɨÂë
|
||
uint8_t ScanOff(BarData *pCode)
|
||
{
|
||
gCmdStartFlag = FALSE;
|
||
|
||
//Èç¹ûÊÇÃüÁîʱ¼äģʽÔò¹Øtimer
|
||
|
||
if(gConfgBuf.scanCodeMode == CMDTIMEMODE)
|
||
{
|
||
//¶¨Ê±Ôò¹Ø±Õ
|
||
TimerHSIClockCount(TIM5, STOP_TIMER);
|
||
}
|
||
|
||
SetOutputData((uint8_t *)"SR030300",8);
|
||
return TMC_OK;
|
||
}
|
||
//½øÈësleep
|
||
uint8_t Sleep(BarData *pCode)
|
||
{
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData(respSuccess,2);
|
||
ReportData(Communication_Id);
|
||
|
||
//ScanOff
|
||
gCmdStartFlag = FALSE;
|
||
AppLEDControl(LED_WHITE_TURN_OFF);
|
||
//--
|
||
Sleep_Mode();
|
||
return TMC_OK;
|
||
}
|
||
|
||
//»½ÐÑ
|
||
uint8_t StopSleep(BarData *pCode)
|
||
{
|
||
return TMC_OK;
|
||
}
|
||
|
||
#if SETTINGCODE_MODE_0
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇɨÂëºÐ×ÓͨÓÃÃüÁopensyssettingº¯Êý¿ªÆôϵͳÉèÖã¬closeº¯Êý»á½«ÉèÖÃֵдÈëflash£¬·ñÔòÔÚramÖÐ
|
||
*********************************************************************************/
|
||
//ÉèÖÃÂ뿪¹Ø
|
||
/**
|
||
* @function OpenSysSetting
|
||
* @brief ¿ªÆôϵͳÉèÖÃÂ룬½øÈëϵͳÉèÖÃģʽ
|
||
*/
|
||
uint8_t OpenSysSetting(BarData *pCode)
|
||
{
|
||
g_SysModal = SYSMODE_OPEN;
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
return TMC_OK;
|
||
}
|
||
|
||
/**
|
||
* @function CloseSysSetting
|
||
* @brief ¹Ø±ÕϵͳÉèÖÃÂ룬¸´Î»
|
||
*/
|
||
uint8_t CloseSysSetting(BarData *pCode)
|
||
{
|
||
uint8_t pretype = gConfgBuf.comunitationType, status;
|
||
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
g_SysModal = SYSMODE_CLOSE;
|
||
status = UpdateCfg(); //¹Ø±ÕÉèÖÃÂëʱ£¬¸üÐÂÅäÖÃÇø
|
||
|
||
if(status == TMC_OK)
|
||
{
|
||
AppScanCodeInit();
|
||
AppScanModeInit();
|
||
//´®¿Ú³õʼ»¯
|
||
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
||
|
||
//Èç¹ûͨÐŽӿÚûÓб仯£¬Ôò²»ÐèÒª¸´Î»
|
||
if(pretype != gConfgBuf.comunitationType)
|
||
{
|
||
ResetChip(3);
|
||
}
|
||
|
||
return TMC_OK;
|
||
}
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
//²¹¹âµÆÁÁ
|
||
uint8_t SCMD_LedOn(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.ledStatus = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//²¹¹âµÆÃð
|
||
uint8_t SCMD_LedOff(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.ledStatus = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¹Ø±ÕLEDÉÁ˸
|
||
uint8_t SCMD_LEDFlashOff(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.ledFlash = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¿ªÆôLEDÉÁ˸Ìáʾ
|
||
uint8_t SCMD_LEDFlashOn(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.ledFlash = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
//¿ªÆôÉùÒô
|
||
uint8_t SCMD_OpenAllVoice(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.voiceStatus = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¿ª»úÉùÅäÖÃÇл»£¬Çл»ºÐ×ÓÔ¿ª»úÉù
|
||
uint8_t SCMD_OpenVoice1(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.OpenvoiceChangeFlag = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¿ª»úÉùÅäÖÃÇл»£¬Çл»"»¶ÓʹÓÃ"
|
||
uint8_t SCMD_OpenVoice2(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.OpenvoiceChangeFlag = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¹Ø±ÕÖ§¸¶ÀàÌáʾÒô
|
||
uint8_t SCMD_ClosePayVoice(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.voiceStatus = VOICE_NO_PAY;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¹Ø±ÕÉùÒô
|
||
uint8_t SCMD_CloseAllVoice(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.voiceStatus = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t ReviseVolume(BarData *pCode)
|
||
{
|
||
uint8_t volume;
|
||
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
volume = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(volume > 15)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
gConfgBuf.voiceVolume = volume;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¿ªÆô¶£ßË
|
||
uint8_t SCMD_OpenDingdongVoice(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.voiceScanFinish = VOICE_FINISH_DINGDONG;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¿ªÆôɨÂëÍê³É£¬¿ªÊ¼´òÓ¡
|
||
uint8_t SCMD_OpenPrintVoice(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.voiceScanFinish = VOICE_FINISH_PRINT;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¿ªÆôɨÂë³É¹¦
|
||
uint8_t SCMD_ScanSuccessVoice(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.voiceScanFinish = VOICE_SCAN_SUCCESS;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//´ò¿ª·äÃùÆ÷
|
||
uint8_t SCMD_OpenBuzzer(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.buzzerStatus = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¹Ø±Õ·äÃùÆ÷
|
||
uint8_t SCMD_CloseBuzzer(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.buzzerStatus = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function ScanToneFrequency
|
||
* @brief ÌáʾÒôƵÂÊ
|
||
*/
|
||
uint8_t ScanToneFrequency(BarData *pCode)
|
||
{
|
||
uint16_t fre;
|
||
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
fre = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
gConfgBuf.buzzerFrequency = fre;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function ScanToneDuty
|
||
* @brief ÌáʾÒôÕ¼¿Õ±È
|
||
*/
|
||
uint8_t ScanToneDuty(BarData *pCode)
|
||
{
|
||
uint8_t duty;
|
||
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
duty = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(duty >= 100)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
gConfgBuf.buzzerDuty = duty;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
//ÃüÁîģʽ
|
||
uint8_t CmdMode(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.scanCodeMode = CMDMODE;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//ÃüÁʱģʽ
|
||
uint8_t CmdTimeMode(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.scanCodeMode = CMDTIMEMODE;
|
||
gConfgBuf.comunitationType = USBDEVTYPE_VSP;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//×Ô¶¯Ä£Ê½
|
||
uint8_t AutoMode(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.scanCodeMode = AUTOMODE;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//ÒÆ¶¯¸ÐӦģʽ
|
||
uint8_t SensorMode(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.scanCodeMode = SENSORMODE;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//µ¥´Îģʽ
|
||
uint8_t SingleScanMode(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.scanCodeMode = SINGLEMODE;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function ReviseCmdTimeMode
|
||
* @brief ÐÞ¸ÄÃüÁʱʱ¼ä£¬×îС1ms£¬×î´ó65535ms
|
||
*/
|
||
uint8_t ReviseCmdTimeMode(BarData *pCode)
|
||
{
|
||
uint16_t time;
|
||
|
||
//¶ÁÂëʱ³¤É趨
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
time = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(time >= CMD_MODE_TIME_MAX)
|
||
{
|
||
time = CMD_MODE_TIME_MAX;
|
||
}
|
||
|
||
if(time <= CMD_MODE_TIME_MIN)
|
||
{
|
||
time = CMD_MODE_TIME_MIN;
|
||
}
|
||
|
||
gConfgBuf.cmdModeTime = time;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function ReviseSameCodeInterval
|
||
* @brief ÐÞ¸ÄÏàͬÌõÂë¼ä¸ô
|
||
*/
|
||
uint8_t ReviseSameCodeInterval(BarData *pCode)
|
||
{
|
||
uint16_t scantime;
|
||
|
||
//¶ÁÂëʱ³¤É趨
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
scantime = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(scantime > SAME_CODE_INTERVAL_MAX)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
gConfgBuf.sameCodeInterval = scantime;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function ReviseDifferentCodeInterval
|
||
* @brief ÐÞ¸ÄÏàÒìÌõÂë¼ä¸ô
|
||
*/
|
||
uint8_t ReviseDifferentCodeInterval(BarData *pCode)
|
||
{
|
||
uint16_t scantime;
|
||
|
||
//¶ÁÂëʱ³¤É趨
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
scantime = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(scantime > DIFFERENT_CODE_INTERVAL_MAX)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
gConfgBuf.differentCodeInterval = scantime;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function SMReviseSensitivity
|
||
* @brief ÐÞ¸ÄÁéÃô¶È
|
||
*/
|
||
uint8_t SMReviseSensitivity(BarData *pCode)
|
||
{
|
||
uint16_t sensor;
|
||
sensor = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(sensor > SENSORTIVITY_VALUE_MAX)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.sensitivity = sensor;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function SMReviseImageStableTime
|
||
* @brief ÐÞ¸ÄÎÈÏñʱ³¤
|
||
*/
|
||
uint8_t SMReviseImageStableTime(BarData *pCode)
|
||
{
|
||
uint32_t time;
|
||
time = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(time > STABLE_TIME_MAX)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.stableTime = time;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t HIDKBW(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.comunitationType = USBDEVTYPE_HIDKBD;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
uint8_t HIDKBWAuto(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.comunitationType = USBDEVTYPE_HIDKBD;
|
||
gConfgBuf.scanCodeMode = AUTOMODE;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
/*Ð޸ļü¼äÑÓʱ*/
|
||
uint8_t ReviseKeyInterval(BarData *pCode)
|
||
{
|
||
uint8_t timedelay;
|
||
|
||
//³¤¶È¼ì²é
|
||
if(pCode->datalen > (SETCODELEN + 2))
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//ÑÓʱÉ趨
|
||
timedelay = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(timedelay > KEY_DELAY_MAX)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.HIDKBValToRelInterval = timedelay;
|
||
gConfgBuf.HIDKBRelToValInterval = timedelay;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/*ÐÞ¸ÄÂÖѯ¼ä¸ô*/
|
||
uint8_t RevisePollSpeed(BarData *pCode)
|
||
{
|
||
uint8_t speed;
|
||
|
||
//Â볤Åж¨
|
||
if(pCode->datalen != (SETCODELEN + 2))
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
speed = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if((speed == 0x00) || (speed > KEY_POLL_SPEED_MAX))
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.HIDPollRate = speed;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t HIDPOS(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.comunitationType = USBDEVTYPE_HIDPOS;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
uint8_t USBVirtualCOM(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.comunitationType = USBDEVTYPE_VSP;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
uint8_t TTLUART(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.comunitationType = UART;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//ÉèÖò¨ÌØÂÊ
|
||
uint8_t SetUARTBaudRate(BarData *pCode)
|
||
{
|
||
uint32_t baudrate;
|
||
baudrate = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.uartBaudRate = (Uart_BaudRate_Value) baudrate;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
/**
|
||
* @function DataInGBK
|
||
* @brief ÊäÈëGBK
|
||
*/
|
||
uint8_t DataInGBK(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.inputCodeType = GBK;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function DataInUTF8
|
||
* @brief ÊäÈëUTF8
|
||
*/
|
||
uint8_t DataInUTF8(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.inputCodeType = UTF8;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function DataInAuto
|
||
* @brief ÊäÈë×Ô¶¯Ê¶±ð
|
||
*/
|
||
uint8_t DataInAuto(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.inputCodeType = AUTO;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function DataOutGBK
|
||
* @brief Êä³öGBK
|
||
*/
|
||
uint8_t DataOutGBK(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.outputCodeType = GBK;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function DataOutUnicode
|
||
* @brief Êä³öUnicode
|
||
*/
|
||
uint8_t DataOutUnicode(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.outputCodeType = UNICODE;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function DataOutUTF8
|
||
* @brief Êä³öUTF8
|
||
*/
|
||
uint8_t DataOutUTF8(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.outputCodeType = UTF8;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function EnableBillMode
|
||
* @brief ÔÊÐí·¢Æ±Ä£Ê½
|
||
*/
|
||
uint8_t EnableBillMode(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.billModeStatus = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function DisableBillMode
|
||
* @brief ²»ÔÊÐí·¢Æ±Ä£Ê½
|
||
*/
|
||
uint8_t DisableBillMode(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.billModeStatus = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
uint8_t SetTail_CR(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.endCode = END_DOCE_CR;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t SetTail_CTLF(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.endCode = END_DOCE_CRLF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
uint8_t SetTail_ON(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.endCode = END_DOCE_NO;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t SetTail_TAB(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.endCode = END_DOCE_TAB;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
/***********************************Start of Code Setting*************************************/
|
||
/**
|
||
* @function EnableRaedALl
|
||
* @brief ÔÊÐíʶ¶ÁËùÓÐÀàÐÍ
|
||
*/
|
||
uint8_t EnableRaedALl(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN13 = ON;
|
||
gConfgBuf.EAN8 = ON;
|
||
gConfgBuf.UPCA = ON;
|
||
gConfgBuf.UPCE0 = ON;
|
||
gConfgBuf.UPCE1 = ON;
|
||
gConfgBuf.Code128 = ON;
|
||
gConfgBuf.CodeBar = ON;
|
||
gConfgBuf.Code39 = ON;
|
||
gConfgBuf.Code93 = ON;
|
||
gConfgBuf.Interleaved25 = ON;
|
||
gConfgBuf.QR = ON;
|
||
gConfgBuf.DM = ON;
|
||
gConfgBuf.PDF417 = ON;
|
||
gConfgBuf.Matrix25 = ON;
|
||
gConfgBuf.Industrial_25 = ON;
|
||
gConfgBuf.IATA25 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function DisableRaedALl
|
||
* @brief ½ûֹʶ¶ÁËùÓÐÀàÐÍ,³ýÁËÉèÖÃÂë
|
||
*/
|
||
uint8_t DisableRaedALl(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN13 = OFF;
|
||
gConfgBuf.EAN8 = OFF;
|
||
gConfgBuf.UPCA = OFF;
|
||
gConfgBuf.UPCE0 = OFF;
|
||
gConfgBuf.UPCE1 = OFF;
|
||
gConfgBuf.Code128 = OFF;
|
||
gConfgBuf.Code39 = OFF;
|
||
gConfgBuf.Code93 = OFF;
|
||
gConfgBuf.CodeBar = OFF;
|
||
gConfgBuf.Interleaved25 = OFF;
|
||
gConfgBuf.QR = OFF;
|
||
gConfgBuf.DM = OFF;
|
||
gConfgBuf.PDF417 = OFF;
|
||
gConfgBuf.Matrix25 = OFF;
|
||
gConfgBuf.Industrial_25 = OFF;
|
||
gConfgBuf.IATA25 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/**
|
||
* @function EnableDefault
|
||
* @brief ´ò¿ªÄ¬ÈÏʶ¶ÁÀàÐÍ
|
||
*/
|
||
uint8_t EnableDefault(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN13 = DefaultCfg.EAN13;
|
||
gConfgBuf.EAN8 = DefaultCfg.EAN8;
|
||
gConfgBuf.UPCA = DefaultCfg.UPCA;
|
||
gConfgBuf.UPCE0 = DefaultCfg.UPCE0;
|
||
gConfgBuf.UPCE1 = DefaultCfg.UPCE1;
|
||
gConfgBuf.Code128 = DefaultCfg.Code128;
|
||
gConfgBuf.Code39 = DefaultCfg.Code39;
|
||
gConfgBuf.Code93 = DefaultCfg.Code93;
|
||
gConfgBuf.CodeBar = DefaultCfg.CodeBar;
|
||
gConfgBuf.Interleaved25 = DefaultCfg.Interleaved25;
|
||
gConfgBuf.QR = DefaultCfg.QR;
|
||
gConfgBuf.DM = DefaultCfg.DM;
|
||
gConfgBuf.PDF417 = DefaultCfg.PDF417;
|
||
gConfgBuf.Matrix25 = DefaultCfg.Matrix25;
|
||
gConfgBuf.Industrial_25 = DefaultCfg.Industrial_25;
|
||
gConfgBuf.IATA25 = DefaultCfg.IATA25;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//*************************ÌõÂëʹÄÜ*************************//
|
||
uint8_t EnableEAN13Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN13 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableEAN13Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN13 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableEAN13Read2(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN13_2 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableEAN13Read2(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN13_2 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableEAN13Read5(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN13_5 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableEAN13Read5(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN13_5 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableEAN8Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN8 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableEAN8Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN8 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableEAN8Read2(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN8_2 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableEAN8Read2(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN8_2 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableEAN8Read5(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN8_5 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableEAN8Read5(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.EAN8_5 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableUPCARead(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCA = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableUPCARead(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCA = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableUPCARead2(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCA_5 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableUPCARead2(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCA_2 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableUPCARead5(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCA_5 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableUPCARead5(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCA_5 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableUPCE0Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCE0 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableUPE0Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCE0 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableUPCE1Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCE1 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableUPE1Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCE1 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableUPCE1Read2(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCE1_2 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableUPCE1Read2(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCE1_2 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableUPCE1Read5(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCE1_5 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableUPCE1Read5(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.UPCE1_5 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableCode128Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Code128 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableCode128Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Code128 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableCode39Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Code39 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableCode39Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Code39 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableCode32(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Code39_32 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableCode32(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Code39_32 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableFullAsc(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Code39_32_Full_ASCII = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableFullAsc(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Code39_32_Full_ASCII = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableCode93Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Code93 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableCode93Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Code93 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
uint8_t EnableCodeBarRead(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.CodeBar = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableCodeBarRead(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.CodeBar = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableQRRead(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.QR = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableQRRead(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.QR = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableInterLeavedRead(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Interleaved25 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableInterLeavedRead(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Interleaved25 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableMatrixRead(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Matrix25 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableMatrixdRead(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Matrix25 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableIndustrial25Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Industrial_25 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableIndustrial25Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.Industrial_25 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t EnableIATA25Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.IATA25 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DisableIATA25Read(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.IATA25 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
|
||
uint8_t DMOn(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.DM = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t DMOff(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.DM = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t PDF417On(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.PDF417 = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t PDF417Off(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.PDF417 = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t ECIModeOn(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.ECIMode = ON;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
uint8_t ECIModeOff(BarData *pCode)
|
||
{
|
||
if(g_SysModal == SYSMODE_OPEN)
|
||
{
|
||
gConfgBuf.ECIMode = OFF;
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
/***********************************End of Code Setting*************************************/
|
||
|
||
#elif SETTINGCODE_MODE_1
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇɨÂëºÐ×ÓͨÓÃÃüÁopensyssettingº¯Êý¿ªÆôϵͳÉèÖã¬closeº¯Êý»á½«ÉèÖÃֵдÈëflash£¬·ñÔòÔÚramÖÐ
|
||
*********************************************************************************/
|
||
//ÉèÖÃÂ뿪¹Ø
|
||
/**
|
||
* @function OpenSysSetting
|
||
* @brief ¿ªÆôϵͳÉèÖÃÂë
|
||
*/
|
||
uint8_t OpenSysSetting(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.bSettingCodeFlag = ON;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function CloseSysSetting
|
||
* @brief ¹Ø±ÕϵͳÉèÖÃÂë
|
||
*/
|
||
uint8_t CloseSysSetting(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.bSettingCodeFlag = OFF;
|
||
SetOutputData((uint8_t *)"S_CMD_0301",10);
|
||
return UpdateCfg();
|
||
}
|
||
//²¹¹âµÆÁÁ
|
||
uint8_t SCMD_LedOn(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.ledStatus = ON;
|
||
SetOutputData((uint8_t *)"S_CMD_0301",10);
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//²¹¹âµÆÃð
|
||
uint8_t SCMD_LedOff(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.ledStatus = OFF;
|
||
SetOutputData((uint8_t *)"S_CMD_0300",10);
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//¹Ø±ÕLEDÉÁ˸
|
||
uint8_t SCMD_LEDFlashOff(BarData *pCode)
|
||
{
|
||
SetOutputData((uint8_t *)"S_CMD_0408",10);
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.ledFlash = OFF;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//¿ªÆôLEDÉÁ˸Ìáʾ
|
||
uint8_t SCMD_LEDFlashOn(BarData *pCode)
|
||
{
|
||
SetOutputData((uint8_t *)"S_CMD_0409",10);
|
||
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.ledFlash = ON;
|
||
return UpdateCfg();
|
||
}
|
||
//¿ªÆôÉùÒô
|
||
uint8_t SCMD_OpenAllVoice(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.voiceStatus = ON;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//¿ª»úÉùÅäÖÃÇл»£¬Çл»ºÐ×ÓÔ¿ª»úÉù
|
||
uint8_t SCMD_OpenVoice1(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.OpenvoiceChangeFlag = OFF;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//¿ª»úÉùÅäÖÃÇл»£¬Çл»"»¶ÓʹÓÃ"
|
||
uint8_t SCMD_OpenVoice2(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.OpenvoiceChangeFlag = ON;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//¹Ø±ÕÖ§¸¶ÀàÌáʾÒô
|
||
uint8_t SCMD_ClosePayVoice(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.voiceStatus = VOICE_NO_PAY;
|
||
return UpdateCfg();
|
||
}
|
||
//¹Ø±ÕÉùÒô
|
||
uint8_t SCMD_CloseAllVoice(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.voiceStatus = OFF;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
uint8_t ReviseVolume(BarData *pCode)
|
||
{
|
||
uint8_t volume;
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
volume = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
SetOutputData((uint8_t *)"S_CMD_04VL",10);
|
||
|
||
if(volume > 15)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
gConfgBuf.voiceVolume = volume;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//¿ªÆô¶£ßË
|
||
uint8_t SCMD_OpenDingdongVoice(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.voiceScanFinish = VOICE_FINISH_DINGDONG;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//¿ªÆôɨÂëÍê³É£¬¿ªÊ¼´òÓ¡
|
||
uint8_t SCMD_OpenPrintVoice(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.voiceScanFinish = VOICE_FINISH_PRINT;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//¿ªÆôɨÂë³É¹¦
|
||
uint8_t SCMD_ScanSuccessVoice(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.voiceScanFinish = VOICE_SCAN_SUCCESS;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//´ò¿ª·äÃùÆ÷
|
||
uint8_t SCMD_OpenBuzzer(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.buzzerStatus = ON;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//¹Ø±Õ·äÃùÆ÷
|
||
uint8_t SCMD_CloseBuzzer(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.buzzerStatus = OFF;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function ScanToneFrequency
|
||
* @brief ÌáʾÒôƵÂÊ
|
||
*/
|
||
uint8_t ScanToneFrequency(BarData *pCode)
|
||
{
|
||
uint16_t fre;
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
fre = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
gConfgBuf.buzzerFrequency = fre;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function ScanToneDuty
|
||
* @brief ÌáʾÒôÕ¼¿Õ±È
|
||
*/
|
||
uint8_t ScanToneDuty(BarData *pCode)
|
||
{
|
||
uint8_t duty;
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
duty = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(duty >= 100)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
gConfgBuf.buzzerDuty = duty;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//ÃüÁîģʽ
|
||
uint8_t CmdMode(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.scanCodeMode = CMDMODE;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//ÃüÁʱģʽ
|
||
uint8_t CmdTimeMode(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.scanCodeMode = CMDTIMEMODE;
|
||
gConfgBuf.comunitationType = USBDEVTYPE_VSP;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//×Ô¶¯Ä£Ê½
|
||
uint8_t AutoMode(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.scanCodeMode = AUTOMODE;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//ÒÆ¶¯¸ÐӦģʽ
|
||
uint8_t SensorMode(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.scanCodeMode = SENSORMODE;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
//µ¥´Îģʽ
|
||
uint8_t SingleScanMode(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.scanCodeMode = SINGLEMODE;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function ReviseCmdTimeMode
|
||
* @brief ÐÞ¸ÄÃüÁʱʱ¼ä£¬×îС1ms£¬×î´ó65535ms
|
||
*/
|
||
uint8_t ReviseCmdTimeMode(BarData *pCode)
|
||
{
|
||
uint16_t time;
|
||
//¶ÁÂëʱ³¤É趨
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
time = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(time >= CMD_MODE_TIME_MAX)
|
||
{
|
||
time = CMD_MODE_TIME_MAX;
|
||
}
|
||
|
||
if(time <= CMD_MODE_TIME_MIN)
|
||
{
|
||
time = CMD_MODE_TIME_MIN;
|
||
}
|
||
|
||
gConfgBuf.cmdModeTime = time;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function ReviseSameCodeInterval
|
||
* @brief ÐÞ¸ÄÏàͬÌõÂë¼ä¸ô
|
||
*/
|
||
uint8_t ReviseSameCodeInterval(BarData *pCode)
|
||
{
|
||
uint16_t scantime;
|
||
//¶ÁÂëʱ³¤É趨
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
scantime = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(scantime > SAME_CODE_INTERVAL_MAX)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
gConfgBuf.sameCodeInterval = scantime;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function ReviseDifferentCodeInterval
|
||
* @brief ÐÞ¸ÄÏàÒìÌõÂë¼ä¸ô
|
||
*/
|
||
uint8_t ReviseDifferentCodeInterval(BarData *pCode)
|
||
{
|
||
uint16_t scantime;
|
||
//¶ÁÂëʱ³¤É趨
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
scantime = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(scantime > DIFFERENT_CODE_INTERVAL_MAX)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
gConfgBuf.differentCodeInterval = scantime;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function SMReviseSensitivity
|
||
* @brief ÐÞ¸ÄÁéÃô¶È
|
||
*/
|
||
uint8_t SMReviseSensitivity(BarData *pCode)
|
||
{
|
||
uint16_t sensor;
|
||
sensor = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(sensor > SENSORTIVITY_VALUE_MAX)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.sensitivity = sensor;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function SMReviseImageStableTime
|
||
* @brief ÐÞ¸ÄÎÈÏñʱ³¤
|
||
*/
|
||
uint8_t SMReviseImageStableTime(BarData *pCode)
|
||
{
|
||
uint32_t time;
|
||
time = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(time > STABLE_TIME_MAX)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.stableTime = time;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
uint8_t HIDKBW(BarData *pCode)
|
||
{
|
||
uint8_t bStatus;
|
||
uint8_t bPretype = gConfgBuf.comunitationType;
|
||
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.comunitationType = USBDEVTYPE_HIDKBD;
|
||
bStatus = UpdateCfg();
|
||
|
||
if(bStatus == TMC_OK)
|
||
{
|
||
if(bPretype != gConfgBuf.comunitationType)
|
||
{
|
||
//USB³õʼ»¯
|
||
AppUSBInit(gConfgBuf.comunitationType);
|
||
}
|
||
}
|
||
|
||
return bStatus;
|
||
}
|
||
|
||
uint8_t HIDKBWAuto(BarData *pCode)
|
||
{
|
||
uint8_t bStatus;
|
||
uint8_t bPretype = gConfgBuf.comunitationType;
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.comunitationType = USBDEVTYPE_HIDKBD;
|
||
gConfgBuf.scanCodeMode = AUTOMODE;
|
||
bStatus = UpdateCfg();
|
||
if(bStatus == TMC_OK)
|
||
{
|
||
if(bPretype != gConfgBuf.comunitationType)
|
||
{
|
||
//USB³õʼ»¯
|
||
AppUSBInit(gConfgBuf.comunitationType);
|
||
}
|
||
}
|
||
|
||
return bStatus;
|
||
}
|
||
|
||
/*Ð޸ļü¼äÑÓʱ*/
|
||
uint8_t ReviseKeyInterval(BarData *pCode)
|
||
{
|
||
uint8_t timedelay;
|
||
|
||
//³¤¶È¼ì²é
|
||
if(pCode->datalen > (SETCODELEN + 2))
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//ÑÓʱÉ趨
|
||
timedelay = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if(timedelay > KEY_DELAY_MAX)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.HIDKBValToRelInterval = timedelay;
|
||
gConfgBuf.HIDKBRelToValInterval = timedelay;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/*ÐÞ¸ÄÂÖѯ¼ä¸ô*/
|
||
uint8_t RevisePollSpeed(BarData *pCode)
|
||
{
|
||
uint8_t speed;
|
||
|
||
//Â볤Åж¨
|
||
if(pCode->datalen != (SETCODELEN + 2))
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
speed = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
|
||
if((speed == 0x00) || (speed > KEY_POLL_SPEED_MAX))
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.HIDPollRate = speed;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
uint8_t HIDPOS(BarData *pCode)
|
||
{
|
||
uint8_t bStatus;
|
||
uint8_t bPretype = gConfgBuf.comunitationType;
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.comunitationType = USBDEVTYPE_HIDPOS;
|
||
bStatus = UpdateCfg();
|
||
if(bStatus == TMC_OK)
|
||
{
|
||
if(bPretype != gConfgBuf.comunitationType)
|
||
{
|
||
//USB³õʼ»¯
|
||
AppUSBInit(gConfgBuf.comunitationType);
|
||
}
|
||
}
|
||
|
||
return bStatus;
|
||
}
|
||
|
||
uint8_t USBVirtualCOM(BarData *pCode)
|
||
{
|
||
uint8_t bStatus;
|
||
uint8_t bPretype = gConfgBuf.comunitationType;
|
||
|
||
if(bPretype!=USBDEVTYPE_VSP)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.comunitationType = USBDEVTYPE_VSP;
|
||
bStatus = UpdateCfg();
|
||
if(bStatus == TMC_OK)
|
||
{
|
||
//if(bPretype != gConfgBuf.comunitationType)
|
||
{
|
||
//USB³õʼ»¯
|
||
AppUSBInit(gConfgBuf.comunitationType);
|
||
}
|
||
}
|
||
} else bStatus = TMC_OK;
|
||
return bStatus;
|
||
}
|
||
|
||
uint8_t TTLUART(BarData *pCode)
|
||
{
|
||
uint8_t bStatus;
|
||
uint8_t bPretype = gConfgBuf.comunitationType;
|
||
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.comunitationType = UART;
|
||
bStatus = UpdateCfg();
|
||
if(bStatus == TMC_OK)
|
||
{
|
||
if(bPretype != gConfgBuf.comunitationType)
|
||
{
|
||
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
||
}
|
||
}
|
||
|
||
return bStatus;
|
||
}
|
||
|
||
//ÉèÖò¨ÌØÂÊ
|
||
uint8_t SetUARTBaudRate(BarData *pCode)
|
||
{
|
||
uint8_t bStatus;
|
||
uint32_t baudrate;
|
||
baudrate = StringToDec(&pCode->bardata[SETCODELEN], pCode->datalen - SETCODELEN);
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.uartBaudRate = (Uart_BaudRate_Value) baudrate;
|
||
bStatus = UpdateCfg();
|
||
if(bStatus == TMC_OK)
|
||
{
|
||
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
||
}
|
||
return bStatus;
|
||
}
|
||
|
||
/**
|
||
* @function DataInGBK
|
||
* @brief ÊäÈëGBK
|
||
*/
|
||
uint8_t DataInGBK(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.inputCodeType = GBK;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function DataInUTF8
|
||
* @brief ÊäÈëUTF8
|
||
*/
|
||
uint8_t DataInUTF8(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.inputCodeType = UTF8;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function DataInAuto
|
||
* @brief ÊäÈë×Ô¶¯Ê¶±ð
|
||
*/
|
||
uint8_t DataInAuto(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.inputCodeType = AUTO;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function DataOutGBK
|
||
* @brief Êä³öGBK
|
||
*/
|
||
uint8_t DataOutGBK(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.outputCodeType = GBK;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function DataOutUnicode
|
||
* @brief Êä³öUnicode
|
||
*/
|
||
uint8_t DataOutUnicode(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.outputCodeType = UNICODE;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function DataOutUTF8
|
||
* @brief Êä³öUTF8
|
||
*/
|
||
uint8_t DataOutUTF8(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.outputCodeType = UTF8;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function EnableBillMode
|
||
* @brief ÔÊÐí·¢Æ±Ä£Ê½
|
||
*/
|
||
uint8_t EnableBillMode(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.billModeStatus = ON;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function DisableBillMode
|
||
* @brief ²»ÔÊÐí·¢Æ±Ä£Ê½
|
||
*/
|
||
uint8_t DisableBillMode(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.billModeStatus = OFF;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
uint8_t SetTail_CR(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.endCode = END_DOCE_CR;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
uint8_t SetTail_CTLF(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.endCode = END_DOCE_CRLF;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
uint8_t SetTail_ON(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.endCode = END_DOCE_NO;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
uint8_t SetTail_TAB(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.endCode = END_DOCE_TAB;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/***********************************Start of Code Setting*************************************/
|
||
/**
|
||
* @function EnableRaedALl
|
||
* @brief ÔÊÐíʶ¶ÁËùÓÐÀàÐÍ
|
||
*/
|
||
uint8_t EnableRaedALl(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN13 = ON;
|
||
gConfgBuf.EAN8 = ON;
|
||
gConfgBuf.UPCA = ON;
|
||
gConfgBuf.UPCE0 = ON;
|
||
gConfgBuf.UPCE1 = ON;
|
||
gConfgBuf.Code128 = ON;
|
||
gConfgBuf.CodeBar = ON;
|
||
gConfgBuf.Code39 = ON;
|
||
gConfgBuf.Code93 = ON;
|
||
gConfgBuf.Interleaved25 = ON;
|
||
gConfgBuf.QR = ON;
|
||
gConfgBuf.DM = ON;
|
||
gConfgBuf.PDF417 = ON;
|
||
gConfgBuf.Matrix25 = ON;
|
||
gConfgBuf.Industrial_25 = ON;
|
||
gConfgBuf.IATA25 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
/**
|
||
* @function DisableRaedALl
|
||
* @brief ½ûֹʶ¶ÁËùÓÐÀàÐÍ,³ýÁËÉèÖÃÂë
|
||
*/
|
||
uint8_t DisableRaedALl(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN13 = OFF;
|
||
gConfgBuf.EAN8 = OFF;
|
||
gConfgBuf.UPCA = OFF;
|
||
gConfgBuf.UPCE0 = OFF;
|
||
gConfgBuf.UPCE1 = OFF;
|
||
gConfgBuf.Code128 = OFF;
|
||
gConfgBuf.Code39 = OFF;
|
||
gConfgBuf.Code93 = OFF;
|
||
gConfgBuf.CodeBar = OFF;
|
||
gConfgBuf.Interleaved25 = OFF;
|
||
gConfgBuf.QR = OFF;
|
||
gConfgBuf.DM = OFF;
|
||
gConfgBuf.PDF417 = OFF;
|
||
gConfgBuf.Matrix25 = OFF;
|
||
gConfgBuf.Industrial_25 = OFF;
|
||
gConfgBuf.IATA25 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
/**
|
||
* @function EnableDefault
|
||
* @brief ´ò¿ªÄ¬ÈÏʶ¶ÁÀàÐÍ
|
||
*/
|
||
uint8_t EnableDefault(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN13 = DefaultCfg.EAN13;
|
||
gConfgBuf.EAN8 = DefaultCfg.EAN8;
|
||
gConfgBuf.UPCA = DefaultCfg.UPCA;
|
||
gConfgBuf.UPCE0 = DefaultCfg.UPCE0;
|
||
gConfgBuf.UPCE1 = DefaultCfg.UPCE1;
|
||
gConfgBuf.Code128 = DefaultCfg.Code128;
|
||
gConfgBuf.Code39 = DefaultCfg.Code39;
|
||
gConfgBuf.Code93 = DefaultCfg.Code93;
|
||
gConfgBuf.CodeBar = DefaultCfg.CodeBar;
|
||
gConfgBuf.Interleaved25 = DefaultCfg.Interleaved25;
|
||
gConfgBuf.QR = DefaultCfg.QR;
|
||
gConfgBuf.DM = DefaultCfg.DM;
|
||
gConfgBuf.PDF417 = DefaultCfg.PDF417;
|
||
gConfgBuf.Matrix25 = DefaultCfg.Matrix25;
|
||
gConfgBuf.Industrial_25 = DefaultCfg.Industrial_25;
|
||
gConfgBuf.IATA25 = DefaultCfg.IATA25;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
//*************************ÌõÂëʹÄÜ*************************//
|
||
uint8_t EnableEAN13Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN13 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableEAN13Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN13 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableEAN13Read2(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN13_2 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableEAN13Read2(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN13_2 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableEAN13Read5(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN13_5 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableEAN13Read5(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN13_5 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableEAN8Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN8 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableEAN8Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN8 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableEAN8Read2(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN8_2 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableEAN8Read2(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN8_2 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableEAN8Read5(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN8_5 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableEAN8Read5(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.EAN8_5 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableUPCARead(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCA = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableUPCARead(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCA = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableUPCARead2(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCA_5 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableUPCARead2(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCA_2 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableUPCARead5(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCA_5 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableUPCARead5(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCA_5 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableUPCE0Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCE0 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableUPE0Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCE0 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableUPCE1Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCE1 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableUPE1Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCE1 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableUPCE1Read2(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCE1_2 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableUPCE1Read2(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCE1_2 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableUPCE1Read5(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCE1_5 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableUPCE1Read5(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.UPCE1_5 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableCode128Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Code128 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableCode128Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Code128 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableCode39Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Code39 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableCode39Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Code39 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableCode32(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Code39_32 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableCode32(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Code39_32 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableFullAsc(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Code39_32_Full_ASCII = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableFullAsc(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Code39_32_Full_ASCII = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableCode93Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Code93 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableCode93Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Code93 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
|
||
uint8_t EnableCodeBarRead(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.CodeBar = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableCodeBarRead(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.CodeBar = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableQRRead(BarData *pCode)
|
||
{
|
||
// Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
SetOutputData((uint8_t *)"C_CMD_QR01",10);
|
||
gConfgBuf.QR = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableQRRead(BarData *pCode)
|
||
{
|
||
// Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
SetOutputData((uint8_t *)"C_CMD_QR00",10);
|
||
gConfgBuf.QR = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableInterLeavedRead(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Interleaved25 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableInterLeavedRead(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Interleaved25 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableMatrixRead(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Matrix25 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableMatrixdRead(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Matrix25 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableIndustrial25Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Industrial_25 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableIndustrial25Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.Industrial_25 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t EnableIATA25Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.IATA25 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableIATA25Read(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.IATA25 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
|
||
uint8_t DMOn(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.DM = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DMOff(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.DM = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t PDF417On(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.PDF417 = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t PDF417Off(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.PDF417 = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t ECIModeOn(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.ECIMode = ON;
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t ECIModeOff(BarData *pCode)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.ECIMode = OFF;
|
||
return UpdateALCfg();
|
||
}
|
||
#endif
|
||
|
||
uint8_t PlayVoice(BarData *pCode)
|
||
{
|
||
// AppVoicePlay((uint8_t *)scanFinishVoiceFile, sizeof(scanFinishVoiceFile), gConfgBuf.voiceVolume);
|
||
addPlayList(VOICEDATA,(uint8_t *)scanFinishVoiceFile, sizeof(scanFinishVoiceFile));
|
||
return TMC_NONE;
|
||
}
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇÉú²úдSNÏà¹Ø¹¤Ðòº¯Êý£¬·Ö±ðÊÇ»ñÈ¡SN£¬Èç¹ûûÓÐSN£¬½øÐÐдÈëSN£»ÒÑÓÐSN£¬ÌṩÇå³ýSNµÄ²Ù×÷
|
||
*********************************************************************************/
|
||
|
||
//»ñÈ¡SN
|
||
uint8_t ProductGetSN(BarData *pCode)
|
||
{
|
||
uint8_t *p_sn = (uint8_t *) TUSNADDR;
|
||
|
||
//¶Á±ê¼Ç£¬Èç¹ûÒÑ´æÔÚ£¬·µ»ØSNÖµ£¬Èç¹û²»´æÔÚ£¬·µ»Ø´íÎó
|
||
if(*(p_sn + SN_SFLAG_OFFS) == 'S' && *(p_sn + SN_NFLAG_OFFS) == 'N')
|
||
{
|
||
ClearOutputLen();
|
||
SetOutputData((uint8_t *)"S0000RSN",8);
|
||
if(!gReceiveKey)
|
||
{
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData((uint8_t *)"NOKEY",5);
|
||
ReportData(Communication_Id);
|
||
} else {
|
||
SetOutputData((p_sn + SN_NFLAG_OFFS+1),*(p_sn+SN_LEN_OFFS) - SN_SNFLAG_LEN);
|
||
ReportData(Communication_Id);
|
||
}
|
||
return TMC_NONE;
|
||
}
|
||
else
|
||
{
|
||
SetOutputData((uint8_t *)"S0000RSN",8);
|
||
return TMC_ERROR;
|
||
}
|
||
}
|
||
|
||
|
||
//дSN
|
||
uint8_t ProductWriteSN(BarData *pCode)
|
||
{
|
||
uint8_t uLen;
|
||
uint8_t tmpbuf[FLASHPAGESIZE];
|
||
uint8_t status;
|
||
uLen = pCode->datalen - SN_PROTOCOL_WSN_OFFS;//¸Ã³¤¶È°üº¬SN×Ö·û³¤¶È
|
||
tmpbuf[SN_LEN_OFFS] = uLen;
|
||
memcpy(tmpbuf + SN_SFLAG_OFFS, pCode->bardata + SN_PROTOCOL_WSN_OFFS, uLen);
|
||
status = FLASH_NormalErase((uint8_t *)TUSNADDR);
|
||
|
||
if(status != TMC_OK)
|
||
{
|
||
SetOutputData((uint8_t *)"S0000WSN",8);
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
status = FLASH_WriteDoubleWords((uint32_t)TUSNADDR, (uint32_t)&tmpbuf, FLASHPAGESIZE / 2);
|
||
|
||
if(status != TMC_OK)
|
||
{
|
||
SetOutputData((uint8_t *)"S0000WSN",8);
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
SetOutputData((uint8_t *)"S0000WSN",8);
|
||
return TMC_OK;
|
||
// return SN_EXIT;
|
||
}
|
||
|
||
|
||
//Çå³ýSN
|
||
uint8_t ProductClearSN(BarData *pCode)
|
||
{
|
||
uint8_t status;
|
||
status = FLASH_NormalErase((uint8_t *)TUSNADDR);
|
||
|
||
if(status != TMC_OK)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
return TMC_OK;
|
||
}
|
||
|
||
//Êä³öSN
|
||
uint8_t OutputSN(BarData *pCode)
|
||
{
|
||
uint8_t *p_sn = (uint8_t *) TUSNADDR;
|
||
|
||
//¶Á±ê¼Ç£¬Èç¹ûÒÑ´æÔÚ£¬·µ»ØSNÖµ£¬Èç¹û²»´æÔÚ£¬Êä³ö"FFFF"
|
||
if(*(p_sn + SN_SFLAG_OFFS) == 'S' && *(p_sn + SN_NFLAG_OFFS) == 'N')
|
||
{
|
||
SetOutputData((uint8_t *)(TUSNADDR + SN_DATA_OFFS), (uint8_t)(*((uint32_t *)TUSNADDR) - SN_SNFLAG_LEN));
|
||
// SetOutputData((uint8_t *)"\n", CRLF_LEN);
|
||
ReportData(pCode->bartype);
|
||
}
|
||
else
|
||
{
|
||
SetOutputData((uint8_t *)"FFFF", NO_SN_LEN);
|
||
ReportData(pCode->bartype);
|
||
}
|
||
|
||
return TMC_OK;
|
||
}
|
||
|
||
//ÖÃÉú²ú±ê¼Ç£¬Èç¹ûÕâ¸ö±ê¼ÇÊÇÌØ¶¨Öµ£¬¶Ë¿Ú¸ù¾ÝÅäÖÃÇø£»·ñÔò£¬Ä¬È϶˿ÚÊÇÐéÄâ´®¿Ú
|
||
uint8_t SetProductFlag(BarData *pCode)
|
||
{
|
||
uint8_t tmpbuf[FLASHPAGESIZE] = PRODUCT_FLAG_VALUE;
|
||
uint8_t status;
|
||
status = FLASH_NormalErase((uint8_t *)PRODUCT_FLAG_ADDR);
|
||
|
||
if(status != TMC_OK)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
status = FLASH_WriteDoubleWords((uint32_t)PRODUCT_FLAG_ADDR, (uint32_t)&tmpbuf, FLASHPAGESIZE / 2);
|
||
|
||
if(status != TMC_OK)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
return TMC_OK;
|
||
}
|
||
|
||
//¶ÁÈ¡Éú²ú±ê¼Ç£¬Èç¹ûÕâ¸ö±ê¼ÇÊÇÌØ¶¨Öµ£¬¶Ë¿Ú¸ù¾ÝÅäÖÃÇø£»·ñÔò£¬Ä¬È϶˿ÚÊÇÐéÄâ´®¿Ú
|
||
uint8_t GetProductFlag(BarData *pCode)
|
||
{
|
||
uint8_t *pFlag = (uint8_t *) PRODUCT_FLAG_ADDR;
|
||
|
||
if(memcmp(pFlag, PRODUCT_FLAG_VALUE, PRODUCT_FLAG_LEN))
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
return TMC_OK;
|
||
}
|
||
|
||
//ÇåÉú²ú±ê¼Ç£¬Èç¹ûÕâ¸ö±ê¼ÇÊÇÌØ¶¨Öµ£¬¶Ë¿Ú¸ù¾ÝÅäÖÃÇø£»·ñÔò£¬Ä¬È϶˿ÚÊÇÐéÄâ´®¿Ú
|
||
uint8_t ClearProductFlag(BarData *pCode)
|
||
{
|
||
uint8_t status;
|
||
status = FLASH_NormalErase((uint8_t *)PRODUCT_FLAG_ADDR);
|
||
|
||
if(status != TMC_OK)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
return TMC_OK;
|
||
}
|
||
|
||
//»ñȡоƬSN
|
||
uint8_t GetChipSN(BarData *pCode)
|
||
{
|
||
uint8_t *pSn = (uint8_t *) SNADDR;
|
||
|
||
SetOutputData((uint8_t *)pSn, SNLEN);
|
||
ReportData(pCode->bartype);
|
||
|
||
return TMC_NONE;
|
||
}
|
||
|
||
void GetChipSNStr(int commtype)
|
||
{
|
||
char tmp[SNLEN*2+10];
|
||
uint8_t c1,c2,len;
|
||
uint8_t *pSn = (uint8_t *) SNADDR;
|
||
|
||
len = 0;
|
||
for(int i=0;i<SNLEN;i++)
|
||
{
|
||
c1 = (*(pSn+i))&0x0f;
|
||
c2 = (*(pSn+i))>>4;
|
||
|
||
if(c2>9) tmp[len] = 'A' + c2 - 10;
|
||
else tmp[len] = c2 + '0';
|
||
len++;
|
||
|
||
if(c1>9) tmp[len] = 'A' + c1 - 10;
|
||
else tmp[len] = c1 + '0';
|
||
len++;
|
||
|
||
}
|
||
// tmp[len++] = '\n';
|
||
SetOutputData((uint8_t *)tmp, len);
|
||
ReportData(commtype);
|
||
}
|
||
|
||
//дÈëLicense
|
||
uint8_t WriteLicense(BarData *pCode)
|
||
{
|
||
uint8_t license[SNLEN + SNFLAGLEN], status;
|
||
|
||
if((pCode->datalen - SETCODELEN_MODULE) == SNLEN)
|
||
{
|
||
memcpy(&license, pCode->bardata + SETCODELEN_MODULE, SNLEN);
|
||
memcpy(&license[SNLEN], (uint8_t *) "LICENSE.", SNFLAGLEN);
|
||
status = FLASH_NormalErase((uint8_t *)LINSCENCE);
|
||
|
||
if(status != TMC_OK)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
status = FLASH_WriteDoubleWords((uint32_t)LINSCENCE, (uint32_t)&license, SNLEN + SNFLAGLEN);
|
||
|
||
if(status != TMC_OK)
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
return TMC_OK;
|
||
}
|
||
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
//¶ÁÈ¡License
|
||
uint8_t GetLicense(BarData *pCode)
|
||
{
|
||
uint8_t *pLicense = (uint8_t *) LINSCENCE;
|
||
|
||
if(memcmp(pLicense + SNLEN, (uint8_t *) "LICENSE.", SNFLAGLEN))
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
|
||
SetOutputData((uint8_t *)pLicense, SNLEN);
|
||
ReportData(pCode->bartype);
|
||
return TMC_NONE;
|
||
}
|
||
|
||
//ÑéÖ¤LicenseÊÇ·ñÓÐЧ
|
||
uint8_t CheckLicense(BarData *pCode)
|
||
{
|
||
uint8_t *pLicense = (uint8_t *) LINSCENCE;
|
||
|
||
if(TMC_Scan_Init(pLicense) == 0)
|
||
{
|
||
return TMC_OK;
|
||
}
|
||
else
|
||
{
|
||
return TMC_ERROR;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @function EnableKeyVoice
|
||
* @brief press key voice on
|
||
* @param[in] pCode
|
||
* @return
|
||
*/
|
||
uint8_t EnableKeyVoice(BarData *pCode)
|
||
{
|
||
SetOutputData((uint8_t *)"S_CMD_VC01",10);
|
||
if(gConfgBuf.statusKeyVoice!=ON)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.statusKeyVoice = ON;
|
||
return UpdateCfg();
|
||
}
|
||
return TMC_OK;
|
||
}
|
||
|
||
/**
|
||
* @function DisableKeyVoice
|
||
* @brief press key voice off
|
||
* @param[in] pCode
|
||
* @return
|
||
*/
|
||
uint8_t DisableKeyVoice(BarData *pCode)
|
||
{
|
||
SetOutputData((uint8_t *)"S_CMD_VC00",10);
|
||
if(gConfgBuf.statusKeyVoice!=OFF)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.statusKeyVoice = OFF;
|
||
return UpdateCfg();
|
||
}
|
||
return TMC_OK;
|
||
}
|
||
|
||
uint8_t PayCodeEnable(BarData *pCode)
|
||
{
|
||
|
||
SetOutputData(pCode->bardata,pCode->datalen);
|
||
|
||
if(pCode->bardata[9]=='1')
|
||
{
|
||
if(gConfgBuf.payCodeEnable==OFF)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.payCodeEnable = ON;
|
||
return UpdateCfg();
|
||
}
|
||
return TMC_OK;
|
||
} else {
|
||
if(gConfgBuf.payCodeEnable==ON)
|
||
{
|
||
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
||
gConfgBuf.payCodeEnable = OFF;
|
||
return UpdateCfg();
|
||
}
|
||
return TMC_OK;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @function PlayLockVoice
|
||
* @brief
|
||
*/
|
||
extern void CmdPlayVoice(uint8_t *cmd);
|
||
uint8_t PlayLockVoice(BarData *pCode)
|
||
{
|
||
|
||
CmdPlayVoice(pCode->bardata + SETCODELEN + 6);
|
||
|
||
SetOutputData(pCode->bardata,pCode->datalen);
|
||
// SetOutputData((uint8_t *)"S_CMD_PLAYVOICE",15);
|
||
|
||
return TMC_OK;
|
||
}
|
||
|
||
extern uint8_t RN[];//random number
|
||
|
||
uint8_t CmdGetRan(BarData *pCode)
|
||
{
|
||
uint8_t i,r[5],r16[12],cmd[20];
|
||
srand(TMC_GetTick());
|
||
for(i=0;i<5;i++)
|
||
{
|
||
r[i] = rand()%0xff;
|
||
RN[i+5] = r[i];
|
||
}
|
||
for(i=10;i<20;i++)RN[i] = RN[i-10];
|
||
for(i=20;i<30;i++)RN[i] = RN[i-20];
|
||
|
||
BinToCode16(r,r16,5);
|
||
strcpy(cmd,"LRRAN");
|
||
strcat(cmd,r16);
|
||
SetOutputData((uint8_t *)cmd, strlen(cmd));
|
||
SetPackType(PACK_TYPEA);
|
||
ReportData(pCode->bartype);
|
||
|
||
return TMC_NONE;
|
||
}
|
||
|
||
|
||
extern uint8_t ShowVersion(BarData *pCode);
|
||
extern uint8_t ChangeToCom(BarData *pCode);
|
||
extern uint8_t ChangeToHIDKBW(BarData *pCode);
|
||
extern uint8_t EnOrDisOneDimCode(BarData *pCode);
|
||
extern uint8_t EnOrDisTwoDimCode(BarData *pCode);
|
||
extern uint8_t EnOrDisKey(BarData *pCode);
|
||
extern uint8_t IncreaseVolume(BarData *pCode);
|
||
extern uint8_t DecreaseVolume(BarData *pCode);
|
||
extern uint8_t Fn29ShowSN(BarData *pCode);
|
||
extern uint8_t Fn88ShowDevicemod(BarData *pCode);
|
||
|
||
|
||
/*********************************************************************************
|
||
* ÃüÁî±í
|
||
*********************************************************************************/
|
||
const ScanCodeHandle CommCmdTable[] =
|
||
{
|
||
|
||
{{"S_CMD_PLAY"}, SETCODELEN, PlayLockVoice}, //play vpoce
|
||
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇɨÂëÄ£¿éÃüÁעÒâɨÂëÄ£¿éʹÓÃʱ£¬DefaultCfg.scanCodeModeÓ¦ÉèÖÃΪ1£ºÃüÁî ģʽ
|
||
*********************************************************************************/
|
||
{{"S0000030"}, SETCODELEN_MODULE, OutVersion}, //»ñÈ¡°æ±¾
|
||
{{"SU0000FF"}, SETCODELEN_MODULE, UpdateApp}, //¸üй̼þ
|
||
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇ´®¿ÚдSNÃüÁî
|
||
*********************************************************************************/
|
||
{{"S0000RSN"}, SETCODELEN_MODULE, ProductGetSN}, //»ñÈ¡SN
|
||
{{"S0000WSN"}, SETCODELEN_MODULE, ProductWriteSN}, //дSN
|
||
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇɨÂëºÐ×ÓͨÓÃÃüÁopensyssettingº¯Êý¿ªÆôϵͳÉèÖã¬closeº¯Êý»á½«ÉèÖÃֵдÈëflash£¬·ñÔòÔÚramÖÐ
|
||
*********************************************************************************/
|
||
{{"S_CMD_FFFF"}, SETCODELEN, RestoreFactorySetting},
|
||
{{"S_CMD_0301"}, SETCODELEN, SCMD_LedOn}, //°×É«µÆ³£ÁÁÉèÖÃ
|
||
{{"S_CMD_0300"}, SETCODELEN, SCMD_LedOff}, //°×É«µÆÆÕͨÉèÖÃ
|
||
{{"S_CMD_04VL"}, SETCODELEN, ReviseVolume}, //ÐÞ¸ÄÓïÒô´óС
|
||
{{"S_CMD_0409"}, SETCODELEN, SCMD_LEDFlashOn}, //¿ªÆôLEDÉÁ˸
|
||
{{"S_CMD_0408"}, SETCODELEN, SCMD_LEDFlashOff}, //¹Ø±ÕLEDÉÁ˸
|
||
{{"S_CMD_VC01"}, SETCODELEN, EnableKeyVoice}, //¿ª°´¼üÒô
|
||
{{"S_CMD_VC00"}, SETCODELEN, DisableKeyVoice}, //¹Ø°´¼üÒô
|
||
{{"C_CMD_QR00"}, SETCODELEN, DisableQRRead},
|
||
{{"C_CMD_QR01"}, SETCODELEN, EnableQRRead},
|
||
{{"ENABLEBARCODE"}, 13, EnOrDisOneDimCode},
|
||
{{"ENABLEKEYBOARD"}, 14, EnOrDisKey},
|
||
{{"INCREASEV+"}, 10, IncreaseVolume},
|
||
{{"DECREASEV-"}, 10, DecreaseVolume},
|
||
{{"PAYENABLE"}, 9, PayCodeEnable},
|
||
{{"DEVICEMOD"}, 9, Fn88ShowDevicemod},
|
||
|
||
};
|
||
|
||
//ɨÂëÃüÁî±í£¬¿É×ÔÐÐÐ޸ĺÍÀ©Õ¹
|
||
const ScanCodeHandle scanCodeCmdTable[] =
|
||
{
|
||
|
||
{{"S_CMD_PLAY"}, SETCODELEN, PlayLockVoice}, //play vpoce
|
||
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇɨÂëÄ£¿éÃüÁעÒâɨÂëÄ£¿éʹÓÃʱ£¬DefaultCfg.scanCodeModeÓ¦ÉèÖÃΪ1£ºÃüÁî ģʽ
|
||
*********************************************************************************/
|
||
{{"S0000030"}, SETCODELEN_MODULE, OutVersion}, //»ñÈ¡°æ±¾
|
||
{{"SU0000FF"}, SETCODELEN_MODULE, UpdateApp}, //¸üй̼þ
|
||
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇ´®¿Úдlicense
|
||
*********************************************************************************/
|
||
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇ´®¿ÚдSNÃüÁî
|
||
*********************************************************************************/
|
||
{{"S0000RSN"}, SETCODELEN_MODULE, ProductGetSN}, //»ñÈ¡SN
|
||
{{"S0000WSN"}, SETCODELEN_MODULE, ProductWriteSN}, //дSN
|
||
|
||
|
||
/*********************************************************************************
|
||
* ÒÔÏÂÊÇɨÂëºÐ×ÓͨÓÃÃüÁopensyssettingº¯Êý¿ªÆôϵͳÉèÖã¬closeº¯Êý»á½«ÉèÖÃֵдÈëflash£¬·ñÔòÔÚramÖÐ
|
||
*********************************************************************************/
|
||
{{"S_CMD_FFFF"}, SETCODELEN, RestoreFactorySetting},
|
||
{{"S_CMD_0301"}, SETCODELEN, SCMD_LedOn}, //°×É«µÆ³£ÁÁÉèÖÃ
|
||
{{"S_CMD_0300"}, SETCODELEN, SCMD_LedOff}, //°×É«µÆÆÕͨÉèÖÃ
|
||
{{"S_CMD_04VL"}, SETCODELEN, ReviseVolume}, //ÐÞ¸ÄÓïÒô´óС
|
||
{{"S_CMD_0409"}, SETCODELEN, SCMD_LEDFlashOn}, //¿ªÆôLEDÉÁ˸
|
||
{{"S_CMD_0408"}, SETCODELEN, SCMD_LEDFlashOff}, //¹Ø±ÕLEDÉÁ˸
|
||
|
||
{{"S_CMD_VC01"}, SETCODELEN, EnableKeyVoice}, //¿ª°´¼üÒô
|
||
{{"S_CMD_VC00"}, SETCODELEN, DisableKeyVoice}, //¹Ø°´¼üÒô
|
||
{{"C_CMD_QR00"}, SETCODELEN, DisableQRRead},
|
||
{{"C_CMD_QR01"}, SETCODELEN, EnableQRRead},
|
||
|
||
{{"Fn89"}, 4, ShowVersion},
|
||
{{"Fn82"}, 4, Fn82RestoreFactorySetting},
|
||
{{"Fnclear2"}, 8, UpdateApp}, //¸üй̼þ
|
||
{{"Fn57"}, 4, EnOrDisOneDimCode},
|
||
{{"Fn59"}, 4, EnOrDisTwoDimCode},
|
||
{{"Fnclear5"}, 8, EnOrDisKey},
|
||
{{"Fn81"}, 4, IncreaseVolume},
|
||
{{"Fn83"}, 4, DecreaseVolume},
|
||
{{"Fn29"}, 4, Fn29ShowSN},
|
||
{{"Fn88"}, 4, Fn88ShowDevicemod},
|
||
{{"Fnclear0"}, 8, FC0RestoreFactorySetting},
|
||
{{"PAYENABLE"}, 9, PayCodeEnable},
|
||
|
||
};
|
||
|
||
const ScanCodeHandle BCmdTable[] =
|
||
{
|
||
{{"CRRAN"}, 5, CmdGetRan},
|
||
};
|
||
|
||
const ScanCodeHandle ACmdTable[] =
|
||
{
|
||
{{"S0000030"}, SETCODELEN_MODULE, OutVersion}, //»ñÈ¡°æ±¾
|
||
{{"Fn89"}, 4, ShowVersion},
|
||
};
|
||
|
||
void ScanCodeCmdHandle(BarData *pCode)
|
||
{
|
||
uint8_t bStatus;
|
||
uint16_t i = 0, TableLen;
|
||
TableLen = sizeof(scanCodeCmdTable) / sizeof(ScanCodeHandle);
|
||
#if SETTINGCODE_MODE_0
|
||
|
||
for(i = 0; i < TableLen; i++)
|
||
{
|
||
if(Memcmp((uint8_t *)scanCodeCmdTable[i].HandleMsg, pCode->bardata, scanCodeCmdTable[i].MsgLen))
|
||
{
|
||
bStatus = scanCodeCmdTable[i].pFunc(pCode);
|
||
SetCodeReport(bStatus); //ÉèÖÃÂëÊä³öÌáʾ
|
||
return;
|
||
}
|
||
}
|
||
|
||
//ÔڹرÕQRÂëʱ£¬ÉèÖÃÂëÈÔ¿ÉÒÔʶ±ð,ÆäËûQRÂëÎÞ·´Ó¦
|
||
if((!gConfgBuf.QR) && (pCode->bartype == QR_Id))
|
||
{
|
||
return;
|
||
}
|
||
|
||
#elif SETTINGCODE_MODE_1
|
||
|
||
//¹Ø±ÕÉèÖÃÂëµÄÌõ¼þÏ£¬½öʶ±ð¿ªÆôÉèÖÃÂë
|
||
if((pCode->datalen == SETCODELEN) && (Memcmp((uint8_t *) "S_CMD_0001", pCode->bardata, SETCODELEN)))
|
||
{
|
||
bStatus = OpenSysSetting(pCode);
|
||
SetCodeReport(bStatus); //ÉèÖÃÂëÊä³öÌáʾ
|
||
return;
|
||
}
|
||
|
||
for(i = 0; i < TableLen; i++)
|
||
{
|
||
if(Memcmp((uint8_t *)scanCodeCmdTable[i].HandleMsg, pCode->bardata, scanCodeCmdTable[i].MsgLen))
|
||
{
|
||
if(gConfgBuf.bSettingCodeFlag)
|
||
{
|
||
bStatus = scanCodeCmdTable[i].pFunc(pCode);
|
||
}
|
||
else
|
||
{
|
||
bStatus = TMC_ERROR;
|
||
}
|
||
SetCodeReport(bStatus); //ÉèÖÃÂëÊä³öÌáʾ
|
||
SetPackType(PACK_TYPEA);
|
||
if(bStatus==TMC_OK)
|
||
{
|
||
SetOutputData((uint8_t *)"OK",2);
|
||
} else {
|
||
SetOutputData((uint8_t *)"ERR",3);
|
||
}
|
||
ReportData(Communication_Id);
|
||
return;
|
||
}
|
||
}
|
||
|
||
//ÔڹرÕQRÂëʱ£¬ÉèÖÃÂëÈÔ¿ÉÒÔʶ±ð,ÆäËûQRÂëÎÞ·´Ó¦
|
||
if((!gConfgBuf.Code128) && (pCode->bartype == Code_128_Id))
|
||
{
|
||
return;
|
||
}
|
||
|
||
#endif
|
||
|
||
//·ÇÉèÖÃÂëÊä³öÌáʾ
|
||
PayCodeReport(pCode);
|
||
}
|
||
|
||
/**
|
||
* @function CommunicationCmdHandle
|
||
* @brief ͨÐÅÃüÁî·Ö·¢´¦Àí£¬Í¨ÐÅÐÒé¿É×ÔÐж¨Òå
|
||
* @return ÎÞ
|
||
*/
|
||
void ACmdHandle(BarData *comdata)
|
||
{
|
||
uint16_t i = 0, TableLen;
|
||
uint8_t status;
|
||
|
||
gFunTrace = 35;
|
||
|
||
TableLen = sizeof(ACmdTable) / sizeof(ScanCodeHandle);
|
||
|
||
for(i = 0; i < TableLen; i++)
|
||
{
|
||
|
||
if(!memcmp((uint8_t *)ACmdTable[i].HandleMsg, comdata->bardata, ACmdTable[i].MsgLen))
|
||
{
|
||
status = ACmdTable[i].pFunc(comdata);
|
||
|
||
switch(status)
|
||
{
|
||
case TMC_OK:
|
||
//ͨÐÅÃüÁî´¦Àí³É¹¦·µ»Ø9000
|
||
//ͨÐÅÃüÁî´¦Àí³É¹¦·µ»ØOK
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData(respSuccess, 2);
|
||
ReportData(comdata->bartype);
|
||
break;
|
||
|
||
case TMC_ERROR:
|
||
//ͨÐÅÃüÁî´¦Àíʧ°Ü·µ»Ø6A89
|
||
//ͨÐÅÃüÁî´¦Àíʧ°Ü·µ»ØERR
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData(respError, 3);
|
||
ReportData(comdata->bartype);
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
// break;
|
||
return;
|
||
}
|
||
}
|
||
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData((uint8_t *)"ILLEGALCMD", 10);
|
||
ReportData(comdata->bartype);
|
||
|
||
}
|
||
|
||
/**
|
||
* @function CommunicationCmdHandle
|
||
* @brief ͨÐÅÃüÁî·Ö·¢´¦Àí£¬Í¨ÐÅÐÒé¿É×ÔÐж¨Òå
|
||
* @return ÎÞ
|
||
*/
|
||
void BCmdHandle(BarData *comdata)
|
||
{
|
||
uint16_t i = 0, TableLen;
|
||
uint8_t status;
|
||
|
||
gFunTrace = 35;
|
||
|
||
TableLen = sizeof(BCmdTable) / sizeof(ScanCodeHandle);
|
||
|
||
for(i = 0; i < TableLen; i++)
|
||
{
|
||
if(!memcmp((uint8_t *)BCmdTable[i].HandleMsg, comdata->bardata, BCmdTable[i].MsgLen))
|
||
{
|
||
status = BCmdTable[i].pFunc(comdata);
|
||
|
||
switch(status)
|
||
{
|
||
case TMC_OK:
|
||
//ͨÐÅÃüÁî´¦Àí³É¹¦·µ»Ø9000
|
||
//ͨÐÅÃüÁî´¦Àí³É¹¦·µ»ØOK
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData(respSuccess, 2);
|
||
ReportData(comdata->bartype);
|
||
break;
|
||
|
||
case TMC_ERROR:
|
||
//ͨÐÅÃüÁî´¦Àíʧ°Ü·µ»Ø6A89
|
||
//ͨÐÅÃüÁî´¦Àíʧ°Ü·µ»ØERR
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData(respError, 3);
|
||
ReportData(comdata->bartype);
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
return;
|
||
}
|
||
}
|
||
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData((uint8_t *)"ILLEGALCMD", 10);
|
||
ReportData(comdata->bartype);
|
||
|
||
}
|
||
|
||
/**
|
||
* @function CommunicationCmdHandle
|
||
* @brief ͨÐÅÃüÁî·Ö·¢´¦Àí£¬Í¨ÐÅÐÒé¿É×ÔÐж¨Òå
|
||
* @return ÎÞ
|
||
*/
|
||
void CCmdHandle(BarData *comdata)
|
||
{
|
||
uint16_t i = 0, TableLen;
|
||
uint8_t status;
|
||
|
||
gFunTrace = 35;
|
||
|
||
uint8_t *p_sn = (uint8_t *) TUSNADDR;
|
||
TableLen = sizeof(CommCmdTable) / sizeof(ScanCodeHandle);
|
||
|
||
for(i = 0; i < TableLen; i++)
|
||
{
|
||
if(!memcmp((uint8_t *)CommCmdTable[i].HandleMsg, comdata->bardata, CommCmdTable[i].MsgLen))
|
||
{
|
||
status = CommCmdTable[i].pFunc(comdata);
|
||
|
||
switch(status)
|
||
{
|
||
case TMC_OK:
|
||
//ͨÐÅÃüÁî´¦Àí³É¹¦·µ»ØOK
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData(respSuccess, 2);
|
||
ReportData(comdata->bartype);
|
||
break;
|
||
|
||
case TMC_ERROR:
|
||
//ͨÐÅÃüÁî´¦Àíʧ°Ü·µ»ØERR
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData(respError, 3);
|
||
ReportData(comdata->bartype);
|
||
break;
|
||
|
||
case SN_EXIT:
|
||
SetOutputData(p_sn + 1, *p_sn);
|
||
ReportData(comdata->bartype);
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
return;
|
||
}
|
||
}
|
||
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData((uint8_t *)"ILLEGALCMD", 10);
|
||
ReportData(comdata->bartype);
|
||
|
||
}
|
||
|
||
/**
|
||
* @function CommunicationCmdHandle
|
||
* @brief ͨÐÅÃüÁî·Ö·¢´¦Àí£¬Í¨ÐÅÐÒé¿É×ÔÐж¨Òå
|
||
* @return ÎÞ
|
||
*/
|
||
void CommunicationCmdHandle(BarData *comdata)
|
||
{
|
||
if(comdata->packType==PACK_TYPEA)
|
||
{
|
||
ACmdHandle(comdata);
|
||
} else if(comdata->packType==PACK_TYPEB)
|
||
{
|
||
BCmdHandle(comdata);
|
||
} else if(comdata->packType==PACK_TYPEC)
|
||
{
|
||
CCmdHandle(comdata);
|
||
} else {
|
||
SetPackType(PACK_TYPEA);
|
||
SetOutputData((uint8_t *)"ILLEGALCMD", 10);
|
||
ReportData(comdata->bartype);
|
||
}
|
||
|
||
}
|
||
|
||
/**
|
||
* @function SettingCodeBatch
|
||
* @brief Åú´¦ÀíÉèÖÃÂë
|
||
* @param[in] pCode ½âÂëÊý¾Ý
|
||
* @return
|
||
*/
|
||
uint8_t SettingCodeBatch(BarData *pCode)
|
||
{
|
||
BarData setcode;
|
||
uint16_t i = 0, j = 0, batchcodelen = 0;
|
||
uint8_t setcodebuf[MAX_BATCH_SETCODE_LEN];
|
||
|
||
gFunTrace = 37;
|
||
|
||
//УÑéÊý¾Ý¸ñʽ
|
||
if(!Memcmp((uint8_t *)"S_CMD_0001;", pCode->bardata, SETCODELEN + 1))
|
||
{
|
||
return FALSE;
|
||
}
|
||
|
||
if(!Memcmp((uint8_t *)"S_CMD_0000;", &pCode->bardata[pCode->datalen - SETCODELEN - 1], SETCODELEN + 1))
|
||
{
|
||
return FALSE;
|
||
}
|
||
|
||
Memcpy(setcodebuf, pCode->bardata, pCode->datalen);
|
||
setcode.bartype = pCode->bartype;
|
||
batchcodelen = pCode->datalen;
|
||
|
||
while(i < batchcodelen)
|
||
{
|
||
if(setcodebuf[i] == ';')
|
||
{
|
||
setcode.bardata = &setcodebuf[j];
|
||
setcode.datalen = i - j;
|
||
setcode.barinfo = NULL;
|
||
ScanCodeCmdHandle(&setcode);
|
||
j = i + 1;
|
||
}
|
||
|
||
i++;
|
||
}
|
||
|
||
return TRUE;
|
||
}
|
||
|
||
/**
|
||
* @function DisableKeyboard
|
||
* @brief
|
||
* @param[in] pCode
|
||
* @return
|
||
*/
|
||
uint8_t DisableKeyboard(BarData *pCode)
|
||
{
|
||
gConfgBuf.statusKey = OFF;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function EnableKeyboard
|
||
* @brief
|
||
* @param[in] pCode
|
||
* @return
|
||
*/
|
||
uint8_t EnableKeyboard(BarData *pCode)
|
||
{
|
||
gConfgBuf.statusKey = ON;
|
||
return UpdateCfg();
|
||
}
|
||
|
||
/**
|
||
* @function EnableOneDimRead
|
||
* @brief
|
||
*/
|
||
uint8_t EnableOneDimRead(BarData *pCode)
|
||
{
|
||
|
||
gConfgBuf.EAN13 = ON;
|
||
gConfgBuf.EAN8 = ON;
|
||
gConfgBuf.UPCA = ON;
|
||
gConfgBuf.UPCE0 = ON;
|
||
gConfgBuf.UPCE1 = ON;
|
||
gConfgBuf.Code128 = ON;
|
||
gConfgBuf.CodeBar = ON;
|
||
gConfgBuf.Code39 = ON;
|
||
gConfgBuf.Code93 = ON;
|
||
gConfgBuf.Interleaved25 = ON;
|
||
gConfgBuf.DM = ON;
|
||
gConfgBuf.PDF417 = ON;
|
||
gConfgBuf.Matrix25 = ON;
|
||
gConfgBuf.Industrial_25 = ON;
|
||
gConfgBuf.IATA25 = ON;
|
||
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableOneDimRead(BarData *pCode)
|
||
{
|
||
|
||
gConfgBuf.EAN13 = OFF;
|
||
gConfgBuf.EAN8 = OFF;
|
||
gConfgBuf.UPCA = OFF;
|
||
gConfgBuf.UPCE0 = OFF;
|
||
gConfgBuf.UPCE1 = OFF;
|
||
gConfgBuf.Code128 = OFF;
|
||
gConfgBuf.CodeBar = OFF;
|
||
gConfgBuf.Code39 = OFF;
|
||
gConfgBuf.Code93 = OFF;
|
||
gConfgBuf.Interleaved25 = OFF;
|
||
gConfgBuf.DM = OFF;
|
||
gConfgBuf.PDF417 = OFF;
|
||
gConfgBuf.Matrix25 = OFF;
|
||
gConfgBuf.Industrial_25 = OFF;
|
||
gConfgBuf.IATA25 = OFF;
|
||
|
||
return UpdateALCfg();
|
||
}
|
||
|
||
uint8_t DisableOneDimReadNoUpd(BarData *pCode)
|
||
{
|
||
|
||
gConfgBuf.EAN13 = OFF;
|
||
gConfgBuf.EAN8 = OFF;
|
||
gConfgBuf.UPCA = OFF;
|
||
gConfgBuf.UPCE0 = OFF;
|
||
gConfgBuf.UPCE1 = OFF;
|
||
gConfgBuf.Code128 = OFF;
|
||
gConfgBuf.CodeBar = OFF;
|
||
gConfgBuf.Code39 = OFF;
|
||
gConfgBuf.Code93 = OFF;
|
||
gConfgBuf.Interleaved25 = OFF;
|
||
gConfgBuf.DM = OFF;
|
||
gConfgBuf.PDF417 = OFF;
|
||
gConfgBuf.Matrix25 = OFF;
|
||
gConfgBuf.Industrial_25 = OFF;
|
||
gConfgBuf.IATA25 = OFF;
|
||
|
||
// return UpdateALCfg();
|
||
return TMC_OK;
|
||
}
|
||
|
||
uint8_t EnableOneDimReadNoUpd(BarData *pCode)
|
||
{
|
||
|
||
gConfgBuf.EAN13 = ON;
|
||
gConfgBuf.EAN8 = ON;
|
||
gConfgBuf.UPCA = ON;
|
||
gConfgBuf.UPCE0 = ON;
|
||
gConfgBuf.UPCE1 = ON;
|
||
gConfgBuf.Code128 = ON;
|
||
gConfgBuf.CodeBar = ON;
|
||
gConfgBuf.Code39 = ON;
|
||
gConfgBuf.Code93 = ON;
|
||
gConfgBuf.Interleaved25 = ON;
|
||
gConfgBuf.DM = ON;
|
||
gConfgBuf.PDF417 = ON;
|
||
gConfgBuf.Matrix25 = ON;
|
||
gConfgBuf.Industrial_25 = ON;
|
||
gConfgBuf.IATA25 = ON;
|
||
|
||
return TMC_OK;
|
||
}
|