|
|
|
|
|
|
|
|
|
|
|
|
|
|
int CodeDweller::Service::run() { |
|
|
int CodeDweller::Service::run() { |
|
|
|
|
|
|
|
|
// Get the singleton. |
|
|
|
|
|
CodeDweller::Service &svc = CodeDweller::Service::getInstance(); |
|
|
|
|
|
|
|
|
|
|
|
// Get the log file name. |
|
|
// Get the log file name. |
|
|
auto arguments = svc.arguments(); |
|
|
|
|
|
|
|
|
auto arguments = CodeDweller::Service::arguments(); |
|
|
|
|
|
|
|
|
if (arguments.size() != 2) { |
|
|
if (arguments.size() != 2) { |
|
|
return(EXIT_FAILURE); |
|
|
return(EXIT_FAILURE); |
|
|
|
|
|
|
|
|
std::ofstream logStream(arguments[1]); |
|
|
std::ofstream logStream(arguments[1]); |
|
|
|
|
|
|
|
|
// Register the callbacks. |
|
|
// Register the callbacks. |
|
|
svc.onPauseCall(pauseCbck); |
|
|
|
|
|
svc.onPauseCall(pauseCbck1); |
|
|
|
|
|
|
|
|
CodeDweller::Service::onPauseCall(pauseCbck); |
|
|
|
|
|
CodeDweller::Service::onPauseCall(pauseCbck1); |
|
|
|
|
|
|
|
|
svc.onResumeCall(resumeCbck); |
|
|
|
|
|
svc.onResumeCall(resumeCbck1); |
|
|
|
|
|
|
|
|
CodeDweller::Service::onResumeCall(resumeCbck); |
|
|
|
|
|
CodeDweller::Service::onResumeCall(resumeCbck1); |
|
|
|
|
|
|
|
|
svc.onStopCall(stopCbck); |
|
|
|
|
|
svc.onStopCall(stopCbck1); |
|
|
|
|
|
|
|
|
CodeDweller::Service::onStopCall(stopCbck); |
|
|
|
|
|
CodeDweller::Service::onStopCall(stopCbck1); |
|
|
|
|
|
|
|
|
while (!stopCbck.stopFlag) { |
|
|
while (!stopCbck.stopFlag) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(2000)); |
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(2000)); |
|
|
logStream << "done." << std::endl; |
|
|
logStream << "done." << std::endl; |
|
|
|
|
|
|
|
|
logStream << "receivedPause(): " << svc.receivedPause() << std::endl; |
|
|
|
|
|
logStream << "receivedResume(): " << svc.receivedResume() << std::endl; |
|
|
|
|
|
logStream << "receivedStop(): " << svc.receivedStop() << std::endl; |
|
|
|
|
|
|
|
|
logStream << "receivedPause(): " |
|
|
|
|
|
<< CodeDweller::Service::receivedPause() << std::endl; |
|
|
|
|
|
logStream << "receivedResume(): " |
|
|
|
|
|
<< CodeDweller::Service::receivedResume() << std::endl; |
|
|
|
|
|
logStream << "receivedStop(): " |
|
|
|
|
|
<< CodeDweller::Service::receivedStop() << std::endl; |
|
|
|
|
|
|
|
|
logStream << "Clearing all flags." << std::endl; |
|
|
logStream << "Clearing all flags." << std::endl; |
|
|
svc.clearReceivedPause(); |
|
|
|
|
|
svc.clearReceivedResume(); |
|
|
|
|
|
svc.clearReceivedStop(); |
|
|
|
|
|
|
|
|
|
|
|
logStream << "receivedPause(): " << svc.receivedPause() << std::endl; |
|
|
|
|
|
logStream << "receivedResume(): " << svc.receivedResume() << std::endl; |
|
|
|
|
|
logStream << "receivedStop(): " << svc.receivedStop() << std::endl; |
|
|
|
|
|
|
|
|
CodeDweller::Service::clearReceivedPause(); |
|
|
|
|
|
CodeDweller::Service::clearReceivedResume(); |
|
|
|
|
|
CodeDweller::Service::clearReceivedStop(); |
|
|
|
|
|
|
|
|
|
|
|
logStream << "receivedPause(): " |
|
|
|
|
|
<< CodeDweller::Service::receivedPause() << std::endl; |
|
|
|
|
|
logStream << "receivedResume(): " |
|
|
|
|
|
<< CodeDweller::Service::receivedResume() << std::endl; |
|
|
|
|
|
logStream << "receivedStop(): " |
|
|
|
|
|
<< CodeDweller::Service::receivedStop() << std::endl; |
|
|
|
|
|
|
|
|
logStream << "pauseCbck.pauseFlag: " << pauseCbck.pauseFlag << std::endl; |
|
|
logStream << "pauseCbck.pauseFlag: " << pauseCbck.pauseFlag << std::endl; |
|
|
logStream << "pauseCbck1.pauseFlag: " << pauseCbck1.pauseFlag << std::endl; |
|
|
logStream << "pauseCbck1.pauseFlag: " << pauseCbck1.pauseFlag << std::endl; |