Skip to content

Instantly share code, notes, and snippets.

@atimin
Last active December 12, 2019 17:04
Show Gist options
  • Save atimin/972cf3c2e42f7533027a711b9cf89fd8 to your computer and use it in GitHub Desktop.
Save atimin/972cf3c2e42f7533027a711b9cf89fd8 to your computer and use it in GitHub Desktop.
Make DPI Fault Request
#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