'Service module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
' Phone.
'-------
Dim pw As PhoneWakeState
' Timers.
'--------
Dim tmrTimeToKeepActive As Timer
Dim tmrTimeToKeepInactive As Timer
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
' ToastMessageShow("Setting time to keep active.", True)
tmrTimeToKeepActive.Initialize("TimeToKeepActive", main.intTimeToKeepActive)
tmrTimeToKeepActive.Enabled = True
pw.PartialLock
End Sub
Sub Service_Destroy
ToastMessageShow("Service ended.", True)
pw.ReleasePartialLock
End Sub
Sub TimeToKeepActive_Tick
' ToastMessageShow("Time to keep active is now over.", True)
pw.ReleasePartialLock
' ToastMessageShow("Setting time to keep inactive.", True)
tmrTimeToKeepInactive.Initialize("TimeToKeepInactive", main.intTimeToKeepInactive)
tmrTimeToKeepInactive.Enabled = True
tmrTimeToKeepActive.Enabled = False
End Sub
Sub TimeToKeepInactive_Tick
' ToastMessageShow("Time to keep inactive is now over.", True)
pw.PartialLock
' ToastMessageShow("Setting time to keep active.", True)
tmrTimeToKeepActive.Initialize("TimeToKeepActive", main.intTimeToKeepActive)
tmrTimeToKeepActive.Enabled = True
tmrTimeToKeepInactive.Enabled = False
End Sub
Sub ResetTimers (pTimeToKeepActive As Int, pTimeToKeepInactive As Int)
tmrTimeToKeepActive.Enabled = False
tmrTimeToKeepInactive.Enabled = False
tmrTimeToKeepActive.Initialize("TimeToKeepActive", pTimeToKeepActive)
tmrTimeToKeepInactive.Initialize("TimeToKeepInactive", pTimeToKeepInactive)
tmrTimeToKeepActive.Enabled = True
tmrTimeToKeepInactive.Enabled = True
End Sub
Sub TurnOffTimers
tmrTimeToKeepActive.Enabled = False
tmrTimeToKeepInactive.Enabled = False
End Sub
Sub TurnPartialLockOn
pw.PartialLock
End Sub