Last active
December 12, 2019 17:04
-
-
Save atimin/972cf3c2e42f7533027a711b9cf89fd8 to your computer and use it in GitHub Desktop.
Make DPI Fault Request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "vendor/ra/powerFlex525/DPIFaultManager.h" | |
using namespace eipScanner; | |
using namespace eipScanner::vendor::ra::powerFlex525; | |
struct DPIFaultManagerResponse { | |
bool isTripped; | |
bool isErrored; // flag to say that we failed to make the request | |
std::vector<DPIFaultObject> faultObjects; | |
}; | |
DPIFaultManagerResponse makeRequest(SessionInfoIf::SPtr si) { | |
DPIFaultManagerResponse response{0}; | |
DPIFaultManager manager; | |
manager.setTrippedDeviceListener([&response](bool value){ | |
response.isTripped = value; | |
}); | |
manager.setNewFaultListener([&response](const DPIFaultObject& fault) { | |
response.faultObjects.push_back(fault); | |
}); | |
try { | |
manager.handleFaultObjects(si); | |
} catch (...) { | |
response.isErrored = true; | |
} | |
return response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment