dinput参数&整改

Signed-off-by: litiangang4 <litiangang4@huawei.com>
This commit is contained in:
litiangang4
2023-08-07 20:07:42 +08:00
parent 741e62e8c8
commit 013181cd2b
104 changed files with 600 additions and 600 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -57,7 +57,7 @@ public:
int32_t RemoveSinkScreenInfo(const std::string &screenInfoKey);
int32_t UpdateSinkScreenInfo(const std::string &screenInfoKey, const SinkScreenInfo &sinkScreenInfo);
SinkScreenInfo GetSinkScreenInfo(const std::string &screenInfoKey);
const std::unordered_map<std::string, SinkScreenInfo>& GetAllSinkScreenInfo();
const std::unordered_map<std::string, SinkScreenInfo> &GetAllSinkScreenInfo();
int32_t RemoveSrcScreenInfo(const std::string &screenInfoKey);
int32_t UpdateSrcScreenInfo(const std::string &screenInfoKey, const SrcScreenInfo &srcScreenInfo);
@@ -67,7 +67,7 @@ public:
LocalTouchScreenInfo GetLocalTouchScreenInfo();
std::shared_ptr<DistributedHardwareFwkKit> GetDHFwkKit();
sptr<IRemoteObject> GetRemoteObject(const int32_t saId);
void AddRemoteObject(const int32_t saId, const sptr<IRemoteObject>& remoteObject);
void AddRemoteObject(const int32_t saId, const sptr<IRemoteObject> &remoteObject);
void RemoveRemoteObject(const int32_t saId);
private:
+12 -12
View File
@@ -38,24 +38,24 @@ std::string GetUUIDBySoftBus(const std::string &networkId);
uint64_t GetCurrentTime();
std::string SetAnonyId(const std::string &message);
/* IsString, IsUInt32 and IsUInt64 are used to valid json key */
bool IsBoolean(const nlohmann::json& jsonObj, const std::string& key);
bool IsString(const nlohmann::json& jsonObj, const std::string& key);
bool IsInt32(const nlohmann::json& jsonObj, const std::string& key);
bool IsInt64(const nlohmann::json& jsonObj, const std::string& key);
bool IsUInt16(const nlohmann::json& jsonObj, const std::string& key);
bool IsUInt32(const nlohmann::json& jsonObj, const std::string& key);
bool IsUInt64(const nlohmann::json& jsonObj, const std::string& key);
bool IsArray(const nlohmann::json& jsonObj, const std::string& key);
bool IsBoolean(const nlohmann::json &jsonObj, const std::string &key);
bool IsString(const nlohmann::json &jsonObj, const std::string &key);
bool IsInt32(const nlohmann::json &jsonObj, const std::string &key);
bool IsInt64(const nlohmann::json &jsonObj, const std::string &key);
bool IsUInt16(const nlohmann::json &jsonObj, const std::string &key);
bool IsUInt32(const nlohmann::json &jsonObj, const std::string &key);
bool IsUInt64(const nlohmann::json &jsonObj, const std::string &key);
bool IsArray(const nlohmann::json &jsonObj, const std::string &key);
std::string GetNodeDesc(std::string parameters);
std::string GetAnonyString(const std::string &value);
std::string GetAnonyInt32(const int32_t value);
std::string Sha256(const std::string& string);
void CloseFd(int& fd);
std::string Sha256(const std::string &string);
void CloseFd(int &fd);
int BitIsSet(const unsigned long *array, int bit);
void StringSplitToVector(const std::string& str, const char split, std::vector<std::string>& vecStr);
void StringSplitToVector(const std::string &str, const char split, std::vector<std::string> &vecStr);
int OpenInputDeviceFdByPath(const std::string &devicePath);
std::string ConvertErrNo();
void ScanInputDevicesPath(const std::string &dirName, std::vector<std::string>& vecInputDevPath);
void ScanInputDevicesPath(const std::string &dirName, std::vector<std::string> &vecInputDevPath);
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS
+2 -2
View File
@@ -76,7 +76,7 @@ SinkScreenInfo DInputContext::GetSinkScreenInfo(const std::string &screenInfoKey
return sinkScreenInfoMap_[screenInfoKey];
}
const std::unordered_map<std::string, SinkScreenInfo>& DInputContext::GetAllSinkScreenInfo()
const std::unordered_map<std::string, SinkScreenInfo> &DInputContext::GetAllSinkScreenInfo()
{
std::lock_guard<std::mutex> lock(sinkMapMutex_);
return sinkScreenInfoMap_;
@@ -195,7 +195,7 @@ sptr<IRemoteObject> DInputContext::GetRemoteObject(const int32_t saId)
return remoteObject;
}
void DInputContext::AddRemoteObject(const int32_t saId, const sptr<IRemoteObject>& remoteObject)
void DInputContext::AddRemoteObject(const int32_t saId, const sptr<IRemoteObject> &remoteObject)
{
std::lock_guard<std::mutex> lock(remoteObjectsMutex_);
remoteObjects_[saId] = remoteObject;
+12 -12
View File
@@ -137,7 +137,7 @@ std::string SetAnonyId(const std::string &message)
return jsonObj.dump();
}
bool IsBoolean(const nlohmann::json& jsonObj, const std::string& key)
bool IsBoolean(const nlohmann::json &jsonObj, const std::string &key)
{
bool res = jsonObj.contains(key) && jsonObj[key].is_boolean();
if (!res) {
@@ -146,7 +146,7 @@ bool IsBoolean(const nlohmann::json& jsonObj, const std::string& key)
return res;
}
bool IsString(const nlohmann::json& jsonObj, const std::string& key)
bool IsString(const nlohmann::json &jsonObj, const std::string &key)
{
bool res = jsonObj.contains(key) && jsonObj[key].is_string();
if (!res) {
@@ -155,7 +155,7 @@ bool IsString(const nlohmann::json& jsonObj, const std::string& key)
return res;
}
bool IsInt32(const nlohmann::json& jsonObj, const std::string& key)
bool IsInt32(const nlohmann::json &jsonObj, const std::string &key)
{
bool res = jsonObj.contains(key) && jsonObj[key].is_number_integer() && INT32_MIN <= jsonObj[key] &&
jsonObj[key] <= INT32_MAX;
@@ -165,7 +165,7 @@ bool IsInt32(const nlohmann::json& jsonObj, const std::string& key)
return res;
}
bool IsInt64(const nlohmann::json& jsonObj, const std::string& key)
bool IsInt64(const nlohmann::json &jsonObj, const std::string &key)
{
bool res = jsonObj.contains(key) && jsonObj[key].is_number_integer() && INT64_MIN <= jsonObj[key] &&
jsonObj[key] <= INT64_MAX;
@@ -175,7 +175,7 @@ bool IsInt64(const nlohmann::json& jsonObj, const std::string& key)
return res;
}
bool IsUInt16(const nlohmann::json& jsonObj, const std::string& key)
bool IsUInt16(const nlohmann::json &jsonObj, const std::string &key)
{
bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT16_MAX;
if (!res) {
@@ -184,7 +184,7 @@ bool IsUInt16(const nlohmann::json& jsonObj, const std::string& key)
return res;
}
bool IsUInt32(const nlohmann::json& jsonObj, const std::string& key)
bool IsUInt32(const nlohmann::json &jsonObj, const std::string &key)
{
bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT32_MAX;
if (!res) {
@@ -193,7 +193,7 @@ bool IsUInt32(const nlohmann::json& jsonObj, const std::string& key)
return res;
}
bool IsUInt64(const nlohmann::json& jsonObj, const std::string& key)
bool IsUInt64(const nlohmann::json &jsonObj, const std::string &key)
{
bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT64_MAX;
if (!res) {
@@ -202,7 +202,7 @@ bool IsUInt64(const nlohmann::json& jsonObj, const std::string& key)
return res;
}
bool IsArray(const nlohmann::json& jsonObj, const std::string& key)
bool IsArray(const nlohmann::json &jsonObj, const std::string &key)
{
bool res = jsonObj.contains(key) && jsonObj[key].is_array();
if (!res) {
@@ -274,7 +274,7 @@ std::string GetAnonyInt32(const int32_t value)
return tempString;
}
std::string Sha256(const std::string& in)
std::string Sha256(const std::string &in)
{
unsigned char out[SHA256_DIGEST_LENGTH * HEX_TO_UINT8 + 1] = {0};
SHA256_CTX ctx;
@@ -293,7 +293,7 @@ std::string Sha256(const std::string& in)
return reinterpret_cast<char*>(out);
}
void CloseFd(int& fd)
void CloseFd(int &fd)
{
if (fd < 0) {
DHLOGE("No fd need to beclosed.");
@@ -308,7 +308,7 @@ int BitIsSet(const unsigned long *array, int bit)
return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
}
void StringSplitToVector(const std::string& str, const char split, std::vector<std::string>& vecStr)
void StringSplitToVector(const std::string &str, const char split, std::vector<std::string> &vecStr)
{
if (str.empty()) {
DHLOGE("StringSplitToVector param str is error.");
@@ -362,7 +362,7 @@ std::string ConvertErrNo()
return errNoMsg;
}
void ScanInputDevicesPath(const std::string &dirName, std::vector<std::string>& vecInputDevPath)
void ScanInputDevicesPath(const std::string &dirName, std::vector<std::string> &vecInputDevPath)
{
DIR *dir;
struct dirent *de;