Merge branch 'master-develop' of gitee.com:shenzhen-jiuyilian/ipc into master-develop

This commit is contained in:
Fancy code 2024-05-22 13:40:57 +08:00
commit cf45a7d007
5 changed files with 9 additions and 7 deletions

View File

@ -92,7 +92,7 @@ ssize_t McuDevice::WriteData(const void *buff, const size_t buffLength, std::sha
*/
mMutex.lock();
length = IUartSend(mUartDevice, buff, buffLength);
PrintHexadecimalData(buff, buffLength, "Mcu urat write:");
// PrintHexadecimalData(buff, buffLength, "Mcu urat write:");
mMutex.unlock();
return length;
}
@ -106,7 +106,7 @@ ssize_t McuDevice::WriteData(const void *buff, const size_t buffLength, std::sha
mMutex.lock();
AddMcuAsk(ask);
length = IUartSend(mUartDevice, buff, buffLength);
PrintHexadecimalData(buff, buffLength, "AddMcuAsk, Mcu urat write:");
// PrintHexadecimalData(buff, buffLength, "AddMcuAsk, Mcu urat write:");
mMutex.unlock();
if (WRITE_ERROR == length) {
LogError("Uart send failed, something wrong happened.\n");

View File

@ -43,7 +43,7 @@ void ConfigBaseImpl::OpenConfigFile(void)
}
}
else {
LogInfo("Config file doesn't exist.\n");
LogInfo("Config file doesn't exist.mFileName = %s\n", mFileName.c_str());
/* Write out the new configuration. */
if (!config_write_file(&cfg, mFileName.c_str())) {
fprintf(stderr, "Error while writing file.\n");

View File

@ -152,8 +152,10 @@ void ProtocolHandle::MakeNoUserDataPacket(const std::shared_ptr<VProtocolParam>
packet.mCheckCode = BigEndianConversion(packet.mCheckCode);
memcpy(mProtocolData + KEY_HEAD_LENGTH, &packet.mCheckCode, CHECK_CODE_LENGTH);
mProtocolDataLength = packetLength;
if (param->mCommand != ASK_FEED_WATCH_DOG) {
ProtocolHandle::PrintHexadecimalData(
mProtocolData, mProtocolDataLength - CHECK_CODE_LENGTH, "MakeNoUserDataPacket:");
}
}
void ProtocolHandle::MakeAskIpcMissionPacket(const std::shared_ptr<VProtocolParam> &param)
{
@ -351,7 +353,6 @@ StatusCode ProtocolHandle::GetDataLength(const void *keyHead, const size_t &head
LogError("key head buf error.\n");
return CreateStatusCode(STATUS_CODE_NOT_OK);
}
ProtocolHandle::PrintHexadecimalData(keyHead, headLength);
unsigned short headNum = PROTOCOL_HEAD;
char byteOrder = ProtocolHandle::GetByteOrder();
if (ORDER_LITTLE_ENDIAN == byteOrder) {

View File

@ -64,6 +64,6 @@ unsigned short calculate_check_sum(const unsigned char *pData, unsigned short le
CRCHi = CRCLo ^ chCRCHi[uIndex];
CRCLo = chCRCLo[uIndex];
}
printf("CRCHi = 0x%x, CRCLo = 0x%x\n", CRCHi, CRCLo);
// printf("CRCHi = 0x%x, CRCLo = 0x%x\n", CRCHi, CRCLo);
return (CRCHi << 8 | CRCLo);
}

View File

@ -223,6 +223,7 @@ const StatusCode UartDeviceImpl::SetConfig(void)
options.c_oflag &= ~OPOST;
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
// options.c_lflag &= ~(ISIG | ICANON);
options.c_iflag &= ~ICRNL;
// set wait time
options.c_cc[VTIME] = 1;
options.c_cc[VMIN] = 1;