Cannot oper/register serial port for Bluetooth - Windows Mobile Development and Hacking General

I'm developing, for XDAII and in eVC4/Win32, an application that opens a serial port for incoming Bluetooth. The Bluetooth Manager sets COM4 as active port number, but my call:
CreateFile(TEXT("COM4:"),GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
fails with error message "The specified network resource or device is no longer available".
When I then try to call:
RegisterDevice(TEXT("COM"),4,TEXT("ASIC5_BTUR.Dll"),0))
also this call fails.
What am I doing wrong ? When I look in the Register [HKEY_LOCAL_MACHINE\Drivers\Active] I find no COM4 active so there is no obvious reason why this call should not work. Have the BTHTools1100 patch installed !

Hello, I am experiencing similiar problems. Have you resolved yours ? If yes, could you show me how you open your ports etc.?

read this :
http://forum.xda-developers.com/viewtopic.php?t=1263&highlight=

I am not sure how your link to COM1 prolems regaqrding signals sould help me. My problems are with opening Bluetooth SPP ports, those that show up as the Inbound and Outbound COM ports.Though I would think that both are active, üsing CreateFile() I can open only the Incoming one (COM4) while I receive an INVALID_HANDLE_VALUE for the other one (COM5).

I just saw some info on com ports being inactive as well as a test program so I thought I'd mention it. Didn't mean to provide a solution, sorry

I tried to get the Bluetooth working and also had trouble. I think the inbound and outbound comm ports is to do with if you are using your SPP device as a client or server. It is not as a lot of people think that TX and RX data are on different Comm ports.
I cound not get Bluetooth working at all using my original XDAII rom of 1.60. I downloaded Pocket Bluetooth Tools http://www.bluetooth.jazztel.es/ and then it worked easy on Comm7.
I recently upgraded my XDAII Rom to 1.72 and I tried the Bluetooth support again. This time the XDAII even said I am connecting to a serial SPP device and automatically allocated the Comm port. But I must say my program could still not transfer data correctly using it. It all got stuck in some initilisation sequence. Now that may of been my software so I don't want to blame the XDAII.
All I know is I installed Pocket Bluetooth tools again onto my 1.72 XDAII and all worked fine again on Comm7.
A friend of mine has a new XDAIIs and the inbuilt bluetooth support on that worked 100% first time, no need for the Pocket Bluetooth Tools on that. So I think the problem is with the XDAII and it's built in SPP support.

Had the same problem, resolved it:
Strange but true, but on XDA2 etc, in order to receive COM Bluetooth, you have to open the outgoing port as shown in the Systems Bluetooth settings (You have to tick it there, too, of course), not the incoming.
Then, as it is blocking, you have to create a thread that listens on the port.
You cannot use RegisterDevice for a port number (in your case COM4)that is already used and open.
Phil

OOPS.... and you have to call OpenFile(), not CreateFile() !!!!!!!!!!!

Related

Bluetooth sync not working!!!

