Restarting Bluetooth programmatically? - Windows Mobile Development and Hacking General

I'm having a problem where my phone's (XPERIA X1i) A2DP connection doesn't properly reconnect to my car's receiver most of the time. I've found that if I go into the Bluetooth settings, uncheck "Wireless Stereo" on the appropriate device, save, then recheck it, and save again, everything works well. Obviously, this is a lot of trouble, so I'd like to automate it.
I've found where the enable bits are in the registry, but I can't tell how to do the equivalent of the "save" button in the settings. I'm happy to write my own program to do this if someone can point me to the right API call. Thanks!
- Scott
PS: Although I've found A2DPToggle to be a help elsewhere, it doesn't solve my problem of reconnecting the device.

Related

How do you enable A2DP in the Registry

I am successfully using the Tornado A2DP hack on my Prophet in conjunction with my bluetooth enabled car stereo. I have written a mort script to make the two connect automatically when bluetooth is switched on but there are odd occassions when they disconnect, like if I switch to listen to the radio.
I can't find the registry setting that controls the state of the "set as wireless stereo" function to either 1 for on or 0 for off. Can anybody help?
My intention is for the script to re-connect the wireless stereo if it detects that the registry setting has changed to 0.
I have been busy trying to track down the issues I have been having on my apache with a2dp, try searchnig the registry for "stereo", you should get a few hits.
Otherwise try
HKLM\Software\Microsoft\Bluetooth\Device\[your devices mac address]\services\
There should be a few long strings (folders), most likely corresponding to one for "wireless stereo" and one for "handsfree", in one of those you may see the wireless stereo...
anyway thats what I got with a 3.5aku and moto headset.
shiggs,
I've already tried that path and it does have a "services" folder with Wireless Stereo and Hands Free folder but the Dword value is enabled (set to 1) in both permanently, evenwhen bluetooth is switched off.
If we can figure this out it would be beneficial for everyone with a wireless stereo device for automatic connection.
Surely someone must know what registry changes take effect once "set as wireless stereo" has been tapped?
neomagik said:
Surely someone must know what registry changes take effect once "set as wireless stereo" has been tapped?
Click to expand...
Click to collapse
use a little utility called ssnap to take a snapshot of registry before enabling that option and another snapshot after checking it. Then compare the two file with an hexeditor (for example) and see which key/value was changed/added
cheers

Bluetooth GPS want to re-pair all the time

