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 <EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
void SetPackType(uint8_t type)
|
|||
|
|
{
|
|||
|
|
gPackType = type;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function SetSysPackType
|
|||
|
|
* @brief set comunication pack type as sys pack type
|
|||
|
|
* @return <EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
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 <EFBFBD><EFBFBD>16<EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>16<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>Сд
|
|||
|
|
* @param[in] pSrc Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @param[in] pDst <EFBFBD><EFBFBD><EFBFBD>Ž<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @param[in] pLen <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @return ת<EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD>16<EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @param[in] pSrc Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @param[in] pLen <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @return ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD><EFBFBD><EFBFBD>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t UpdateALCfg(void)
|
|||
|
|
{
|
|||
|
|
uint8_t bStatus;
|
|||
|
|
|
|||
|
|
gFunTrace = 29;
|
|||
|
|
|
|||
|
|
bStatus = UpdateCfg();
|
|||
|
|
|
|||
|
|
if(bStatus == TMC_OK)
|
|||
|
|
{
|
|||
|
|
AppScanCodeInit();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
gFunTrace = 30;
|
|||
|
|
|
|||
|
|
return bStatus;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function UpdateApp
|
|||
|
|
* @brief дbootloader<EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>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;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>TMC_OK<4F><4B>˵<EFBFBD><CBB5>дBL<42><4C>ҳ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD>и<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BL״̬
|
|||
|
|
if(status == TMC_OK)
|
|||
|
|
{
|
|||
|
|
ResetChip(1);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD>汾<EFBFBD><E6B1BE>Ϣ
|
|||
|
|
uint8_t OutVersion(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
SetPackType(PACK_TYPEA);
|
|||
|
|
|
|||
|
|
SetOutputData((uint8_t *)"S0000030", 8);
|
|||
|
|
|
|||
|
|
SetOutputData((uint8_t *)CVERSION, VERSIONLEN);
|
|||
|
|
ReportData(pCode->bartype);
|
|||
|
|
|
|||
|
|
return TMC_NONE;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t RestoreFactorySetting(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint8_t pretype = gConfgBuf.comunitationType;
|
|||
|
|
uint8_t status;
|
|||
|
|
|
|||
|
|
gFunTrace = 27;
|
|||
|
|
|
|||
|
|
status = RestoreCfg();
|
|||
|
|
gFunTrace = 28;
|
|||
|
|
AppScanCodeInit();
|
|||
|
|
//<2F><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
|
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>Žӿ<C5BD>û<EFBFBD>б仯<D0B1><E4BBAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>λ
|
|||
|
|
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();
|
|||
|
|
//<2F><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
|
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>Žӿ<C5BD>û<EFBFBD>б仯<D0B1><E4BBAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>λ
|
|||
|
|
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();
|
|||
|
|
//<2F><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
|
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>Žӿ<C5BD>û<EFBFBD>б仯<D0B1><E4BBAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>λ
|
|||
|
|
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();
|
|||
|
|
//<2F><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
|
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>Žӿ<C5BD>û<EFBFBD>б仯<D0B1><E4BBAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>λ
|
|||
|
|
if(pretype != gConfgBuf.comunitationType)
|
|||
|
|
{
|
|||
|
|
ResetChip(2);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SetOutputData((uint8_t *)"Fn82",4);
|
|||
|
|
|
|||
|
|
return status;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>DefaultCfg.scanCodeModeӦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ģʽ
|
|||
|
|
*********************************************************************************/
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ģʽ<C4A3>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8>(<28>Ƿ<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ<C4A3><CABD>
|
|||
|
|
uint8_t ScanOn(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
gCmdStartFlag = TRUE;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>timer
|
|||
|
|
if(gConfgBuf.scanCodeMode == CMDTIMEMODE)
|
|||
|
|
{
|
|||
|
|
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
TimerHSIClockCount(TIM5, START_TIMER);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SetOutputData((uint8_t *)"SR030301",8);
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ģʽ<C4A3>£<EFBFBD><C2A3>ر<EFBFBD>ɨ<EFBFBD><C9A8>
|
|||
|
|
uint8_t ScanOff(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
gCmdStartFlag = FALSE;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>timer
|
|||
|
|
|
|||
|
|
if(gConfgBuf.scanCodeMode == CMDTIMEMODE)
|
|||
|
|
{
|
|||
|
|
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD>ر<EFBFBD>
|
|||
|
|
TimerHSIClockCount(TIM5, STOP_TIMER);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SetOutputData((uint8_t *)"SR030300",8);
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t StopSleep(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#if SETTINGCODE_MODE_0
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>opensyssetting<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>close<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ὣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵд<EFBFBD><EFBFBD>flash<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ram<EFBFBD><EFBFBD>
|
|||
|
|
*********************************************************************************/
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>뿪<EFBFBD><EBBFAA>
|
|||
|
|
/**
|
|||
|
|
* @function OpenSysSetting
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
|||
|
|
*/
|
|||
|
|
uint8_t OpenSysSetting(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
g_SysModal = SYSMODE_OPEN;
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function CloseSysSetting
|
|||
|
|
* @brief <EFBFBD>ر<EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD><EFBFBD>λ
|
|||
|
|
*/
|
|||
|
|
uint8_t CloseSysSetting(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint8_t pretype = gConfgBuf.comunitationType, status;
|
|||
|
|
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
g_SysModal = SYSMODE_CLOSE;
|
|||
|
|
status = UpdateCfg(); //<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
if(status == TMC_OK)
|
|||
|
|
{
|
|||
|
|
AppScanCodeInit();
|
|||
|
|
AppScanModeInit();
|
|||
|
|
//<2F><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
|
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>Žӿ<C5BD>û<EFBFBD>б仯<D0B1><E4BBAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>λ
|
|||
|
|
if(pretype != gConfgBuf.comunitationType)
|
|||
|
|
{
|
|||
|
|
ResetChip(3);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_LedOn(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.ledStatus = ON;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_LedOff(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.ledStatus = OFF;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ر<EFBFBD>LED<45><44>˸
|
|||
|
|
uint8_t SCMD_LEDFlashOff(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.ledFlash = OFF;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>LED<45><44>˸<EFBFBD><CBB8>ʾ
|
|||
|
|
uint8_t SCMD_LEDFlashOn(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.ledFlash = ON;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_OpenAllVoice(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.voiceStatus = ON;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_OpenVoice1(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.OpenvoiceChangeFlag = OFF;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD>л<EFBFBD>"<22><>ӭʹ<D3AD><CAB9>"
|
|||
|
|
uint8_t SCMD_OpenVoice2(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.OpenvoiceChangeFlag = ON;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ر<EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
|||
|
|
uint8_t SCMD_ClosePayVoice(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.voiceStatus = VOICE_NO_PAY;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_OpenDingdongVoice(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.voiceScanFinish = VOICE_FINISH_DINGDONG;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD>ʼ<EFBFBD><CABC>ӡ
|
|||
|
|
uint8_t SCMD_OpenPrintVoice(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.voiceScanFinish = VOICE_FINISH_PRINT;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD>ɹ<EFBFBD>
|
|||
|
|
uint8_t SCMD_ScanSuccessVoice(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.voiceScanFinish = VOICE_SCAN_SUCCESS;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><EFBFBD><F2BFAAB7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_OpenBuzzer(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.buzzerStatus = ON;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>رշ<D8B1><D5B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_CloseBuzzer(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.buzzerStatus = OFF;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function ScanToneFrequency
|
|||
|
|
* @brief <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>ռ<EFBFBD>ձ<EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ģʽ
|
|||
|
|
uint8_t CmdMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.scanCodeMode = CMDMODE;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ʱģʽ
|
|||
|
|
uint8_t CmdTimeMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.scanCodeMode = CMDTIMEMODE;
|
|||
|
|
gConfgBuf.comunitationType = USBDEVTYPE_VSP;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>Զ<EFBFBD>ģʽ
|
|||
|
|
uint8_t AutoMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.scanCodeMode = AUTOMODE;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ƶ<EFBFBD><C6B6><EFBFBD>Ӧģʽ
|
|||
|
|
uint8_t SensorMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.scanCodeMode = SENSORMODE;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ģʽ
|
|||
|
|
uint8_t SingleScanMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.scanCodeMode = SINGLEMODE;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function ReviseCmdTimeMode
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʱ<EFBFBD>䣬<EFBFBD><EFBFBD>С1ms<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>65535ms
|
|||
|
|
*/
|
|||
|
|
uint8_t ReviseCmdTimeMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint16_t time;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>趨
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
uint8_t ReviseSameCodeInterval(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint16_t scantime;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>趨
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
uint8_t ReviseDifferentCodeInterval(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint16_t scantime;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>趨
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/*<2A>ļ<DEB8><C4BC><EFBFBD><EFBFBD><EFBFBD>ʱ*/
|
|||
|
|
uint8_t ReviseKeyInterval(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint8_t timedelay;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD>
|
|||
|
|
if(pCode->datalen > (SETCODELEN + 2))
|
|||
|
|
{
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʱ<EFBFBD>趨
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*<2A><EFBFBD><DEB8><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>*/
|
|||
|
|
uint8_t RevisePollSpeed(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint8_t speed;
|
|||
|
|
|
|||
|
|
//<2F>볤<EFBFBD>ж<EFBFBD>
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>GBK
|
|||
|
|
*/
|
|||
|
|
uint8_t DataInGBK(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.inputCodeType = GBK;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DataInUTF8
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>UTF8
|
|||
|
|
*/
|
|||
|
|
uint8_t DataInUTF8(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.inputCodeType = UTF8;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DataInAuto
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>ʶ<EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
uint8_t DataInAuto(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.inputCodeType = AUTO;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DataOutGBK
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>GBK
|
|||
|
|
*/
|
|||
|
|
uint8_t DataOutGBK(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.outputCodeType = GBK;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DataOutUnicode
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Unicode
|
|||
|
|
*/
|
|||
|
|
uint8_t DataOutUnicode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.outputCodeType = UNICODE;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DataOutUTF8
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>UTF8
|
|||
|
|
*/
|
|||
|
|
uint8_t DataOutUTF8(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.outputCodeType = UTF8;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function EnableBillMode
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊģʽ
|
|||
|
|
*/
|
|||
|
|
uint8_t EnableBillMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
if(g_SysModal == SYSMODE_OPEN)
|
|||
|
|
{
|
|||
|
|
gConfgBuf.billModeStatus = ON;
|
|||
|
|
return TMC_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DisableBillMode
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊģʽ
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD>ֹʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//*************************<2A><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>*************************//
|
|||
|
|
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
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>opensyssetting<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>close<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ὣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵд<EFBFBD><EFBFBD>flash<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ram<EFBFBD><EFBFBD>
|
|||
|
|
*********************************************************************************/
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>뿪<EFBFBD><EBBFAA>
|
|||
|
|
/**
|
|||
|
|
* @function OpenSysSetting
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
uint8_t OpenSysSetting(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.bSettingCodeFlag = ON;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function CloseSysSetting
|
|||
|
|
* @brief <EFBFBD>ر<EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ر<EFBFBD>LED<45><44>˸
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>LED<45><44>˸<EFBFBD><CBB8>ʾ
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_OpenAllVoice(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.voiceStatus = ON;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_OpenVoice1(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.OpenvoiceChangeFlag = OFF;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD>л<EFBFBD>"<22><>ӭʹ<D3AD><CAB9>"
|
|||
|
|
uint8_t SCMD_OpenVoice2(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.OpenvoiceChangeFlag = ON;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ر<EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
|||
|
|
uint8_t SCMD_ClosePayVoice(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.voiceStatus = VOICE_NO_PAY;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
//<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_OpenDingdongVoice(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.voiceScanFinish = VOICE_FINISH_DINGDONG;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD>ʼ<EFBFBD><CABC>ӡ
|
|||
|
|
uint8_t SCMD_OpenPrintVoice(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.voiceScanFinish = VOICE_FINISH_PRINT;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD>ɹ<EFBFBD>
|
|||
|
|
uint8_t SCMD_ScanSuccessVoice(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.voiceScanFinish = VOICE_SCAN_SUCCESS;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><EFBFBD><F2BFAAB7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_OpenBuzzer(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.buzzerStatus = ON;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>رշ<D8B1><D5B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint8_t SCMD_CloseBuzzer(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.buzzerStatus = OFF;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function ScanToneFrequency
|
|||
|
|
* @brief <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>ռ<EFBFBD>ձ<EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ģʽ
|
|||
|
|
uint8_t CmdMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.scanCodeMode = CMDMODE;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ʱģʽ
|
|||
|
|
uint8_t CmdTimeMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.scanCodeMode = CMDTIMEMODE;
|
|||
|
|
gConfgBuf.comunitationType = USBDEVTYPE_VSP;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>Զ<EFBFBD>ģʽ
|
|||
|
|
uint8_t AutoMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.scanCodeMode = AUTOMODE;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ƶ<EFBFBD><C6B6><EFBFBD>Ӧģʽ
|
|||
|
|
uint8_t SensorMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.scanCodeMode = SENSORMODE;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ģʽ
|
|||
|
|
uint8_t SingleScanMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.scanCodeMode = SINGLEMODE;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function ReviseCmdTimeMode
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʱ<EFBFBD>䣬<EFBFBD><EFBFBD>С1ms<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>65535ms
|
|||
|
|
*/
|
|||
|
|
uint8_t ReviseCmdTimeMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint16_t time;
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>趨
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
uint8_t ReviseSameCodeInterval(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint16_t scantime;
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>趨
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
uint8_t ReviseDifferentCodeInterval(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint16_t scantime;
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>趨
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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<53><42>ʼ<EFBFBD><CABC>
|
|||
|
|
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<53><42>ʼ<EFBFBD><CABC>
|
|||
|
|
AppUSBInit(gConfgBuf.comunitationType);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return bStatus;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*<2A>ļ<DEB8><C4BC><EFBFBD><EFBFBD><EFBFBD>ʱ*/
|
|||
|
|
uint8_t ReviseKeyInterval(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint8_t timedelay;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD>
|
|||
|
|
if(pCode->datalen > (SETCODELEN + 2))
|
|||
|
|
{
|
|||
|
|
return TMC_ERROR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʱ<EFBFBD>趨
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*<2A><EFBFBD><DEB8><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>*/
|
|||
|
|
uint8_t RevisePollSpeed(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint8_t speed;
|
|||
|
|
|
|||
|
|
//<2F>볤<EFBFBD>ж<EFBFBD>
|
|||
|
|
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<53><42>ʼ<EFBFBD><CABC>
|
|||
|
|
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<53><42>ʼ<EFBFBD><CABC>
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>GBK
|
|||
|
|
*/
|
|||
|
|
uint8_t DataInGBK(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.inputCodeType = GBK;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DataInUTF8
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>UTF8
|
|||
|
|
*/
|
|||
|
|
uint8_t DataInUTF8(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.inputCodeType = UTF8;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DataInAuto
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>ʶ<EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
uint8_t DataInAuto(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.inputCodeType = AUTO;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DataOutGBK
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>GBK
|
|||
|
|
*/
|
|||
|
|
uint8_t DataOutGBK(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.outputCodeType = GBK;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DataOutUnicode
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Unicode
|
|||
|
|
*/
|
|||
|
|
uint8_t DataOutUnicode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.outputCodeType = UNICODE;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DataOutUTF8
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>UTF8
|
|||
|
|
*/
|
|||
|
|
uint8_t DataOutUTF8(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.outputCodeType = UTF8;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function EnableBillMode
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊģʽ
|
|||
|
|
*/
|
|||
|
|
uint8_t EnableBillMode(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
Memcpy((uint8_t *) &gConfgBuf, (uint8_t *) gCurrentSysCfg, sizeof(CfgSetting));
|
|||
|
|
gConfgBuf.billModeStatus = ON;
|
|||
|
|
return UpdateCfg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function DisableBillMode
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊģʽ
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD>ֹʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//*************************<2A><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>*************************//
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дSN<EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD>ǻ<EFBFBD>ȡSN<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>SN<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>SN<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SN<EFBFBD><EFBFBD><EFBFBD>ṩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>SN<EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*********************************************************************************/
|
|||
|
|
|
|||
|
|
//<2F><>ȡSN
|
|||
|
|
uint8_t ProductGetSN(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint8_t *p_sn = (uint8_t *) TUSNADDR;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>SNֵ<4E><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
|
|||
|
|
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;//<2F>ó<EFBFBD><C3B3>Ȱ<EFBFBD><C8B0><EFBFBD>SN<53>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>SN
|
|||
|
|
uint8_t OutputSN(BarData *pCode)
|
|||
|
|
{
|
|||
|
|
uint8_t *p_sn = (uint8_t *) TUSNADDR;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>SNֵ<4E><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>"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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>˿ڸ<CBBF><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>϶˿<CFB6><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2B4AE>
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>˿ڸ<CBBF><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>϶˿<CFB6><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2B4AE>
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>˿ڸ<CBBF><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>϶˿<CFB6><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2B4AE>
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ȡоƬ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);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//д<><D0B4>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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ȡ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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>֤License<73>Ƿ<EFBFBD><C7B7><EFBFBD>Ч
|
|||
|
|
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);
|
|||
|
|
|
|||
|
|
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*********************************************************************************/
|
|||
|
|
const ScanCodeHandle CommCmdTable[] =
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
{{"S_CMD_PLAY"}, SETCODELEN, PlayLockVoice}, //play vpoce
|
|||
|
|
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>DefaultCfg.scanCodeModeӦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ģʽ
|
|||
|
|
*********************************************************************************/
|
|||
|
|
{{"S0000030"}, SETCODELEN_MODULE, OutVersion}, //<2F><>ȡ<EFBFBD>汾
|
|||
|
|
{{"SU0000FF"}, SETCODELEN_MODULE, UpdateApp}, //<2F><><EFBFBD>¹̼<C2B9>
|
|||
|
|
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD><EFBFBD><EFBFBD>дSN<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*********************************************************************************/
|
|||
|
|
{{"S0000RSN"}, SETCODELEN_MODULE, ProductGetSN}, //<2F><>ȡSN
|
|||
|
|
{{"S0000WSN"}, SETCODELEN_MODULE, ProductWriteSN}, //дSN
|
|||
|
|
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>opensyssetting<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>close<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ὣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵд<EFBFBD><EFBFBD>flash<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ram<EFBFBD><EFBFBD>
|
|||
|
|
*********************************************************************************/
|
|||
|
|
{{"S_CMD_FFFF"}, SETCODELEN, RestoreFactorySetting},
|
|||
|
|
{{"S_CMD_0301"}, SETCODELEN, SCMD_LedOn}, //<2F><>ɫ<EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{{"S_CMD_0300"}, SETCODELEN, SCMD_LedOff}, //<2F><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
|
|||
|
|
{{"S_CMD_04VL"}, SETCODELEN, ReviseVolume}, //<2F><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|||
|
|
{{"S_CMD_0409"}, SETCODELEN, SCMD_LEDFlashOn}, //<2F><><EFBFBD><EFBFBD>LED<45><44>˸
|
|||
|
|
{{"S_CMD_0408"}, SETCODELEN, SCMD_LEDFlashOff}, //<2F>ر<EFBFBD>LED<45><44>˸
|
|||
|
|
{{"S_CMD_VC01"}, SETCODELEN, EnableKeyVoice}, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{{"S_CMD_VC00"}, SETCODELEN, DisableKeyVoice}, //<2F>ذ<EFBFBD><D8B0><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{{"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},
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<DEB8><C4BA><EFBFBD>չ
|
|||
|
|
const ScanCodeHandle scanCodeCmdTable[] =
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
{{"S_CMD_PLAY"}, SETCODELEN, PlayLockVoice}, //play vpoce
|
|||
|
|
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>DefaultCfg.scanCodeModeӦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ģʽ
|
|||
|
|
*********************************************************************************/
|
|||
|
|
{{"S0000030"}, SETCODELEN_MODULE, OutVersion}, //<2F><>ȡ<EFBFBD>汾
|
|||
|
|
{{"SU0000FF"}, SETCODELEN_MODULE, UpdateApp}, //<2F><><EFBFBD>¹̼<C2B9>
|
|||
|
|
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD><EFBFBD><EFBFBD>дlicense
|
|||
|
|
*********************************************************************************/
|
|||
|
|
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD><EFBFBD><EFBFBD>дSN<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
*********************************************************************************/
|
|||
|
|
{{"S0000RSN"}, SETCODELEN_MODULE, ProductGetSN}, //<2F><>ȡSN
|
|||
|
|
{{"S0000WSN"}, SETCODELEN_MODULE, ProductWriteSN}, //дSN
|
|||
|
|
|
|||
|
|
|
|||
|
|
/*********************************************************************************
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>opensyssetting<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>close<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ὣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵд<EFBFBD><EFBFBD>flash<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ram<EFBFBD><EFBFBD>
|
|||
|
|
*********************************************************************************/
|
|||
|
|
{{"S_CMD_FFFF"}, SETCODELEN, RestoreFactorySetting},
|
|||
|
|
{{"S_CMD_0301"}, SETCODELEN, SCMD_LedOn}, //<2F><>ɫ<EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{{"S_CMD_0300"}, SETCODELEN, SCMD_LedOff}, //<2F><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
|
|||
|
|
{{"S_CMD_04VL"}, SETCODELEN, ReviseVolume}, //<2F><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|||
|
|
{{"S_CMD_0409"}, SETCODELEN, SCMD_LEDFlashOn}, //<2F><><EFBFBD><EFBFBD>LED<45><44>˸
|
|||
|
|
{{"S_CMD_0408"}, SETCODELEN, SCMD_LEDFlashOff}, //<2F>ر<EFBFBD>LED<45><44>˸
|
|||
|
|
|
|||
|
|
{{"S_CMD_VC01"}, SETCODELEN, EnableKeyVoice}, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{{"S_CMD_VC00"}, SETCODELEN, DisableKeyVoice}, //<2F>ذ<EFBFBD><D8B0><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{{"C_CMD_QR00"}, SETCODELEN, DisableQRRead},
|
|||
|
|
{{"C_CMD_QR01"}, SETCODELEN, EnableQRRead},
|
|||
|
|
|
|||
|
|
{{"Fn89"}, 4, ShowVersion},
|
|||
|
|
{{"Fn82"}, 4, Fn82RestoreFactorySetting},
|
|||
|
|
{{"Fnclear2"}, 8, UpdateApp}, //<2F><><EFBFBD>¹̼<C2B9>
|
|||
|
|
{{"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}, //<2F><>ȡ<EFBFBD>汾
|
|||
|
|
{{"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); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ڹر<DAB9>QR<51><52>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD>ʶ<EFBFBD><CAB6>,<2C><><EFBFBD><EFBFBD>QR<51><52><EFBFBD><EFBFBD>Ӧ
|
|||
|
|
if((!gConfgBuf.QR) && (pCode->bartype == QR_Id))
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#elif SETTINGCODE_MODE_1
|
|||
|
|
|
|||
|
|
//<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if((pCode->datalen == SETCODELEN) && (Memcmp((uint8_t *) "S_CMD_0001", pCode->bardata, SETCODELEN)))
|
|||
|
|
{
|
|||
|
|
bStatus = OpenSysSetting(pCode);
|
|||
|
|
SetCodeReport(bStatus); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
|
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); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
|
SetPackType(PACK_TYPEA);
|
|||
|
|
if(bStatus==TMC_OK)
|
|||
|
|
{
|
|||
|
|
SetOutputData((uint8_t *)"OK",2);
|
|||
|
|
} else {
|
|||
|
|
SetOutputData((uint8_t *)"ERR",3);
|
|||
|
|
}
|
|||
|
|
ReportData(Communication_Id);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ڹر<DAB9>QR<51><52>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD>ʶ<EFBFBD><CAB6>,<2C><><EFBFBD><EFBFBD>QR<51><52><EFBFBD><EFBFBD>Ӧ
|
|||
|
|
if((!gConfgBuf.Code128) && (pCode->bartype == Code_128_Id))
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
|
PayCodeReport(pCode);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @function CommunicationCmdHandle
|
|||
|
|
* @brief ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @return <EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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:
|
|||
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>9000
|
|||
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>OK
|
|||
|
|
SetPackType(PACK_TYPEA);
|
|||
|
|
SetOutputData(respSuccess, 2);
|
|||
|
|
ReportData(comdata->bartype);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case TMC_ERROR:
|
|||
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6>ʧ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>6A89
|
|||
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6>ʧ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>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 ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @return <EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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:
|
|||
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>9000
|
|||
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>OK
|
|||
|
|
SetPackType(PACK_TYPEA);
|
|||
|
|
SetOutputData(respSuccess, 2);
|
|||
|
|
ReportData(comdata->bartype);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case TMC_ERROR:
|
|||
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6>ʧ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>6A89
|
|||
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6>ʧ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>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 ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @return <EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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:
|
|||
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>OK
|
|||
|
|
SetPackType(PACK_TYPEA);
|
|||
|
|
SetOutputData(respSuccess, 2);
|
|||
|
|
ReportData(comdata->bartype);
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case TMC_ERROR:
|
|||
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6>ʧ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>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 ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @return <EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @param[in] pCode <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @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;
|
|||
|
|
|
|||
|
|
//У<><D0A3><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD>ʽ
|
|||
|
|
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;
|
|||
|
|
}
|