:x i have been trying to get the bluetooth sync to work to no avail. i am using a 3com bluetooth usb adapter on my pc and card on my notebook. i am having problems with both when i try to synchronise. i can see my i-mate has been discovered and bonded; i can send files too. but i cannot synchronise. either there is a bug in the PDA software, or its really hard (needs a rocket scientist) to use!!! either way its dissappointing. can anyone help?
by the way my nokia and ericsson phones sync fine with my current setup.
I have the same problem using a toshiba portege 4010 with bluetooth built in, it works with my Nokia but not with the XDA i am using aytivesync 3.7.1
I would also like some help or ideas please
Thanks
John
Got bluetooth to work once
I got bluetooth to work only once using a Billionton USB Bluetooth adapter. The software is neat, but requires so much messing around with to get the PDA to actually synchronise in bluetooth mode. Unfortunately, I could not get it to work again. Should have documented what I did the first time.
After trying lots of times, it works. I sycronised a XDA2 in bluetooth mode.
There are a few important things
1. You first have to sychronise the XDA2 in USB Cradle to build a standard-partnership between desktop pc and XDA2.
2.remove the XDA2 from the Cradle.
3.look which com-port your bluetooth serial port is using
4.take these settings over to the active sync settings (must be exactly the same com port)
5. pair the two devices
6.start active sync on the XDA2 and sychronise via bluetooth
It works.....
i made a better description with screenshots (in german) but i don't know how to post it.
I use a toshiba laptop with bluetooth built in, but when i scan the available bluetooth things in the XDA 2 it only finds "voice gateway" and "SSA" or something like that, there is no serial port listed, when i scan a phone (nokia) it finds "dun" "serial port" "fax" etc etc.
So i cant connect my XDA2 as the only profiles it seems to have are Voice gateway and some SSA thing, so as there is no serial port listed i cant use activesync, i have bonded with both the voice and SSA thing to com ports from 5 to 9 and get a connection, but as its not a serial port it will not work with activesync.
Sorry for my terrible description of the problem, but if yours works i am sur e it will make sence to you
Thanks
John
Your right ! The XDA2 provides no serial port profile to my Bluetooth stick too. And thats why the Bluetooth GPS Receiver doesn't work.
I know this sounds strange, but with Active Sync Bluetooth definitely works.
Yes I finally got it to work a couple of days ago with a certain type of bluetooth usb adapter and software. All I can say, is that bluetooth is not very user friendly!!!! Activesync should have it show up just as it shows "infrared" in the connection settings. This will make it very easy to select it. In this day and age, you cannot expect a technology to be successful from mass usage if it is not totally idiot proof. BLUETOOTH is not.... WIFI will rule!!!!
Hi so have you bonded to the "ssa" profile, and then what ever com port you used you then changed activesync to use this port and it then works, because i tried this and it done not work.
I also have a tomtom bluetooth that a friend is borrowing, but by the looks of it there is no point in getting it back as if there is no serial port on the available using bluetooth that will not work either
Thanks
John
try this link. it may help u set up your bluetooth with active sync - http://www.bluetoothnews.com/features/ActiveSync.htm
@applecom
No. You just have to pair the Devices. Don't connect to any Profile.
Pair them and then start Active Sync from the XDA 2 and connect with bluetooth.
activesync and bluetooth with xda II
start > settings > system > bluetooth settings > Activesync over blutooth (START)
Nutty but there you go.
XDA II Bluetooth ActiveSync
I noted if you add or change the registry will work even better :
\HLKM\SOFT\Microsoft\Bluetooth\Activesync
IsBTASsetup from 0 to 1
Hi
I have changed the registry like you said, But how dose it work better, the only problems i have are when i ask activesync on the XDA to connect over BT it oftern trys and says port in use, i just retry a few times and it works. After doing the reg edit it did connect first time, but is this what you ment by "its works better"
Thanks
John
As this my first ever post, I don't want to come over as smug, but I took delivery of my XDA 2 today and it synced using bluetooth after about 25 minutes of 'messing'!
All I did was delete all the bonding between the PC and the XDA and told it to sync via bluetooth, initiating from the XDA, I thought that it had failed...but then the XDA sprang to life and 'Bob was my uncle'!!
Very impressed with my XDA 2, having used an XDA for about 8 months.
Andy.
Bluetooth Sync
What I meant was it has become easier to get XDA II sync via bluetooth. Please note that you have to unpair your PC first then change the registry and pair again. If your PC's Bluetooth dongle support Headset profile ( I used anycom USB220 which has this profile) you will see your XDA II asking you if you want Headset profile added and Activesync screen for bluetooth appeared as well. Changing the registry will always make the sync work is what i noted. Seems like XDA II Bluetooth supports many profile just that dont know how to make it works.
Bluetooth Activesync problems
I'm on the verge of giving up on this! Think I should stick to USB sync...here goes...
I've tried the tricks mentioned in the forum to try to get my XDA II to sync via bluetooth with my Sony VAIO laptop (it has built-in bluetooth). I can get the two devices to bond (I enter the PIN number on both the laptop and XDA and it succeeds) but then I try to run the Bluetooth Activesync setup (in Settings-->Bluetooth Settings on the XDA) I get an error message every time that says "Please bond with other Bluetooth device which supports serial port or Activesync profile as your Activesync partner!"
I thought I already HAD bonded the devices? Any ideas?
Cheers
Carlton
Finally sorted it out. Delete the partnership that you already have. Start from start>settings>system>Bluetooth Settings. When you clik start, then pair your device again. After the pairing, you will get the message that Bluetooth Active Sync is now ready.
Still no joy
Thanks for your help Merc.
I tried doing exactly what you suggested but still doesn't work. This is what happens:
I deleted the existing bond on both XDA II and PC.
I went to start>settings>system>Bluetooth Settings and clicked on Start. This gave me the message "Please bond with other Bluetooth device which supports serial port or Activesync profile as your Activesync partner!" like before, then automatically opened the Bluetooth connections control panel in the "Mode" pane. I chose 'Discoverable' and clicked OK. I then went to my PC and used the Wireless Link control panel and clicked 'Add' (to run Bluetooth connection wizard) which searched for devices. It found my XDA II and I entered the passkey on both XDAII and PC (same passkey on each).
The Bluetooth connection wizard then told me that the XDAII was offering DUN (dial up networking) services. I selected this and then clicked next. Was I supposed to select this (actually, it made no difference when I tried again without selecting!).
The wizard completed and both the PC and XDAII notified me that the bond was successful. I then waited and waited for something else to 'happen' (like a message to say that Bluetooth Active Sync is now ready.) but nothing happened. I gave it a couple of minutes.
I went to Activesync on the XDA and tried the 'connct with Bluetooth' just in case it had worked, but nothing happened. I went to Activesync on the PC and tried using a different COM port for infrared/serial links (as I assume this is what bluetooth uses) but no joy. I only had COM3 and COM4 showing in the connection settings in activesync, which surprised me as I thought there would be more.
That's it. I tried 3 times but still no luck. Any other ideas are greatly appreciated!
Cheers
Carlton
The
Your procedure is just like mine. But I used "On" and discovered the PC from the PDA. Do not use "Discoverable". Let me hear if you have any luck
The only way I have got it to work is assigning the bluetooth serial port to COM 6. Then set Activesync on the desktop to COM 6.
Any other COM port just won't work. Anybody else got it working on a different bluetooth COM port?
xdaguru

Multiple Simultaneous Serial Port Profile Connections?

G'Day
I'm trying to set up 2 simultaneous serial port profile bluetooth connections on an XDA II to different devices.
I've tried using the default MS Bluetooth stack, with and without BTHTools, and also the Widcomm stack, but can't seem to get it working.
I'm connecting the XDA to a Brainboxes RS-232 to BT adapter, and a Connectland USB Bluetooth dongle.
I can get both adapters working separately (testing with terminal emulators on PC/XDA) and I can get 2 concurrent connections to the USB dongle (one in one out) but I can't seem to get the same happening with both the BT adapters.
Does anyone know a way of doing this, or a way of assigning different COM ports to each serial port profile associated with a separate device on the XDA (as I think this would help)??
Any help is appreciated,
Cheers.
Sammy,
Please checkout this thread for something called GpsGate :
http://www.pocketpcthoughts.com/forums/viewtopic.php?t=29540
Its designed to multiply the number of Com ports assigned to a BT connection. Not sure if this is what you are after but sounded to me somewhat close so I decided to reply. Hope it helps.
Best Regards
Hi Sammy,
Have you installed the relevant ROM updates that correct problems with the MS and Widcomm Bluetooth stack on the XDA II ? Did you pair and bond the devices before connecting ? I have been developing applications that use the bluetooth serial profile for sometime now and I recommend that you use the MS Bluetooth Stack. I ran into countless problems trying to develop application using the Widcomm bluetooth stack without using their Bluetooth SDK. If you trying to assign different port for your device its best to use the Windows Ce Remote Registry Editor tool because you can't change Serial Port profile Com port values from the Bluetooth Settings menu option. For example for the Widcomm stack the Outbound serial port settings are set in the registry key
[HKEY_LOCAL_MACHINE\SOFTWARE\Widcomm\BTConfig\Applications\0001]
___________________________________________________________
Name Data
___________________________________________________________
(Default)
Name Bluetooth Serial Port
. .
. .
ComPortNumber 8
____________________________________________________________
This is the port that used by the device that initiates the connection.
Turn Off Blueetooth Stack and Backup your Registry first.
Check the settings for other Bluetooth Profiles from Registry Key value
[HKEY_LOCAL_MACHINE\SOFTWARE\Widcomm\BTConfig\Applications\0001]
to
[HKEY_LOCAL_MACHINE\SOFTWARE\Widcomm\BTConfig\Applications\0011]
Note all the Com port values that are assinged for profiles that need to use a port. i.e Dial-Up Networking, Fax etc
Change the value of the ComPortNumber to your desired value. You should assign a Com port value that is not in use. Exit from the Registry Edit tool and Turn the Bluetooth stack On. Go into the Bluetooth Settings and check to that the values you have assigned have taken effect. Viola, you can now use that port for communacting provided you are intiating the comms.
For incoming connections that are intiated from other Bluetooth devices the settings are found in Registry key
[HKEY_LOCAL_MACHINE\SOFTWARE\Widcomm\BTConfig\Services\0001]
Do the same as above.
Good Luck
k_kirk:
Thanks for the link, unfortunately not quite what I need. Please correct me if I'm wrong, but it looks like GPSGate takes an incoming Serial Port Profile connection and sticks the data into either a 'virtual com port' (COM0) or multiple hardware COM ports. What I was after was actually a way of having 2 concurrent SPP connections (incoming/outgoing) to two separate bluetooth devices.
panashe:
Which ROM updates would I need to correct the stack problems?
I was using an older ROM (the original one) and couldn't get BT working at all, I've since flashed it with a newer ROM (not sure which one) and bluetooth seems to work fine now.
Yes, devices are both paired and bonded.
I was trying to use the MS BT stack but it's limited functionality turned me off. I also had a few problems with very high latency data (it would take a few seconds for a single char to be transmitted).
Thanks for the registry info. I'd actually had a bit of a play with most of those keys before and have tried again, but it seems that no matter what values I change the incoming COM port to, it always uses COM4 regardless.
Note all the Com port values that are assinged for profiles that need to use a port. i.e Dial-Up Networking, Fax etc
Change the value of the ComPortNumber to your desired value
Click to expand...
Click to collapse
You can still only have a single outgoing COM port for the SPP profile though right?
So even if I can change the port settings for other profiles (My devices only support SPP, DUN LAN and FAX), I'd still be stuck with SPP on a single COM port wouldn't I?
Or can I somehow use another profile that uses a COM port as a pseudo-serial port profile??
Thanks for your help.
PS: Does anyone know how the device is chosen (when multiple SPP devices are paired/bonded) if you connect to a COM port to make an outgoing connection without first Connecting a particular device from Bluetooth Manager?
Does it just choose the last active device, or is it based on something else?

