Real World State And Notification Broker


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Chiedere quanti conoscono S&N e quanti lo hanno già usato
  • In the past, system states non exposedasmanagedP/InvokesrequiredInconsistentAPIstoretrieve System States
  • Marcare sulla congruenza del modello di accesso agli stati
  • Battery: semplice lettura di uno stato
  • Battery
  • Dire alla fine:Remember…we have more than 100 states
  • HKLMSystemState: general stateHKCUSystemState: user state (likeappointments)Mostrare il registro con Remote RegistryEditor
  • Battery
  • PersistentNotificationThe previuos (and verysimple) demo helps me to introduce the PersistentNotification.
  • Battery
  • Sulpunto 1, fare l’esempiodellechiamateentranti e che è possibileavviareil software solo se un determinatochiamantestàchiamando!
  • Real World State And Notification Broker

    1. 1. Real World State and Notification Broker<br />Michele Locuratolo<br />In collaborazione con<br />
    2. 2. Agenda<br />What is the State and Notification Broker<br />Reading a System State<br />Reacting to changes<br />Application launcher<br />
    3. 3. What is the State and Notification Broker:<br />Il a set of API which allow developers to:<br />Monitoring the System State in managed code:<br />We have more then 100 states exposed<br />React on system state changes<br />Create custom states<br />
    4. 4. Now we have:<br />A consistent model to access and manage the system states<br />No P/Invoke! 100% Managed code!<br />A lot of states exposed (more then 100)<br />
    5. 5. A BIG difference<br />
    6. 6. Read the battery state<br />DEMO<br />
    7. 7. Reacting to a changes<br />Create an instance of the specific state<br />Register to the .Changes event<br />Implement your code <br />
    8. 8. React to the battery state changes<br />DEMO<br />
    9. 9. How we can use it (in a real world scenario)?<br />We can:<br />Disable buttons /menu when the battery strength is low<br />Send data before battery goes down<br />…<br />
    10. 10. ActiveSyncStatus<br />PhoneCallForwardingOnLine1<br />CradlePresent<br />MessagingMmsUnread<br />MessagingOtherEmailUnread<br />MessagingLastEmailAccountName<br />MessagingTotalEmailUnread<br />PhoneLastIncomingCallerName<br />MediaPlayerTrackGenre<br />MediaPlayerTrackTitle<br />HeadsetPresent<br />PhoneIncomingCallerNumber<br />ConnectionsVpnDescriptions<br />MessagingSmsUnread<br />PhoneIncomingCallerName<br />KeyboardPresent<br />PhoneSimFull<br />WiFiStateConnected<br />MessagingVoiceMailTotalUnread<br />OwnerName<br />ConnectionsProxyCount<br />PhoneCallOnHold<br />PhoneActiveCallCount<br />MediaPlayerTrackArtist<br />WiFiStatePowerOn<br />TasksActive<br />PhoneMissedCall<br />CalendarEventBusyStatus<br />MessagingActiveSyncAccountName<br />DisplayRotation<br />PhoneCallCalling<br />PhoneCallBarring<br />PhoneActiveDataCall<br />CameraPresent<br />PhoneBlockedSim<br />PhoneIncomingCallerContact<br />PhoneGprsCoverage<br />WiFiStateNetworksAvailable<br />PhoneMissedCalls<br />ConnectionsCount<br />Phone1xRttCoverage<br />TasksHighPriority<br />PhoneIncomingCallerContactPropertyName<br />
    11. 11. Behind the scenes:<br />The Windows Mobile Registry is the central repository:<br />SystemState: for the predefined states<br />RegistryState: for the custom state<br />
    12. 12. Creating your own state:<br />Crate an instance of the RegistryState Class<br />React to the changes like the classic SystemState<br />
    13. 13. Create your own state<br />DEMO<br />
    14. 14. Application Launcher<br />Start an application when a monitored state changes<br />StateBase implements IApplicationLaucher interface<br />The IApplicationLaucher has the capability to start an application<br />Information about the application to start are stored in the Registry<br />
    15. 15. ApplicationLauncher<br />DEMO<br />
    16. 16. Remarks<br />You can start directly when a state changes…<br />SystemStatemonitoredState = newSystemState(SystemProperty.PowerBatteryBackupStrength);<br />monitoredState.EnableApplicationLauncher(&quot;MyCoolApp&quot;);<br />…or when a state arrives to a specified value<br />SystemStatemonitoredState = new SystemState(SystemProperty.PowerBatteryBackupStrength);<br />monitoredState.ComparisonType = StatusComparisonType.Less;<br />monitoredState.ComparisonValue = BatteryLevel.Low;<br />monitoredState.EnableApplicationLauncher(&quot;MyCoolApp&quot;);<br />The second application is not running before the state value doesn’t match with the criteria<br />
    17. 17. In conclusion….<br />Windows Mobile exposes more then 100 different states<br />When you need to interact with any kind of system notifications, check the System States<br />You can create your own state<br />Use the S&N API to produce a better software<br />Check out this open source application which uses this APIs<br /><br />
    18. 18. ActiveSyncStatus<br />PhoneCallForwardingOnLine1<br />CradlePresent<br />MessagingMmsUnread<br />MessagingOtherEmailUnread<br />MessagingLastEmailAccountName<br />MessagingTotalEmailUnread<br />PhoneLastIncomingCallerName<br />MediaPlayerTrackGenre<br />MediaPlayerTrackTitle<br />HeadsetPresent<br />PhoneIncomingCallerNumber<br />ConnectionsVpnDescriptions<br />MessagingSmsUnread<br />PhoneIncomingCallerName<br />KeyboardPresent<br />PhoneSimFull<br />WiFiStateConnected<br />MessagingVoiceMailTotalUnread<br />OwnerName<br />ConnectionsProxyCount<br />PhoneCallOnHold<br />PhoneActiveCallCount<br />MediaPlayerTrackArtist<br />WiFiStatePowerOn<br />TasksActive<br />PhoneMissedCall<br />CalendarEventBusyStatus<br />MessagingActiveSyncAccountName<br />DisplayRotation<br />PhoneCallCalling<br />PhoneCallBarring<br />PhoneActiveDataCall<br />CameraPresent<br />PhoneBlockedSim<br />PhoneIncomingCallerContact<br />PhoneGprsCoverage<br />WiFiStateNetworksAvailable<br />PhoneMissedCalls<br />ConnectionsCount<br />Phone1xRttCoverage<br />TasksHighPriority<br />PhoneIncomingCallerContactPropertyName<br />
    19. 19. Link<br />17/01/2008<br /><br />19<br />Michele Locuratolo<br /><br /><br /><br /><br />