30 lines
736 B
C++
30 lines
736 B
C++
#include "InputConnector.h"
|
|
|
|
CInputConnector::CInputConnector()
|
|
{
|
|
}
|
|
|
|
QBitArray CInputConnector::GetInputPinsStates()
|
|
{
|
|
|
|
if(!IsConnectorDefined())
|
|
return QBitArray();
|
|
|
|
QBitArray IOStates = mIOInterfaceHandle->GetInputStates();//inputs are active low, need to invert!!!
|
|
QBitArray PinsStates(mPinCount);
|
|
|
|
if(mIOModuleRangeEnd > IOStates.size()) //try not to crash!
|
|
{
|
|
qDebug("Logic error in CInputConnector::GetInputPinsStates(); mIOModuleRangeEnd greater than IO count");
|
|
return QBitArray();
|
|
}
|
|
|
|
|
|
int ConnectorPin = 0;
|
|
for(int IoPin = mIOModuleRangeBegin; IoPin <= mIOModuleRangeEnd; IoPin++)
|
|
{
|
|
PinsStates[ConnectorPin++] = IOStates[IoPin];
|
|
}
|
|
return PinsStates;
|
|
}
|