universal and bluetooth connection

So far I have been unable to syncronise using bluetooth. I could do it without much sweat win pda2k (ba), but not with jasjar (universal) so far. Any other owner managed to figure out how to do it? Cheers.
Got it working no problem at all. In fact I managed this before I managed to get it working with USB.
I used the same method that one would use for any WM2003 device.
Set PDA to discoverable on JASJAR
Look for BT devices from PC
Select the JASJAR
Select BT serial port
Find out the COM port of this serial port. Note it down.
Fire up activesync
Change the connection settings to look on the com port you noted down.
On JASJAR got to BT settings
Add a BT device
Select your PC
Select Activesync partner
Go to activesync
Select synch via BT from the menu
i will try again
i prefer the wm2003 wizard to wm2005, i will see maybe i missed something. thanks for clear instructions
still problem with bluetooth
Well I still have been unable to get the bluetooth working for the syncing. I follow the instructions in the booklet and help files, + what I just been told, but there are two issues,
the serial port is for outgoing from the PC, so that could not be used.
In the Com ports tabs two com ports get assigned one for incoming and one for outgoing, with the BA, we use the incoming which we feed into the Activesync, and it works then.
If I do that and create a sync relationship on the pda, there is the option of assigning outgoing port from pda, however when relationship is created only the incoming serial is showing up...
anyways, i have no problem using bluetooth on BA, and could not get it to work on jasjar/htc univ.
Doesnt matter I dont mind using the cable, but dishing the equivalent of US$1400 for a pda whose wizards dont work properly is a bit of an anteclimax.
And talking about ergonomics, the virtual keyboard has the annoying tendency to cover what u are going to write, so u dont see what u are writing...
They also removed the Avantgo utility from the IE, but I got it back by installing the one for winCE and upgrading over...
So for now, I will keep working on my BA (pda2k) as I dont want to waste my time working around bugs, until these get ironed out.
Greetings
Nabil H
I hope all these bugs will be fixed after the official launch
working at last
i managed to get the bluetooth syncing, the secret
1. hard reset,
2. recognise device on pc side
3. create activesync partnership on pda side
4. check incoming com port on pc side
5. feed that to activesync on pc side
6. check activesync partnership from pda side with pc
7. pda will pick up on partnership serial connection as being activesync
8. incoming and outgoing com ports ready to be used on pda side
9. choose outgoing com port on pda same as incoming com port on pc
10. connection established syncing starts...
All this without starting using the usb cable (so different from BA method)...
hope it helps others...
probs... again
Now after setting up and synicng with bluetooth I used the usb link to sync, and it complained about an error. I had to remove the bluetooth setup, and it is still complaining, I give up
I guess the famous russian saying is very wise: "Better is the enemy of the good"
Nabil H out
bluetooth, usb link and wifi
No wonder bluetooth was turned off by default in this jasjar shipment. I believe the following are bugs:
1. U can set up activesync over bluetooth initially after a hard reset.
2. If you then set it up after over a usb link, u lose the bluetooth setting, and can only sync over bluetooth after a hard reset again!
3. If u set up bluetooth, u get difficulties with wifi not connecting (on my system I can only get that back by disabling my wifi connection then enabling it again, dont ask me why this is so, i do not have the foggest clue)
4. When ur wifi is worknig u start having problems with bluetooth connections.
5. Even with a bluetooth sync working, u cannot browse folders on ur jasjar device from another device, as this service does not seem to be implemented.
This does not look very good for users who have multiple/various network connections...
So a patch is already needed for these connectivity issues...
Developers, look into this please...
Greetings
Nabil H out
wifi and bluetooth - solved
I finally managed, after some sweat to get:
. Wifi and bluetooth working together
. Two pda's BA and Universal using wifi simultaneously.
However what cannot be done is:
. Using two pda's with activesync simultaneously, this is a limitation of MS Activesync.
Greetings
Nabil H
PS On club imate website there is now a faq fro JASRAR (HTC Univ).
wifi and bluetooth - solved
Nabil,
can you post what you did to get this working.
thanks.
--------------------------------------------------------------------------------
I finally managed, after some sweat to get:
. Wifi and bluetooth working together
. Two pda's BA and Universal using wifi simultaneously.
However what cannot be done is:
. Using two pda's with activesync simultaneously, this is a limitation of MS Activesync.
Greetings
Nabil H
PS On club imate website there is now a faq fro JASRAR (HTC Univ).

