mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Communication: Avoid MessageFilter type punning in waitForMessageSync
This commit is contained in:
@@ -230,7 +230,7 @@ bool IDeviceSettings::apply(bool temporary) {
|
||||
|
||||
std::shared_ptr<Main51Message> msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
||||
return com->sendCommand(Command::SetSettings, bytestream);
|
||||
}, Main51MessageFilter(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||
|
||||
if(!msg || msg->data[0] != 1) { // We did not receive a response
|
||||
// Attempt to get the settings from the device so we're up to date if possible
|
||||
@@ -256,7 +256,7 @@ bool IDeviceSettings::apply(bool temporary) {
|
||||
|
||||
msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
||||
return com->sendCommand(Command::SetSettings, bytestream);
|
||||
}, Main51MessageFilter(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||
if(!msg || msg->data[0] != 1) {
|
||||
// Attempt to get the settings from the device so we're up to date if possible
|
||||
if(refresh()) {
|
||||
@@ -269,7 +269,7 @@ bool IDeviceSettings::apply(bool temporary) {
|
||||
if(!temporary) {
|
||||
msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this]() {
|
||||
return com->sendCommand(Command::SaveSettings);
|
||||
}, Main51MessageFilter(Command::SaveSettings), std::chrono::milliseconds(5000)));
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SaveSettings), std::chrono::milliseconds(5000)));
|
||||
}
|
||||
|
||||
applyingSettings = false;
|
||||
@@ -298,7 +298,7 @@ bool IDeviceSettings::applyDefaults(bool temporary) {
|
||||
|
||||
std::shared_ptr<Main51Message> msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this]() {
|
||||
return com->sendCommand(Command::SetDefaultSettings);
|
||||
}, Main51MessageFilter(Command::SetDefaultSettings), std::chrono::milliseconds(1000)));
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SetDefaultSettings), std::chrono::milliseconds(1000)));
|
||||
if(!msg || msg->data[0] != 1) {
|
||||
// Attempt to get the settings from the device so we're up to date if possible
|
||||
if(refresh()) {
|
||||
@@ -333,7 +333,7 @@ bool IDeviceSettings::applyDefaults(bool temporary) {
|
||||
|
||||
msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
||||
return com->sendCommand(Command::SetSettings, bytestream);
|
||||
}, Main51MessageFilter(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||
if(!msg || msg->data[0] != 1) {
|
||||
// Attempt to get the settings from the device so we're up to date if possible
|
||||
if(refresh()) {
|
||||
@@ -346,7 +346,7 @@ bool IDeviceSettings::applyDefaults(bool temporary) {
|
||||
if(!temporary) {
|
||||
msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this]() {
|
||||
return com->sendCommand(Command::SaveSettings);
|
||||
}, Main51MessageFilter(Command::SaveSettings), std::chrono::milliseconds(5000)));
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SaveSettings), std::chrono::milliseconds(5000)));
|
||||
}
|
||||
|
||||
applyingSettings = false;
|
||||
|
||||
Reference in New Issue
Block a user