diff options
Diffstat (limited to 'test/test-platform/TestPlatform.cpp')
-rw-r--r-- | test/test-platform/TestPlatform.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/test-platform/TestPlatform.cpp b/test/test-platform/TestPlatform.cpp index 2ff704b..b69a10e 100644 --- a/test/test-platform/TestPlatform.cpp +++ b/test/test-platform/TestPlatform.cpp @@ -50,13 +50,16 @@ public: } }; -CTestPlatform::CTestPlatform(const string& strClass, int iPortNumber) : +CTestPlatform::CTestPlatform(const string& strClass, int iPortNumber, sem_t& exitSemaphore) : _pParameterMgrPlatformConnector(new CParameterMgrPlatformConnector(strClass)), - _pParameterMgrPlatformConnectorLogger(new CParameterMgrPlatformConnectorLogger) + _pParameterMgrPlatformConnectorLogger(new CParameterMgrPlatformConnectorLogger), + _exitSemaphore(exitSemaphore) { _pCommandHandler = new CCommandHandler(this); // Add command parsers + _pCommandHandler->addCommandParser("exit", &CTestPlatform::exit, + 0, "", "Exit TestPlatform"); _pCommandHandler->addCommandParser( "createExclusiveSelectionCriterionFromStateList", &CTestPlatform::createExclusiveSelectionCriterionFromStateList, @@ -124,6 +127,20 @@ CTestPlatform::~CTestPlatform() delete _pParameterMgrPlatformConnector; } +CTestPlatform::CommandReturn CTestPlatform::exit( + const IRemoteCommand& remoteCommand, string& strResult) +{ + (void)remoteCommand; + + // Stop local server + _pRemoteProcessorServer->stop(); + + // Release the main blocking semaphore to quit application + sem_post(&_exitSemaphore); + + return CTestPlatform::CCommandHandler::EDone; +} + bool CTestPlatform::load(std::string& strError) { // Start remote processor server |