Please help: can't beam files using bluetooth port.

i have a mda vario and i want to beam files to another phone thru bluetooth but there is no outgoing port. when i go to bluetooth settings and to com ports, only new incoming port is shown. i cant add a new outgoing port. please someone help me on this.
lsnizzle said:
i have a mda vario and i want to beam files to another phone thru bluetooth but there is no outgoing port. when i go to bluetooth settings and to com ports, only new incoming port is shown. i cant add a new outgoing port. please someone help me on this.
Click to expand...
Click to collapse
Hi,
You'll probably need to start bluetooth via the comm manager.
It will find other hardware with open bluetooth ports.
- Go to the file you wish to beam to someone else.
- Tap the file (keep the stylus on it untill you get the menu)
- Choose " send file" (this might be called differently, my version is dutch)
- Select bluetooth.
Good luck!
Greetz,
Flar
it doesnt seem to work
when I beam a file, it never detects a bluetooth. all it shows is the Infared and searching... it searches for a long time but never detects a bluetooth. any other suggestions?
Re: it doesnt seem to work
lsnizzle said:
when I beam a file, it never detects a bluetooth. all it shows is the Infared and searching... it searches for a long time but never detects a bluetooth. any other suggestions?
Click to expand...
Click to collapse
Hi,
The procedure I gave seems to work properly with my MDA.
You could check if the person you're beaming to has bluetooth (turned on) but I guess you've checked that already.
Otherwise try to minimize the distance between the two pieces of hardware.
If that doesn't solve your problem, I can't help you any further, maybe bring it by the shop where you bought it to have it checked?
Good luck & greetz,
Flar
yeah same here never managed to get bluetooth to work
i found that i needed to enable beam recieve in order to recieve on bluetooth, the incoming and outgoing port stuff i left alone.
so i can now receive files but haven't got a clue how to send them, i make a bluetooth partnership ok (my mate can then send me a file) but i can not find the option to send one back. the file explorer menu doesn't have bluetooth listed on it?
R_J_Webb said:
yeah same here never managed to get bluetooth to work
i found that i needed to enable beam recieve in order to recieve on bluetooth, the incoming and outgoing port stuff i left alone.
so i can now receive files but haven't got a clue how to send them, i make a bluetooth partnership ok (my mate can then send me a file) but i can not find the option to send one back. the file explorer menu doesn't have bluetooth listed on it?
Click to expand...
Click to collapse
I am having this same issue. Anyone know the solution? All I want to do is send some files to my wife's v3 but I cant setup a new outgoing port. I am running the latest official rom from cingular.
You need to ensure you already have bluetooth turned on before starting this procedure (many miss this simple point, as they assume it will automatically turned on)
Tap and hold on the file you want to send, and select "Beam"
Wait a few seconds for it to scan for devices.
All IRDA recipients (If any) will be listed, and below them, all available Bluetooth recipients will be shown.
Hope this helps you m8
I'm using TMobile MDA, newest ROM, and having the same problem, I'm able to recieve bluetooth but there is no option for beaming a file via bluetooth, only IR... and yes, bluetooth is enabled properly and I am properly partnered with a V3...
RE: can't beam files using bluetooth port.
lsnizzle said:
i have a mda vario and i want to beam files to another phone thru bluetooth but there is no outgoing port. when i go to bluetooth settings and to com ports, only new incoming port is shown. i cant add a new outgoing port. please someone help me on this.
Click to expand...
Click to collapse
Make sure both phones are enabled to be "seen" . My friend and I were trying to figure this out the other day, and she has her device set to something like 'make this device invisible' so even though our phones were next to each other, her device wasn't showing up. Once we changed this, both devices were visible.
***However, neither phone was allowing the sending of files to each other thru the bluetooth, and I'm wondering if this has something to do with her having a Sprint Treo 650 w/ Palm OS, and I have Cingular 8125 w/ WM5.... anyone have any answers for this one??***
Thanks in advance.

