支持定点设备限定词

Signed-off-by: chencheng31 <chencheng8@huawei.com>
This commit is contained in:
chencheng31
2022-07-07 10:14:40 +08:00
parent d6790f623b
commit 96a74f0cdc
3 changed files with 27 additions and 3 deletions
+2 -1
View File
@@ -43,6 +43,7 @@ private:
static bool ParseOrientation(const std::string &folderName, std::vector<KeyParam> &keyparams);
static bool ParseDeviceType(const std::string &folderName, std::vector<KeyParam> &keyparams);
static bool ParseNightMode(const std::string &folderName, std::vector<KeyParam> &keyparams);
static bool ParseInputDevice(const std::string &folderName, std::vector<KeyParam> &keyparams);
static bool ParseResolution(const std::string &folderName, std::vector<KeyParam> &keyparams);
static void PushMccMnc(const std::string &folderName, KeyType type, std::vector<KeyParam> &keyparams);
@@ -57,4 +58,4 @@ private:
}
}
}
#endif
#endif
+12 -1
View File
@@ -32,7 +32,7 @@ const static std::string ID_DEFINED_FILE = "id_defined.json";
const static std::string RESOURCE_INDEX_FILE = "resources.index";
const static std::string SEPARATOR = "/";
const static int32_t VERSION_MAX_LEN = 128;
static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 2.008" };
static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 2.009" };
const static int32_t TAG_LEN = 4;
enum class KeyType {
@@ -45,6 +45,8 @@ enum class KeyType {
NIGHTMODE = 6,
MCC = 7,
MNC = 8,
// RESERVER 9
INPUTDEVICE = 10,
KEY_TYPE_MAX,
};
@@ -125,6 +127,15 @@ const std::map<std::string, NightMode> g_nightModeMap = {
{ "light", NightMode::LIGHT },
};
enum class InputDevice {
INPUTDEVICE_NOT_SET = -1,
INPUTDEVICE_POINTINGDEVICE = 0,
};
const std::map<std::string, InputDevice> g_inputDeviceMap = {
{ "pointingdevice", InputDevice::INPUTDEVICE_POINTINGDEVICE },
};
struct KeyParam {
KeyType keyType;
uint32_t value;
+13 -1
View File
@@ -41,6 +41,7 @@ bool KeyParser::Parse(const string &folderName, vector<KeyParam> &keyparams)
ParseOrientation,
ParseDeviceType,
ParseNightMode,
ParseInputDevice,
ParseResolution,
};
@@ -224,6 +225,17 @@ bool KeyParser::ParseNightMode(const string &folderName, vector<KeyParam> &keypa
return true;
}
bool KeyParser::ParseInputDevice(const string &folderName, vector<KeyParam> &keyparams)
{
auto it = g_inputDeviceMap.find(folderName);
if (it == g_inputDeviceMap.end()) {
return false;
}
PushValue(static_cast<uint32_t>(it->second), KeyType::INPUTDEVICE, keyparams);
return true;
}
bool KeyParser::ParseResolution(const string &folderName, vector<KeyParam> &keyparams)
{
auto it = g_resolutionMap.find(folderName);
@@ -263,4 +275,4 @@ void KeyParser::PushValue(uint32_t value, KeyType type, vector<KeyParam> &keypar
}
}
}
}
}