Bootstrapper
When you replace the desktop.app with your own application, it would be handy still to be able to get back to the desktop to try other things.
The bootstrapper would be a program that would replace the desktop.app and be configurable as to how long it should wait before launching an auto startup application. It's operation is along the same lines as the LILO / GRUB boot loaders.
Code
Installation
- Copy the cylo.app onto the cybiko using the Console.
- cp desktop.app olddesk.app
- cp cylo.app desktop.app
- rm cylo.app
I also like to remove the logo.app to make the startup just a little faster. Now reboot the cybiko and begin setting up your bootable programs.
If it all turns to custard or you just want to put the cybiko back to its original state, then you rename the olddesk.app to desktop.app. If that doesn't solve it then you can run the cybiko installer and completely reset the cybiko.
Options
The first time the program is started no programs would have been setup so you will be presented with the menu screen immediately. Once a DEFAULT has been selected autoboot mode will be enabled.
- <INS> Insert a program. Selected from a list of *.app programs.
- <DEL> Delete program from the list. The actually program will not be removed.
- <ENTER> Boot selection. Start the selected application.
- <SELECT> Mark as default. Selection will become the autoboot program, the title will change to show this.
- <TAB> Show the Settings
- Autoboot (on/off) should the program start in this mode. Default: on
- Timeout How many seconds to wait before autobooting
- <ESC> Exit application, if you are running cylo from the desktop then this will exit the application you would expect. One the cylo has replaced the desktop this key will restart the application.
The options are saved in a file named cylo.dat if this is deleted the program will reset with it's default first loaded behaviour.
Design
Configuration file cylo.dat is struct that is serialized to flash, and it not easily editable by hand.
The title of the application contains the name of the default application. ie CYLO - serialrelay.app
It must be noted that once an application has been launched the cylo.app program will continue to persist in memory, it does not terminate after launching its boot application. When the boot program has exited FOCUS will be return to cylo which will refresh and continue processing keyboard events.
Psuedo code
function start(application) if not start_module(application) then display "Cannot launch <application>" else wait for CYLO focus event fi autoboot mode = false If configuration file exists then Read configuration file. if there is a default program then AUTOBOOT=true fi timeout = (read as setting default:5) display "Any key to enter the menu" while autoboot mode and timeout > 0 display "Booting +default program+ in +timeout+ seconds" Wait 1 second looking for message if any keyboard event then autoboot mode = false fi timeout = timeout - 1 end while if timeout == 0 then start(default application) fi Display populated list of all available programs while message scan for keyboard event case key INS: display insert dialog, get new program name and save config file DEL: delete currently selected program and save config file ARROW: move cursor up/down SELECT: mark current selection as default and save config file TAB: display setting page ENTER: start(selected program) ?: Display help text ESC: Exit application (not useful when cylo has replaced the desktop.app)! esca end