Browse Source

Add Application::shutdown()

master
Krisjanis Rijnieks 8 years ago
parent
commit
e6302b5b71
  1. 12
      src/Application/Application.cpp
  2. 1
      src/Application/Application.h
  3. 4
      src/ofxPiMapper.cpp
  4. 1
      src/ofxPiMapper.h

12
src/Application/Application.cpp

@ -158,6 +158,10 @@ void Application::onKeyPressed(ofKeyEventArgs & args){
reboot();
break;
case 'c':
shutdown();
break;
default:
// All the other keypresses are handled by the application state onKeyPressed
_state->onKeyPressed(this, args);
@ -308,6 +312,14 @@ void Application::reboot(){
#endif
}
void Application::shutdown(){
#ifdef TARGET_RASPBERRY_PI
system("sudo shutdown -h now");
#else
ofLogNotice("Application::shutdown()", "Supported only on Raspberry Pi");
#endif
}
bool Application::loadXmlSettings(string fileName){
if(!ofFile::doesFileExist(fileName)){
ofLogError("Application::loadXmlSettings()") << fileName << " does not exist";

1
src/Application/Application.h

@ -126,6 +126,7 @@ class Application : public KeyListener {
// System commands
void reboot();
void shutdown();
protected:
void setState(ApplicationBaseMode * st);

4
src/ofxPiMapper.cpp

@ -154,6 +154,10 @@ void ofxPiMapper::reboot(){
_application.reboot();
}
void ofxPiMapper::shutdown(){
_application.shutdown();
}
void ofxPiMapper::saveProject(){
_application.saveProject();
}

1
src/ofxPiMapper.h

@ -68,6 +68,7 @@ class ofxPiMapper {
// System commands
void reboot();
void shutdown();
private:
ofx::piMapper::Application _application;

Loading…
Cancel
Save