Hi! Was wondering - how about augmenting CircleOS so that if the Primer is switched off whilst an App is running, it can still appear to be running (ie auto re-launches) when you switch back on.
This could perhaps be implemented as follows:
1) Any App can set a flag to request that it be re-started on next power-up.
2) If the user powers down by holding the orange button while an App is running, and the "restart" flag has been set, then that App (the last App to run) will be relaunched on next Power-Up, with no further user interaction.
3) CircleOS might want to ensure that if the App exits nicely by calling MENU_Quit(); it will not re-launch on next power-up (ie CircleOS clears the flag).
All existing Apps behave as normal, as they will not be setting the flag.
Could be used, say, as a zero battery power pause feature in a game, just so long as the App can re-instate its state from somewhere non-volatile...
A function which let the App check whether it has been re-launched, as opposed to run from the menu would be handy.
enum MENU_code Application_Ini ( void ) {
if( UTIL_AppRestartedAfterShutDown() )
// If desired, reinstate, and resume App where it left off
else
// Initialise App for fist use
UTIL_RestartThisAppAtPowerUpIfShutDown( TRUE ) ; // Ask to be restarted
}
A luxury would be a call-back from CircleOS before it shuts down to enable the App to stuff its state somewhere before the power goes off!
Last edited by sandy (2009-01-08 06:35:05)