Hi folks,
I upgraded my Hermes with Schap's Windows Mobile 6 ROM. Works fine so far. But when I try to use my Bluetooth GPS it acts strange.
I paired the Bluetooth device and set up a COM-port for the applications. The first time it works. The next time, when I switch on Bluetooth and start for example TomTom, the Hermes tells me there is a new Bluetooth device that wants to connect. I checked and found out the GPS is still in the list of known Bluetooth devices and the COM-port is set. But the assistant is still bugging until I add the "new" device. After that of course my "old" device is gone.
How can I avoid this? Anyone experiencing the same problem?
I have the same issue, really annoying so would love to know the answer
Tafkas.Net said:
Hi folks,
I upgraded my Hermes with Schap's Windows Mobile 6 ROM. Works fine so far. But when I try to use my Bluetooth GPS it acts strange.
I paired the Bluetooth device and set up a COM-port for the applications. The first time it works. The next time, when I switch on Bluetooth and start for example TomTom, the Hermes tells me there is a new Bluetooth device that wants to connect. I checked and found out the GPS is still in the list of known Bluetooth devices and the COM-port is set. But the assistant is still bugging until I add the "new" device. After that of course my "old" device is gone.
How can I avoid this? Anyone experiencing the same problem?
Click to expand...
Click to collapse
On your Hermes:
Have you tried to checked off: "Make this device visible to other devices"?
Under: Start\Settings\Connections\Bluetooth\Mode (2nd tab on the bottom)
Option #1 (Hermes)
~If, "Make this device visible to other devices is not enabled, delete the pairing for your GPS.
~Check off "Make this device visible to other devices"
~Pair your GPS again (ensure that "Make this device visible to other devices" is still enabled)
Option #2 (GPS)
Don't know what kind of settings for bluetooth you may have on your GPS. I found for my car stereo, that I needed to leave it, in the "waiting/open for connection mode.
Now when I turn the car on it automatically connects the phone and stereo off my Hermes.
What I'm basically saying here is there may be a setting to leave your GPS automatically open for bluetooth connections?
I think option #1 may do the trick....
Hope this helps! Good Luck!
jac said:
On your Hermes:
Have you tried to checked off: "Make this device visible to other devices"?
Under: Start\Settings\Connections\Bluetooth\Mode (2nd tab on the bottom)
Option #1 (Hermes)
~If, "Make this device visible to other devices is not enabled, delete the pairing for your GPS.
~Check off "Make this device visible to other devices"
~Pair your GPS again (ensure that "Make this device visible to other devices" is still enabled)
Option #2 (GPS)
Don't know what kind of settings for bluetooth you may have on your GPS. I found for my car stereo, that I needed to leave it, in the "waiting/open for connection mode.
Now when I turn the car on it automatically connects the phone and stereo off my Hermes.
What I'm basically saying here is there may be a setting to leave your GPS automatically open for bluetooth connections?
I think option #1 may do the trick....
Hope this helps! Good Luck!
Click to expand...
Click to collapse
Mine is set to NOT be visable to others & my bluetooth GPS device just ha a on/off button.
paul8811 said:
Mine is set to NOT be visible to others & my bluetooth GPS device just ha a on/off button.
Click to expand...
Click to collapse
If your concerned about Security you can always change the Pairing codes.
and or turn off bluetooth when not needed.
I'm unaware of any cases where one can connect unless there paired, so in most cases access needs to be allowed on both ends, usually needing pairing codes. Even if it is one way, an approval code will still be needed.
What I found is this, if you want automatic connecting with one way pairing codes i.e. (Car Stereo to PDA or GPS to PDA) You'll need to allow "make device visible" checked off. The usual cause is a memory storing issue with the GPS or Car Stereo. I know that on high end Stereo's and GPS's they have on board memory which will save connection settings, where you'd put pairing codes on both ends and it will save the settings, thus negating the need to leave visible.
Don't know if I answered your question?
Hope I was able to shed some light on the subject....
Good Luck!

HD 2 and Sim Access Profile - not working?!

