IApplication

class

Entry point for all mono applications, abstract interface.

Every mono application must implement this interface. This is the starting point of the your application code, you must call it after the runtime initalization.

You do this from inside the main() function. Your main function should look like this:

int main()
{
     // Construct you IApplication subclass
     MyIApplicationSubclass appCtrl;
     
     // Tell the IApplicationContext of your existance
     IApplicationContext::Instance->setMonoApplication(&appCtrl);

     // Start the run loop... - and never come back! (Gollum!, Gollum!)
     return appCtrl.enterRunLoop();
}

Your mono applications entry point must be your own subclass of IApplication. And you must initalize it inside (not outside) the main() function. This is strictly nessesary, because the IApplicationContext must be ready when the IApplication is executed.

Also you must call the enterRunLoop method from main, to enter the event loop and prevent main() from returning.

Public Functions

mono::IApplication::IApplication()

Construct the global Application class.

Constructor for the global Application Controller. See IApplication for a describtion on when to call this constructor.

virtual void mono::IApplication::monoWakeFromReset()
= 0

Called when mono boot after having been power off or after a reset This method is only called once, you should use it to do inital data and object setup.

When this method returns mono will enter in an event loop, so use this method to setup event listeners for your code.

Do not call this method yourself, it is intended only to be called by the mono framework runtime.

virtual void mono::IApplication::monoWillGotoSleep()
= 0

The runtime library calls this function when the MCU will go into standby or sleep mode. Use this method to disconnect from networks or last-minute clean ups.

When you return from this method the system will goto sleep, and at wakeup the monoWakeFromSleep() method will be called automatically.

Do not call this method yourself, it is ontended only to be called by the mono framework runtime.

virtual void mono::IApplication::monoWakeFromSleep()
= 0

Called when mono comes out of a standby or sleep state, where the MCU instruction execution has been paused.

Use this method to reestablish I/O connections and refresh data objects.

You should not call this method your self, it is intended only to be called by the mono framework runtime.

int mono::IApplication::enterRunLoop()

Start the mono application run loop.

Start the main run loop for your mono application. This method calls the global IApplicationContext run loop.

The last line in the main.cpp file must be a call to this function:

int main()
{
    MyIApplicationSubclass appCtrl;

    // Some app ctrl setup code here perhaps?
    
    return appCtrl.enterRunLoop();
}

Return
The run loop never returns, the return type is only for comformaty.