PDA

View Full Version : Reading the Bluetooth status VIA Registy, BTcomstatus


saenzjoseph
30-10-2007, 04:23 AM
Up till the Rom upgrade to 2.16 I have been using the registry key HKLM\Software\oem\bluetooth\BTcomstatus (0=off, 1=on) to Monitor the bluetooth status, so I could have a script that turned it on if off and off if on to use in a Mortscript file. When I upgraded to the 2.16 ROM I noticed that my scripts were not working right. So today I tried to figure out why, I found that this key no longer exists, and that creating It did me no good because the key did not update with the bluetooth status.

With the 2.16 ROM the registry key that I found that was HKLM\System\State\Hardware\Bluetooth with the states of
8=off, 9=on and not connected to a device, 25=on and connected to a device (headset, gps, etc.)
Just thought I would share that for anyone using Mortscript. And does anybody else know of another key for the bluetooth status?

Dishe
30-10-2007, 07:21 PM
Up till the Rom upgrade to 2.16 I have been using the registry key HKLM\Software\oem\bluetooth\BTcomstatus (0=off, 1=on) to Monitor the bluetooth status, so I could have a script that turned it on if off and off if on to use in a Mortscript file. When I upgraded to the 2.16 ROM I noticed that my scripts were not working right. So today I tried to figure out why, I found that this key no longer exists, and that creating It did me no good because the key did not update with the bluetooth status.

With the 2.16 ROM the registry key that I found that was HKLM\System\State\Hardware\Bluetooth with the states of
8=off, 9=on and not connected to a device, 25=on and connected to a device (headset, gps, etc.)
Just thought I would share that for anyone using Mortscript. And does anybody else know of another key for the bluetooth status?

I know that they updated the Bluetooth stack because of the quality issues, but this seems to be a major revision- I've been running a custom ROM based on the Alltel Core (2.14) on my Mogul, and the original key as you state it is still there... AND alltel's rom fixed the Bluetooth problem as well, so I'm not sure why the new 2.16 rom from sprint moved things around.

Then again, as far as I'm concerned the 2.16 official update is a mess in general. It made my phone totally unstable, so I'm happy with the 2.14, and everything (such as the BT keys mentioned) are in the right places...

By the way, what is your method of actually toggling the BT status?
I know you can CHECK it with the registry, but how do you SET it? I've always had to use a third party wireless app for toggling, and most of those have a function to check your BT status already so it would seem superfluous to need the registry check before hand.

saenzjoseph
30-10-2007, 10:07 PM
By the way, what is your method of actually toggling the BT status?
I know you can CHECK it with the registry, but how do you SET it? I've always had to use a third party wireless app for toggling, and most of those have a function to check your BT status already so it would seem superfluous to need the registry check before hand.

I'm using a third party app., its just a toggler so it does not know the state of the BT. I also want to know the state so I can return it to the state that it was prior to running the script...Here is an example of the script that I use it for...

This script is for
Checking ->turning BT ON or leave on
1 Screen full brightness (ac/batt) and no timeouts
2 Vol Max
3. Rotate and stay in lansdcape (using landscaper)
4. Run Live Search or Google Maps Etc.
6. Return everything to prior state..(there is no way to return vol through registry that I have found)

SavedVolume = RegRead ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedVolume")
SavedRingerVolume = RegRead ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedRingerVolume")
BattSuspendTimeout = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout")
ACSuspendTimeout = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout")
BatteryTimeout = RegRead ("HKCU", "ControlPanel\Backlight", "BatteryTimeout")
ACTimeout = RegRead ("HKCU", "ControlPanel\Backlight", "ACTimeout")
Brightness = RegRead ("HKCU", "ControlPanel\Backlight", "Brightness")
ACBrightness = RegRead ("HKCU", "ControlPanel\Backlight", "ACBrightness")
ACTimeoutUnchecked = RegRead ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked")
BatteryTimeoutUnchecked = RegRead ("HKCU", "ControlPanel\Backlight", "BatteryTimeoutUnchecked")
B = RegRead ("HKLM", "\System\State\Hardware\" , "Bluetooth" )

If ( B = 8 )
setVolume 255
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",0)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout",0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeoutUnchecked", 60)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked", 60)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 0)
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedVolume", 4294967295)
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedRingerVolume", 4294967295)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "Brightness", 10)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACBrightness", 10)
Run( "\Program Files\ToggleBTh.exe" )
Rotate(90)
Run( "\program files\Landscaper.exe" )
WaitForActive( "Landscaper", 05 )
SendDown ( "Landscaper" )
Runwait( "\Program Files\Live Search\LiveSearch.exe" )
Close( "Landscaper" )
Run( "\Program Files\ToggleBTh.exe" )
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedVolume", SavedVolume)
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedRingerVolume", SavedRingerVolume)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",BattSuspendTimeout)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout",ACSuspendTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", BatteryTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", ACTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "Brightness", Brightness)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACBrightness", ACBrightness)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked", ACTimeoutUnchecked)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeoutUnchecked", BatteryTimeoutUnchecked)
Rotate(0)
setVolume 213

Else
If ( B = 9 )
setVolume 255
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",0)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout",0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeoutUnchecked", 60)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked", 60)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 0)
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedVolume", 4294967295)
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedRingerVolume", 4294967295)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "Brightness", 10)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACBrightness", 10)
Rotate(90)
Run( "\program files\Landscaper.exe" )
WaitForActive( "Landscaper", 05 )
SendDown ( "Landscaper" )
Runwait( "\Program Files\Live Search\LiveSearch.exe" )
Close( "Landscaper" )
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedVolume", SavedVolume)
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedRingerVolume", SavedRingerVolume)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",BattSuspendTimeout)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout",ACSuspendTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", BatteryTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", ACTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "Brightness", Brightness)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACBrightness", ACBrightness)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked", ACTimeoutUnchecked)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeoutUnchecked", BatteryTimeoutUnchecked)
Rotate(0)
setVolume 213

Else
If ( B = 25 )
setVolume 255
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",0)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout",0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeoutUnchecked", 60)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked", 60)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 0)
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedVolume", 4294967295)
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedRingerVolume", 4294967295)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "Brightness", 10)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACBrightness", 10)
Rotate(90)
Run( "\program files\Landscaper.exe" )
WaitForActive( "Landscaper", 05 )
SendDown ( "Landscaper" )
Runwait( "\Program Files\Live Search\LiveSearch.exe" )
Close( "Landscaper" )
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedVolume", SavedVolume)
RegWriteDword ("HKCU", "ControlPanel\Volume\Notifications\ShellOverrides","SavedRingerVolume", SavedRingerVolume)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",BattSuspendTimeout)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout",ACSuspendTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", BatteryTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", ACTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "Brightness", Brightness)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACBrightness", ACBrightness)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked", ACTimeoutUnchecked)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeoutUnchecked", BatteryTimeoutUnchecked)
Rotate(0)
setVolume 213