mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-19 09:36:05 -04:00
@@ -463,6 +463,14 @@ void DistributedInputSinkTransport::HandleData(int32_t sessionId, const std::str
|
||||
}
|
||||
|
||||
nlohmann::json recMsg = nlohmann::json::parse(message, nullptr, false);
|
||||
if (recMsg.is_discarded()) {
|
||||
DHLOGE("recMsg parse failed!");
|
||||
return;
|
||||
}
|
||||
if (!IsUInt32(recMsg, DINPUT_SOFTBUS_KEY_CMD_TYPE)) {
|
||||
DHLOGE("softbus cmd key is invalid");
|
||||
return;
|
||||
}
|
||||
uint32_t cmdType = recMsg[DINPUT_SOFTBUS_KEY_CMD_TYPE];
|
||||
auto iter = memberFuncMap_.find(cmdType);
|
||||
if (iter == memberFuncMap_.end()) {
|
||||
|
||||
@@ -1470,6 +1470,14 @@ void DistributedInputSourceTransport::HandleData(int32_t sessionId, const std::s
|
||||
}
|
||||
|
||||
nlohmann::json recMsg = nlohmann::json::parse(message, nullptr, false);
|
||||
if (recMsg.is_discarded()) {
|
||||
DHLOGE("recMsg parse failed!");
|
||||
return;
|
||||
}
|
||||
if (!IsUInt32(recMsg, DINPUT_SOFTBUS_KEY_CMD_TYPE)) {
|
||||
DHLOGE("softbus cmd key is invalid");
|
||||
return;
|
||||
}
|
||||
uint32_t cmdType = recMsg[DINPUT_SOFTBUS_KEY_CMD_TYPE];
|
||||
auto iter = memberFuncMap_.find(cmdType);
|
||||
if (iter == memberFuncMap_.end()) {
|
||||
|
||||
@@ -412,6 +412,14 @@ void DistributedInputTransportBase::HandleSession(int32_t sessionId, const std::
|
||||
return;
|
||||
}
|
||||
nlohmann::json recMsg = nlohmann::json::parse(message, nullptr, false);
|
||||
if (recMsg.is_discarded()) {
|
||||
DHLOGE("recMsg parse failed!");
|
||||
return;
|
||||
}
|
||||
if (!IsUInt32(recMsg, DINPUT_SOFTBUS_KEY_CMD_TYPE)) {
|
||||
DHLOGE("softbus cmd key is invalid");
|
||||
return;
|
||||
}
|
||||
uint32_t cmdType = recMsg[DINPUT_SOFTBUS_KEY_CMD_TYPE];
|
||||
DHLOGI("HandleSession cmdType %u.", cmdType);
|
||||
if (cmdType < TRANS_MSG_SRC_SINK_SPLIT) {
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace {
|
||||
constexpr int32_t WIDTH = 4;
|
||||
constexpr unsigned char MASK = 0x0F;
|
||||
constexpr int32_t DOUBLE_TIMES = 2;
|
||||
constexpr int32_t INT32_STRING_LENGTH = 40;
|
||||
}
|
||||
DevInfo GetLocalDeviceInfo()
|
||||
{
|
||||
@@ -248,7 +249,6 @@ std::string GetAnonyString(const std::string &value)
|
||||
|
||||
std::string GetAnonyInt32(const int32_t value)
|
||||
{
|
||||
constexpr int32_t INT32_STRING_LENGTH = 40;
|
||||
char tempBuffer[INT32_STRING_LENGTH] = "";
|
||||
int32_t secRet = sprintf_s(tempBuffer, INT32_STRING_LENGTH, "%d", value);
|
||||
if (secRet <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user