FIX: The HMS is internal
jira: [STUDIO-10547] Change-Id: If40e9f3f9a0c9fa22d1e9b25ceef4284a8c61b10
This commit is contained in:
parent
6266a987d4
commit
e399f13634
|
@ -406,7 +406,40 @@ wxString HMSQuery::_query_hms_msg(const string& dev_id_type, const string& long_
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString HMSQuery::_query_error_msg(const std::string& dev_id_type,
|
bool HMSQuery::_is_internal_error(const string &dev_id_type,
|
||||||
|
const string &error_code,
|
||||||
|
const string &lang_code)
|
||||||
|
{
|
||||||
|
init_hms_info(dev_id_type);
|
||||||
|
auto iter = m_hms_info_jsons.find(dev_id_type);
|
||||||
|
if (iter == m_hms_info_jsons.end()) { return false; }
|
||||||
|
|
||||||
|
const json &m_hms_info_json = iter->second;
|
||||||
|
if (m_hms_info_json.contains("device_error")) {
|
||||||
|
if (m_hms_info_json["device_error"].contains(lang_code)) {
|
||||||
|
for (auto item = m_hms_info_json["device_error"][lang_code].begin(); item != m_hms_info_json["device_error"][lang_code].end(); item++) {
|
||||||
|
if (item->contains("ecode") && boost::to_upper_copy((*item)["ecode"].get<std::string>()) == error_code) {
|
||||||
|
if (item->contains("intro")) { return wxString::FromUTF8((*item)["intro"].get<std::string>()).IsEmpty(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// return first language
|
||||||
|
if (!m_hms_info_json["device_error"].empty()) {
|
||||||
|
for (auto lang : m_hms_info_json["device_error"]) {
|
||||||
|
for (auto item = lang.begin(); item != lang.end(); item++) {
|
||||||
|
if (item->contains("ecode") && boost::to_upper_copy((*item)["ecode"].get<std::string>()) == error_code) {
|
||||||
|
if (item->contains("intro")) { return wxString::FromUTF8((*item)["intro"].get<std::string>()).IsEmpty(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString HMSQuery::_query_error_msg(const std::string &dev_id_type,
|
||||||
const std::string& error_code,
|
const std::string& error_code,
|
||||||
const std::string& lang_code)
|
const std::string& lang_code)
|
||||||
{
|
{
|
||||||
|
@ -488,7 +521,15 @@ wxString HMSQuery::_query_error_image_action(const std::string& dev_id_type, con
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString HMSQuery::query_print_error_msg(const MachineObject* obj, int print_error)
|
bool HMSQuery::is_internal_error(const MachineObject *obj, int print_error)
|
||||||
|
{
|
||||||
|
char buf[32];
|
||||||
|
::sprintf(buf, "%08X", print_error);
|
||||||
|
std::string lang_code = HMSQuery::hms_language_code();
|
||||||
|
return _is_internal_error(get_dev_id_type(obj), std::string(buf), lang_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString HMSQuery::query_print_error_msg(const MachineObject *obj, int print_error)
|
||||||
{
|
{
|
||||||
if (!obj)
|
if (!obj)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,6 +42,8 @@ public:
|
||||||
// query
|
// query
|
||||||
wxString query_hms_msg(const MachineObject* obj, const std::string& long_error_code);
|
wxString query_hms_msg(const MachineObject* obj, const std::string& long_error_code);
|
||||||
wxString query_hms_msg(const std::string& dev_id, const std::string& long_error_code);
|
wxString query_hms_msg(const std::string& dev_id, const std::string& long_error_code);
|
||||||
|
|
||||||
|
bool is_internal_error(const MachineObject *obj, int print_error);
|
||||||
wxString query_print_error_msg(const MachineObject* obj, int print_error);
|
wxString query_print_error_msg(const MachineObject* obj, int print_error);
|
||||||
wxString query_print_error_msg(const std::string& dev_id, int print_error);
|
wxString query_print_error_msg(const std::string& dev_id, int print_error);
|
||||||
wxString query_print_image_action(const MachineObject* obj, int print_error, std::vector<int>& button_action);
|
wxString query_print_image_action(const MachineObject* obj, int print_error, std::vector<int>& button_action);
|
||||||
|
@ -65,6 +67,8 @@ private:
|
||||||
// internal query
|
// internal query
|
||||||
string get_dev_id_type(const MachineObject* obj) const;
|
string get_dev_id_type(const MachineObject* obj) const;
|
||||||
wxString _query_hms_msg(const string& dev_id_type, const string& long_error_code, const string& lang_code = std::string("en"));
|
wxString _query_hms_msg(const string& dev_id_type, const string& long_error_code, const string& lang_code = std::string("en"));
|
||||||
|
|
||||||
|
bool _is_internal_error(const string &dev_id_type, const string &long_error_code, const string &lang_code = std::string("en"));
|
||||||
wxString _query_error_msg(const string& dev_id_type, const std::string& long_error_code, const std::string& lang_code = std::string("en"));
|
wxString _query_error_msg(const string& dev_id_type, const std::string& long_error_code, const std::string& lang_code = std::string("en"));
|
||||||
wxString _query_error_image_action(const string& dev_id_type, const std::string& long_error_code, std::vector<int>& button_action);
|
wxString _query_error_image_action(const string& dev_id_type, const std::string& long_error_code, std::vector<int>& button_action);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2766,6 +2766,11 @@ void StatusPanel::update_error_message()
|
||||||
if (print_error_str.size() > 4) { print_error_str.insert(4, "-"); }
|
if (print_error_str.size() > 4) { print_error_str.insert(4, "-"); }
|
||||||
|
|
||||||
wxString error_msg = wxGetApp().get_hms_query()->query_print_error_msg(obj, obj->print_error);
|
wxString error_msg = wxGetApp().get_hms_query()->query_print_error_msg(obj, obj->print_error);
|
||||||
|
if (wxGetApp().get_hms_query()->is_internal_error(obj, obj->print_error))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> used_button;
|
std::vector<int> used_button;
|
||||||
wxString error_image_url = wxGetApp().get_hms_query()->query_print_image_action(obj, obj->print_error, used_button);
|
wxString error_image_url = wxGetApp().get_hms_query()->query_print_image_action(obj, obj->print_error, used_button);
|
||||||
// special case
|
// special case
|
||||||
|
|
Loading…
Reference in New Issue