Bluetooth Navman 4400 not working..?

Hi all,
Just a quick question:
On my Hermes I have detected and setup my Bluetooth Navman 4400 via the Bluetooth Manager. Under Comm Ports it is showing as Com5. Authentication Pass Key Required is checked (Though I have tried both On & Off). In Settings/Connections/GPS I have set the Active port for Applications to 4 and the Hardware Port to 5 (Baud Rate 4800).
I have Tried OziExplorer and the Applet "GPS Info" and neither seem to get or instigate a session with the Navman device.. Now I have noticed that the Navman Continues to "Double Blink" which means it has not instigated a session with anything and thus is blissfully unaware that the Hermes should or is trying to communicate with it.
Funny thing is, the Navman unit works perfectly with my 2003SE Blue Angle PDA..
So am I doing something wrong or made and oversight?
Any Help would be appreciated..
Thankyou in advance..
outgoing com port
apologies if this was obvious to you when you set it up.
Make sure when you set up com port to associate with your navman, that you pick 'outgoing' and not 'incoming'. this was not obvious to me because I was thinking of the direction of data flow, not which side initiates the connection. I would re-pair and reconfigure the port a few times, but I suspect you already have. I use com9 with my iblue, perhaps com5 is already used by something else.
wwwes said:
apologies if this was obvious to you when you set it up.
Make sure when you set up com port to associate with your navman, that you pick 'outgoing' and not 'incoming'. this was not obvious to me because I was thinking of the direction of data flow, not which side initiates the connection. I would re-pair and reconfigure the port a few times, but I suspect you already have. I use com9 with my iblue, perhaps com5 is already used by something else.
Click to expand...
Click to collapse
Yeah had similar problems initially, but got that sorted (In & Out). I was told that The GPS Manager would handle the "in's" I just need to set the OUT (Hardware)..
If you try to use an allocated Port (say Com6) it comes up with an error indicating the port is not available.
My GPS Software (Both Oziexplorer & GPS Info) both show the port allocated by the GPS manager as "active" ..
All strange'ness to me..

Categories

Resources