added service 20
This commit is contained in:
@ -13,7 +13,7 @@ LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
|
||||
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
|
||||
}
|
||||
gpioInterface->initialize(gpioCookie);
|
||||
testCase = TestCases::READ;
|
||||
testCase = TestCases::LOOPBACK;
|
||||
}
|
||||
|
||||
LibgpiodTest::~LibgpiodTest() {
|
||||
@ -25,7 +25,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
|
||||
|
||||
switch(testCase) {
|
||||
case(TestCases::READ): {
|
||||
result = gpioInterface->readGpio(gpioIds::Test_ID, &gpioState);
|
||||
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
|
||||
<< std::endl;
|
||||
@ -38,7 +38,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
|
||||
break;
|
||||
}
|
||||
case(TestCases::LOOPBACK): {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,3 +46,37 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t LibgpiodTest::performOneShotAction() {
|
||||
int gpioState;
|
||||
ReturnValue_t result;
|
||||
|
||||
switch(testCase) {
|
||||
case(TestCases::READ): {
|
||||
break;
|
||||
}
|
||||
case(TestCases::LOOPBACK): {
|
||||
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
|
||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::info << "LibgpiodTest::performOneShotAction:"
|
||||
"GPIO pulled high successfully for loopback test" << std::endl;
|
||||
}
|
||||
else {
|
||||
sif::warning << "LibgpiodTest::performOneShotAction: Could not pull GPIO high!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, &gpioState);
|
||||
if(result == HasReturnvaluesIF::RETURN_OK and gpioState == 1) {
|
||||
sif::info << "LibgpiodTest::performOneShotAction:"
|
||||
"GPIO state read successfully and is high" << std::endl;
|
||||
}
|
||||
else {
|
||||
sif::warning << "LibgpiodTest::performOneShotAction: GPIO read and is not high!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ public:
|
||||
virtual ~LibgpiodTest();
|
||||
|
||||
protected:
|
||||
virtual ReturnValue_t performPeriodicAction() override;
|
||||
ReturnValue_t performOneShotAction() override;
|
||||
ReturnValue_t performPeriodicAction() override;
|
||||
|
||||
private:
|
||||
GpioIF* gpioInterface;
|
||||
|
Reference in New Issue
Block a user