Hi @ all,
just got my HD2 with german ROM and one of the first things I tried out was to get a connection to my car (Audi A6) through the remote sim access profile (SAP, rSAP) - but it didn't work...
Does someone use the HD2 in his car using the sim access profile, as available in Audi or VW cars?
I have
- Audi A6 Avant (model 03/2008)
- using the "Audi rSAP Adaptor" in the car cradle, located in the arm rest
- everything in the HD2 is activated for Sim Access
Result:
HD2 and car are connecting, I have to put the 16 digit security code in my phone, but after that the SAP mode does not start, and so I have no access to my phonebook. It seems that I only have a "normal" bluetooth handsfree connection, because the HD2 still shows that he is booked into the mobile network - and when rSAP is active, the phone itself disconnects from the network and "falls asleep".
I restarted my HD2 several times, also the rSAP-Adapter by turning ignition of the car off and on until the adaptor switches off, deleting the connections, creating new connections, but nothing helps...
Any comments or experiences from other users are highliy appreciated
Finally, I have to remark that my HTC Snap, which I just upgraded to WM 6.5, works very good im my car with the rSAP - no problems at all, I get all my contacts in the MMI.
Thanks in advance,
Jolig
Just got my HD2 and am having the same problem.
I'm trying to connect with a 2009MY Skoda Superb with the rSAP bluetooth kit.
This works fine with my E71 and my HTC Touch Cruise.
I've been told that there used to be an issue with OBEX authentication on previous versions of Windows Mobile. Apparently, it was important to disable this authentication. However, I can't see the checkbox in the version of WM that the HD2 is running.
Does anyone know what registry entry this checkbox might have been changing?
Thanks,
Bagpuss.
Thanks Bagpuss,
who gave you this information?
I hope someone can solve this problem....but I fear we have to wait until we have more HD2 - owners
-----------------------------------------------------
EDIT:
I just have read something about the "Schaps Advanced Configuration Tool" where someone with similar problems activated OBEX (but it was an older Win Mobile device, and some months ago) - perhaps this could help?
But I just installed version 3.3 of this tool, but it doesn't work on my HD2...
Hi Jolig,
Check out this thread:
http://briskoda.net/superb-ii/howto...us-rns510-using-non-compatible-mobile/131709/
on Briskoda.net.
One of the guys there had lots of problems getting his WM phone to work, and posted the fruits of his labours.
From what I can tell, we can't use the CAB file he mentions, as rSAP is built into the OS version that the HD2 uses.
I've actually logged this issue with HTC, and am awaiting their response. My company is considering the HD2 as our next standard handset, and we won't go for it unless the rSAP functionality works with all VW/Audi group cars.
I'll let you know if they get back to me.
Bagpuss.
Thx Bagpuss,
and yes, in my opinion it's a mess that the rSAP is apparently VERY unimportant for most people or manufacturers...otherwise we wouldn't have this trouble....
I will come back too if I should find some news.
Had the same problem, tried lots of stuff but none of my WM devices is able to work with the rSap protocol. Gave up on it and then my Skoda Columbus system was stolen.
Replaced it with a JVC 7000 with detachable front. Disabled the rSap carkit and am now using the JVC BT carkit wich is working great. The problem is in the MS BT stack. It is not supporting the rSap the way it should. Only phones that work flawlessly are Nokia's I'm afraid...
The lack of rSAP support is what made me ignore the iPhone this time around.
I was hoping that the HD2 would be a viable alternative, but sadly, it doesn't look like this is going to be the case.
As I bought it over the phone, then I've got 7 days in which to return it. If I can't get it to work, then I guess I'll be getting an N97 or N97 Mini (which will definitely work). :-(
Bagpuss.
@ Bagpuss,
otherwise, as I wrote, I can recommend trying the small HTC Snap (or also called Maple?).
Ok, this one has no touch screen and also a very small screen - but I can confirm he works with rSAP and is not too expensive. I will keep this one, although I now have the HD2
As to Bagpuss' information concerning the OBEX, I tried the following:
- installed the newest .NET framework version
(that was necessary to get Advanced Config Tool v 3.3 running)
- install Schap's Advanced Config Tool
- in the menu "Bluetooth", I enabled OBEX
- after that the config tool does a soft reset
...still no success....no SAP and no phone book
I also wrote an email to HTC - it's really annoying, having SAP in the phone etc. and nothing works.
I've a Golf VI (RNS510) and it's working very well. Just had to change Bluetooth security settings that by default does not make HD2 visible to other devices. And after partnership was established, I've reverted the settings to "Allow only devices from MyDevices to connect"
Hi Binks821,
Binks821 said:
I've a Golf VI (RNS510) and it's working very well. Just had to change Bluetooth security settings that by default does not make HD2 visible to other devices. And after partnership was established, I've reverted the settings to "Allow only devices from MyDevices to connect"
Click to expand...
Click to collapse
Can you confirm if your Golf has the premium bluetooth preparation?
There are two different versions of factory bluetooth kit for the RNS510, one which simply acts as a handsfree device, and the other (premium) which is a complete GSM phone.
It's the premium kit which uses rSAP, and which seems to be incompatible with the HD2.
You can tell if your Golf is using rSAP by checking to see if the signal strength meter on the HD2 shows any bars when connected to the car. If it does, then it's not using rSAP. If you see the signal meter with a little x in the corner, then it is using rSAP.
If you do have rSAP working, then I'd really like to know which firmware version your RNS510 is running, and also which firmware version you have in your HD2.
Thanks,
Bagpuss.
yes I've the premium version with RSAP access, not just handset.
Once partnership is established, it says SIM Access profile in Bluetooth settings, not Handset. And it disables my SIM on the phone, so no strength meter.
I had a Tytn before, and it was working the same way. Just when received my HD2 Monday, it was not working but default settings on the phone make HD2 not visible, So I received a message on the car saying "No compatible phone found". After playing with Bluetooth security settings, it was OK.
And of course I can import SIM contacts.
Be sure to check these settings (Settings tab in Sense, then Menu-> All Settings -> Bluetooth)
- Discoverable: always visible
- Advanced -> Connectivity: Allow all devices to connect, just during setup. After that change to "Allow only devices listed in My Devices to connect"
- Advanced -> SIM Access: be sure that rSAP is enabled
HD2 version info:
- OS: 5.2.21864 (21864.5.0.81)
- Manila: 2.5.19202525.0
For the car I have to check once I'll be in.
Hi Binks281,
Thanks for the confirmation.
I've now done some further testing in my car, and managed to have some success.
This is what I did.
In the car:
1) Remove all device pairings from the bluetooth system in the car.
On the HD2:
1) Perform a hard reset.
2) Turn on bluetooth. Make HD2 permanently discoverable.
3) Make sure rSAP is enabled (it is by default).
4) Turn off SIM pin (turns out this isn't necessary, but I wanted to make things simple).
So, at this point, I have the car system with no paired phones, and the HD2 with factory settings and no personal data (contacts etc.). I also made sure there were no contacts on the SIM card.
Back in the car, I perform a device search, and it detects the HD2.
I select the HD2, and the car displays the pairing password (1111 2222 3333 4444).
On the HD2, I enter the password.
I then get a prompt saying that Skoda_rSAP is trying to connect to the remote sim access service. I say allow, and also tick the box to allow all future connections.
After about 10 seconds, the maxidot in the car says 'New SIM card recognised', and prompts me to create a new user profile. I called it 'HTC_HD2'.
After about another 15-20 seconds, the car should extract the SIM details from the phone and the phone name, network and signal bars should appear in the car display.
You can now make calls, but there is no phonebook.
Given what others have said about the phonebook access, I'm pretty sure that this is what was stopping the pairing from working the first time I tried it. I've heard various stories, some which say that the phonebook access only works with SIM card contacts, some which say it only works with OBEX authentication switched off and so on.
If you look at the paired devices screen in the phone, then you can see connections coming into phone. First, you see a connection to the SIM Access profile, followed by a brief connection to the Phone Book Access profile. It was at this point, when accessing the phone book, that my previous attempts to pair failed.
I'm still trying to work out what is causing the problem with the phone, but I have done the following things:
1) Told the car to only sync phone memory contacts. By default, it's set to sync both SIM and phone memory. You can configure this on the car by going to Settings -> Phonebook -> Select Memory, and choosing 'Mobile Phone'.
2) Created four contacts in phone memory, one with only 1 mobile number, one with 2 numbers (mobile and home) and another two with three numbers (mobile, home and work). I've then gone into Settings -> Phonebook -> Upload and sync these across to the car.
So far, this has worked fine and disconnecting and reconnecting to the car works without a hitch.
I'm now going to try syncing a small subset of my contacts with ActiveSync to see if this also works.
If it does, then I'll gradually increase the number until it either works, or fails.
I'll report my progress here.
Bagpuss.
Thanks Bagpuss,
sounds interesting!
I think tomorrow I will try this also:
- remove all paired phones in the car-system
- delete all contacts
- disable SIM Pin
Temporarily I am not sure if I will do a hart reset in the first step because I've already installed so much... When the work fails, I thing I must do it
I will report what happened.
---------------------------
EDIT:
Ah, come on...TV this evening nothing interesting, wife in bed...I tried it, including hardreset
No success.
Bagpuss, what I detected:
First, you see a connection to the SIM Access profile, followed by a brief connection to the Phone Book Access profile. It was at this point, when accessing the phone book, that my previous attempts to pair failed.
Click to expand...
Click to collapse
This connection to the Sim Access Profile I see also, but only for one second, then it dissappears and then the connection "Handsfree" comes up - and this one remains....
I do not know else what to do.
I now reconnected my beloved HTC Snap/Maple, and now I will start installing my apps on the HD2....
Hi Jolig,
Sorry to hear that it didn't work.
By the sounds of it, the Audi system is somewhat different to the VW/Skoda one. From what I can tell, your system also appears to support using phones in handsfree mode (I'm guessing that the iPhone works in your car).
In the VW/Skoda cars, you can either have a car kit that acts as a handsfree device or one that uses rSAP, but not both.
It could just be that the HD2 isn't responding to the rSAP request quickly enough to satisfy the MMI. In that event, it falls back to using handsfree mode.
When it shows 'handsfree' on the HD2, can you use the MMI to make calls?
This whole area seems to be a bit flaky on the HD2, as I still can't work out why mine didn't work when I first tried.
Bagpuss.
Binks821 said:
yes I've the premium version with RSAP access, not just handset.
Once partnership is established, it says SIM Access profile in Bluetooth settings, not Handset. And it disables my SIM on the phone, so no strength meter.
I had a Tytn before, and it was working the same way. Just when received my HD2 Monday, it was not working but default settings on the phone make HD2 not visible, So I received a message on the car saying "No compatible phone found". After playing with Bluetooth security settings, it was OK.
And of course I can import SIM contacts.
Be sure to check these settings (Settings tab in Sense, then Menu-> All Settings -> Bluetooth)
- Discoverable: always visible
- Advanced -> Connectivity: Allow all devices to connect, just during setup. After that change to "Allow only devices listed in My Devices to connect"
- Advanced -> SIM Access: be sure that rSAP is enabled
HD2 version info:
- OS: 5.2.21864 (21864.5.0.81)
- Manila: 2.5.19202525.0
For the car I have to check once I'll be in.
Click to expand...
Click to collapse
Hello Binks821,
I believe that I have the same hardware situation like you but I can't get my HD2 started on my VW Passat with the Premium FSE. The problem is, that I can go through the whole "finding and connecting process" and can save the PIN but then the Connection gets lost between the HD2 and the PFSE. If seems that the PFSE can't connect to the Network (E-Plus) but why the BT-Connect gets lost in this case.
Maybe you can help me to get it work. Thanks a lot!
Negropo
Hello everybody,
maybe I found a solution that work for every sap-handsfree-set. I tried the hint was given on the german car forum "motor-talk" for the connection problem between a vw pfse and the htc touch diamond with wm 6.1 or 6.5.
The trick is that you have to disconnect the HD2 from the pfse by manual when the car first want's to connect automatically. You have to go to the BT-Setup to the tab where are the connected devices listed. If you click on the "+" right of the name of the device you should be seen the tab "Remote Sim Access" or in german "Sim-Zugriff". When the car connect's to the HD2you have to stop this by pressing disconnect in the right below corner of the HD2 screen. Then the connection is terminated. Now you have to start the connection manual over the menu in your car. In a VW you have to press only "connect" in the MFA. And then the HD2 should connect without problems. I don't know why it works but it does. Maybe there is someone here who can explain it and find another "automatic" solution for this problem.
Regards Norman
Well, I don't have a VW but an Audi with an rSAP-Adaptor in the middle arm rest. I fear this also doesn't work for me.
The problem is that this Tab "Sim Access" only appears for just one second, so I have no chance to make anything whithin this single second....and after disppearing of the tab "sim access" another tab "handsfree" appears - and stays. So it seems my Audi only recognizes a handsfree profile. I don't know why,
Temporarily I am happy that I still have my HTC Snap, which is working very fine with rSAP
@ Negropo, can you tell me in which thread at motor-talk you found that?
Thanks,
Jolig
Hi guys,
rSAP works fine with my Audi A4 BTA. I made the HD2 discoverable for any device and I activated the SIM access in the HD2 BT settings. Then I start searching for Bt device on my Audi BT and initiated the connection with the HD2.After inserting the 16 character pin everything works fine.
By the way ... the connections seems to be very stable. With the Touch Diamond I had from time to time connection interrupts where it was necessary to reset/restart the Touch Diamond again.
Best regards,
Matthias
@ Matthias,
"BTA" means that you have the built-in phone with rSAP, right? Is it a brandnew A4?

Installed bluetooth "hack" BLUETOOTH WILL NOT STAY CONNECTED! : (

SOMEONE PLEASE HELP ME!!
I installed the bluetooth notification "hack" earlier in this thread for my att Tilt 2. Now my bluetooth stereo will not stay connected to my phone.. the problem is of course on the phones end. My stereo/headset doesnt pick up the bluetooth signal again, unless i turn off the bluetooth signal on the phone, and then restart the bluetooth signal. Then after that my bluetooth stereo picks up the signal. This is an awful annoyance.
Is there anything i can do to fix this so my headset will automatically pickup the bluetooth signal when its (of course) on? i removed the bluetooth notification hack installation from my device so its not installed anymore and this still happens.
Is there any registry settings i can modify to get everything to the way it was before i installed this hack? i am competent and have no worries about editing registry keys and values, so id greatly appreciate the help. I dont sound like the only one with this huge issues.
If i need to reinstall my bluetooth stack for my phone, then i will do it if its absolutely necessary... somebody please point me in the right direction, ive tried everything i can think of... I GREATLY APPRECIATE YOUR TIME AND EFFORTS, IT WOULD MAKE MY HOLIDAYS A LOT HAPPIER. Thank you!!!!
Hard reset might be the only way.
I pray not : ( is there anywhere i can download the widcomm bluetooth stack.... from widcomms site or anywhere else?
i greatly appreciate everyones input.
Is it possible for someone to post all of their registry keys and values for me to refer to? then i can match them manually on my phone...?
Even though you uninstalled the hack, something may have been over written, which cannot be undone unless you hard reset.
I keep a folder on my SD card on the phone, with all the apps I install after a rom flash. Also in that folder, is a "to do" list with tweaks, extra settings I use on my phone, along with email settings, IPS settings etc.
All stored for easy access, so after a ROM flash, I don't have to hunt them
down. After a flash, I just install the few apps in the folder, sync with the
microsoft myphone server and everything is back to normal.
Takes about an hour, which is less time than fooling around with trying to
fix some broken program/setting.

Fix for Bluetooth crashing in Nougat 7.0

Hey there!
I posted this answer within another thread, but thought it would help more people if I set it up here. I will be modifying the original post here to point back to this post so that I'm not spamming.
Anyway, if anyone is having the same issues with bluetooth because of the kernel issue in 7.0, I discovered a workaround until they patch it out. It's about as elegant as a bear in a tutu, but it works. Also, take into account that I used this method on a SM-J700T with a port of this ROM by mr.duck254 and FullOfHell. Their fine work is linked here: https://forum.xda-developers.com/galaxy-j7/j700t-development/rom-synexos-v1-0-port-duck254-fullofhell-t3756157
First you need to install these two apps (I'm not reputable enough to post outside links yet so I'll do my best to narrow your search):
"Bluetooth Pair" by Waylon Huang
"Bluetooth Auto Connect" by UniqTec Inc.
Fire up Bluetooth Pair and turn on your bluetooth antenna with button in the lower right.
Do a refresh in the settings menu if your device doesn't pop up.
When your device does pop up, tap the "PAIR" button.
In my experience, the "Connect" button within Bluetooth Pair did work for my devices. This is when you switch to Bluetooth Auto Connect.
Open Bluetooth Auto Connect and tap "Devices".
Make sure the device you want to connect has a check mark next to it and use the handle on the right to drag it to the top of the list.
Tap the device to and place a check mark next to the role(s) it performs.
Go back one screen and tap "Connect". If your device is on and paired you should now be connected.
Hope this helps. Good luck. :fingers-crossed:
Thanks man!!! Confirming that this works.
Only thing I did differently was that I unpaired everything so I could actually pair new devices through settings again but I'm guessing that the issue will come up again. Anyway thanks again man.
ziggyjustice said:
Hey there!
I posted this answer within another thread, but thought it would help more people if I set it up here. I will be modifying the original post here to point back to this post so that I'm not spamming.
Anyway, if anyone is having the same issues with bluetooth because of the kernel issue in 7.0, I discovered a workaround until they patch it out. It's about as elegant as a bear in a tutu, but it works. Also, take into account that I used this method on a SM-J700T with a port of this ROM by mr.duck254 and FullOfHell. Their fine work is linked here: https://forum.xda-developers.com/galaxy-j7/j700t-development/rom-synexos-v1-0-port-duck254-fullofhell-t3756157
First you need to install these two apps (I'm not reputable enough to post outside links yet so I'll do my best to narrow your search):
"Bluetooth Pair" by Waylon Huang
"Bluetooth Auto Connect" by UniqTec Inc.
Fire up Bluetooth Pair and turn on your bluetooth antenna with button in the lower right.
Do a refresh in the settings menu if your device doesn't pop up.
When your device does pop up, tap the "PAIR" button.
In my experience, the "Connect" button within Bluetooth Pair did work for my devices. This is when you switch to Bluetooth Auto Connect.
Open Bluetooth Auto Connect and tap "Devices".
Make sure the device you want to connect has a check mark next to it and use the handle on the right to drag it to the top of the list.
Tap the device to and place a check mark next to the role(s) it performs.
Go back one screen and tap "Connect". If your device is on and paired you should now be connected.
Hope this helps. Good luck. :fingers-crossed:
Click to expand...
Click to collapse

Categories

Resources