Interruptions

From LinuxMCE
Jump to: navigation, search


The Orbiter can change screen to display messages in response to events (such as inserting a new plug and play device). However, sometimes you don't want to be interrupted.

When you're watching TV, for example, you probably don't want to be alerted just because a new device is detected on the network. Still, you probably want to be alerted if someone is ringing the doorbell.

In general, low priority tasks will not interrupt you if you are watching TV or browsing the web. These prompts are queued and will only be displayed when you stop the activity or manually switch to another screen (like the main menu). The system interprets this to to mean it's ok to interrupt you.

If you are trying to add plug and play devices (or do other tasks that would normally display popup messages on the screen) but you are not seeing the messages (because you are watching a movie or browsing the web), you can simply switch screens to the main menu and the popup messages will then appear.

Technical Explanation for Developers

In the Screen table in the pluto_main database is a field AllowInterruptions, which by default is 1 ( or true). If it's left at the default, then when that screen is active on the orbiter and the orbiter gets a request to display an alert or change screens, it will always do it. If the setting for the screen is 0 (which it normally is for full-screen media screens like the dvd playback, live tv, etc.), then the following rules will be evaluated to see if the user should be interrupted.

First, Goto_Screen takes a Parameter #251 Interruption, which is defined in AllScreens.h: enum eInterruption {interuptAlways=0, /* always interupt his activity and change screens */ interuptNever=1, /* never interupt, only change the screen if the system is idle */ interuptNoVideo=2, /* will interrupt a web browser but not a movie */ interuptOnlyAudio=3 /* will not interrupt a web browser, only when audio is playing */ };

This value can also be specified when using the pre-generated class helpers to do screen changes: DCE::Screen_[screen name].

If the interrupt is not interuptAlways, then the function OkayToInterrupt() in Orbiter.cpp will determine if it's okay to interrupt. If the answer is 'no', then it looks at another paramter to Goto_Screen: #253 Queue. If that parameter is 0, the screen change is lost. If it is 1, then if the screen doesn't change because of Interrupt rules, the screen change is added to a queue (m_listPendingGotoScreens) and the next time the screen changes the entries in the queue will be evaluated to see which ones are safe to do then. See Orbiter.cpp::ServiceInterruptionQueue()