|
@ -195,7 +195,7 @@ shared_ptr<Receipt> ZSCanProtocolCom::base_callcmd(int32_t to, int32_t cmdid, ui |
|
|
|
|
|
|
|
|
shared_ptr<Receipt> ZSCanProtocolCom::callcmd(int32_t to, int32_t cmdid, uint8_t *param, int32_t paramLen, int32_t overtime) { |
|
|
shared_ptr<Receipt> ZSCanProtocolCom::callcmd(int32_t to, int32_t cmdid, uint8_t *param, int32_t paramLen, int32_t overtime) { |
|
|
shared_ptr<Receipt> receipt; |
|
|
shared_ptr<Receipt> receipt; |
|
|
lock_guard<mutex> lock(m_lock); |
|
|
|
|
|
|
|
|
lock_guard<mutex> lock(m_lock); |
|
|
usleep(10 * 1000); |
|
|
usleep(10 * 1000); |
|
|
|
|
|
|
|
|
for (size_t i = 0; i <= 3; i++) { |
|
|
for (size_t i = 0; i <= 3; i++) { |
|
@ -203,10 +203,13 @@ shared_ptr<Receipt> ZSCanProtocolCom::callcmd(int32_t to, int32_t cmdid, uint8_t |
|
|
receipt = base_callcmd(to, cmdid, param, paramLen, overtime); |
|
|
receipt = base_callcmd(to, cmdid, param, paramLen, overtime); |
|
|
} catch (const appexception &e) { |
|
|
} catch (const appexception &e) { |
|
|
if (e.ecode == err::kerr_overtime) { |
|
|
if (e.ecode == err::kerr_overtime) { |
|
|
// sl
|
|
|
|
|
|
if (i != 0) logger->warn("callcmd cmdid[{}] to [{}] overtime, retry {}", cmdid, to, i); |
|
|
if (i != 0) logger->warn("callcmd cmdid[{}] to [{}] overtime, retry {}", cmdid, to, i); |
|
|
usleep(100 * 1000); |
|
|
usleep(100 * 1000); |
|
|
continue; |
|
|
continue; |
|
|
|
|
|
} else if (e.ecode == err::kerr_subdevice_overtime) { |
|
|
|
|
|
if (i != 0) logger->warn("callcmd cmdid[{}] to [{}] subdevice_overtime, retry {}", cmdid, to, i); |
|
|
|
|
|
usleep(100 * 1000); |
|
|
|
|
|
continue; |
|
|
} |
|
|
} |
|
|
throw; |
|
|
throw; |
|
|
} |
|
|
} |
|
|