nimbuscontrols / EIPScanner

Free implementation of EtherNet/IP in C++
https://eipscanner.readthedocs.io/en/latest/
MIT License
233 stars 93 forks source link

Eip scanner get fault info #16

Closed jadamroth closed 4 years ago

jadamroth commented 4 years ago

Added functionality to get details (bus voltage, current, & frequency) at time of fault.

Needed to change actualToEngValue() and engToActualValue() to public functions

jadamroth commented 4 years ago

Now with this mapped fault information, I see no need to use the FaultObject to get attributes given the fixed size of the queue never changing from 3.

We'll check something like:

for(i=1; i<=10; i++)
if(faultCode[i] == 0)
break
else
getFaultInfo(i)

Map faultCode info example:

int faultCode = 5;
auto faultInfo = DPIFaultCode(faultCode).getFaultDescription();
Logger(LogLevel::INFO) << faultInfo.faultType;
Logger(LogLevel::INFO) << faultInfo.faultText;
Logger(LogLevel::INFO) << faultInfo.faultDescription;
atimin commented 4 years ago

Looks good. But I have some suggestions:

  1. We didn't discuss it, but I've written the library by using tabs for the indents. Your code uses spaces. Better to choose one approach.
  2. Why don't' we leave DPIFaultObject as it is and make new class DPIFaultParameter? Currently, the name DPIFaultObject is confusing. One can expect DPI Fault Object (0x97) but it is just a standard Parameter Object (0x0f). One more reason is, that there are other RA devices that may have the more sane implementation of DPI Fault Object.

@jadamroth what do you think?

jadamroth commented 4 years ago

1) I'm programming in CLion. I almost always use tabs, never spaces. I'll see if I can change through the IDE 2) Totally agree. I'll make these changes tonight @flipback