Problem with opening COM port in XDA - Windows Mobile Software Development

Hi,
I use MS eMbedded Visual C++ for create my applications.
I create aplications for iPaq and XDA.
I can't open communication port COM in XDA.
I use follow function:
lpszPortName = TEXT("COM1:"); // COM port = COM1
// open COM port
if (hPort == INVALID_HANDLE_VALUE)
{
hPort = CreateFile (lpszPortName, GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING,
0,
NULL);
}
Handle hPort has got enduringly value INVALID_HANDLE_VALUE.
If I use this function in iPaq so it execute all OK.
I've got close all aplications, witch work with COM port.
I use synchronization cable for transfer data from external equipment in XDA.
Where is my mistake? Please, help mi.
[email protected]

not sure if yu just cut/pasted your code incorrectly, but you should test if the handle is valid -after- you open it, not before.

specify
Next example is only cut my source code. I make test so after open COM port.
I use function GetLastError for get more information.
GetLastError return this result:
code 55:
text: The specified network resource or device is no longer available.
Where is problem?
If I use this cable for synchronization between XDA and my PC, all is OK.
What COM port is use during this connection?
[email protected]

I have also had this error code 55 problem. It means that the comm port is already open by something else. This should happen if the XDA was already sat in a serial cradle with ActiveSync running, BUT I have had it repeatadly happen for no reason.
Do Settings -> Connections -> Beam and UnTick 'Receive incoming beams'. I don't know why this causes the problem but it seems to clear it. Please tell me reason why this works.
Another 'cure' I have found is that if you use ActiveSync and serially sync the XDA, then remove it from the cradle. Then your code will work, but possibly only once.
When it does work - transmit a stream of characters (say a file about 500 bytes) out of the comm1 port, then it will work correctly and can be open/closed as expected.
Let me know how you get on, I would like to know a reason why this problem happens.
Cheers
Paul

Related

Probs with GPS and AKU3.5

Hi,
I have a TT GPS module and have just installed a ROM to give me 3.5.
I did have the GPS working with GPSDash, but had to hard reboot and can not.
I have tried different com ports for both the GPS and the new MS GPS mananger thing, but GPSDash cannt find it.
Anyone else running this new ROM able to help please?
Thanks,
Simon.
Hi there
try the following
hope this help
Installing TomTom Navigator 5.1
15. Using File Explorer, navigate to the .CAB file you copied to your SD card and install R-Edit
on your Pocket PC. R-Edit can be acquired from http://www.pocketfleet.homeunix.com/REGEDIT.htm
but you can also Google for any other Windows Mobile 5 Registry Editor.
16. Run R-Edit from the Programs Menu.
17. Within R-Edit, navigate to the registry key "HKEY_LOCAL_MACHINE\ControlPanel\GPS Settings"
18. Within the registry key, delete the DWORD entry marked "Hide"
19. Add a DWORD entry called "Group" and give it a Value of "2"
20. Soft reset your Pocket PC.
21. On your Pocket PC, go to Settings > Connections to ensure that the GPS icon is there.
If it is not then I can only apologise but it may not be possible to get TomTom working with
your GPS device. It is necessary for TomTom to see a specific GPS serial port that can
(as far as I can tell) only be set by this GPS connection program. After you have paired
with your Bluetooth GPS device you could try setting an Outgoing port to COM7: as that is
a default COM port that TomTom Navigator can connect to. Do step 22 then skip to step 26.
22. Turn on your Bluetooth GPS and stick it in a location that it's likely to get a signal.
On your Pocket PC, enable Bluetooth and search for new devices. Establish a bond (pair) with
your GPS device and ensure you check the "Serial Port" option.
23. Go to Settings > Connections > Bluetooth. Create a new Incoming COM Port. I chose COM8 for this.
24. Other guides on the Internet tell you to also create an Outgoing port and setting it
as COM7 but doing this would not work on the PPC that I was using so I had to create the
Outgoing COM port on COM0. Either way you need an Outgoing COM port to be set.
If you can set it as COM7: then you should do so, if not, use COM0:
25. Go to Settings > Connections > GPS. Set the GPS communication port to the same
Outgoing COM port that you set above. For the PPC I was using,
I had to set it as COM0: above so will set it here as COM0: also.
The "Manage GPS Automatically" checkbox should already be checked but if it isn't, check it and OK out.
26. Start up TomTom Navigator using the Programs menu and run through the setup procedure as
normal but select "Other Bluetooth GPS" when asked to select a GPS device.
27. TomTom will ask you to now pair your GPS device with your Pocket PC.
We've already done that so click Continue.
28. You will be given a list of ports that your GPS device is likely to be on.
Remember that this is the Outgoing port that we created earlier in steps 24 and 25.
Basically the COM port you set here must be the same as the one you set in step 24 and 25.
29. Select the relevant COM port and then click Next. You will likely be taken straight
in to the map view and with any luck your Pocket PC and GPS device will start communicating and your Pocket PC will show your position on the map.
30. If you made a mistake in setting the COM port that your GPS device lives on,
simply tap anywhere on the screen. Tap Preferences, tap Next three times until you
see an icon that looks like a satellite labelled GPS status. Tap that icon and then tap configure to change the COM port.
regards

External Bluetooth modem for Hermes

Hello,
I have recently upgraded my MDA Vario II with Schap's 3.30c in Spanish (nice work, btw). I'm trying to use another 3G phone as an external modem for the Hermes due to cheaper rates here in Spain, but I cannot make the connection.
The other mobile phone is an LG U8210, and both devices pair correctly. I do configure the connection via Bluetooth and I enter as dialing numbre on the Hermes *99#, same as when using the Hermes as a modem with the PC.
It seems to try to connect with the LG, but then drops the connection so I was wondering if the problem is on the dialing number I'm entering.
If anybody is using an external mobile phone as a bluetooth modem for the PDA, could you please post your modem configuration?
Many thanks.
P.S: I've searched the forums and it seems some people are using this setup, but none of them say anything about "special" parameters.
anyone can help? Please.
I'm not using WM6, but I sometimes connect my Hermes (latest official WM5)
via bluetooth to a Nokia 6260 which then dials a gprs connection.
settings:
modem: bluetooth
number: *99#
on the username/password page, in the advanced settings, I have:
general:
baudrate 115200
uncheck wait for dialtone
extra dial string (most likely, this is your problem)
+cgdcont=1,"IP","internet.proximus.be"
(internet.proximus.be is the accesspoint I need to use)
check cancel if not connected for 120s
port settings:
8, none, 1, hardware
(three next unchecked)
tcp/ip:
use server assigned
uncheck slip
check software compression
check ip header compression
servers:
check use server assigned
Most likely, you don't have the extra dialstring set. I'm not sure what
you should set (I would suggest using the same one as the one I have, but
with the name of your accesspoint). Without this string, I also couldn't
dial.
For test purposes, you can first try to dial a regular phone number: this
doesn't require an extra dial string. That way you can tell if the modem
works correctly.
(FWIW, the same configruation is also usable over an IR connection )
Best of luck,
Jörg
Thanks V J. I'll try and let u know if it works.
Hi again.
I've just tried but it seems that config screens are not the same ones.
settings:
modem: bluetooth
number: *99#
Click to expand...
Click to collapse
This is fine. I had the same number to dial
on the username/password page, in the advanced settings, I have:
general:
baudrate 115200
uncheck wait for dialtone
extra dial string (most likely, this is your problem)
+cgdcont=1,"IP","internet.proximus.be"
(internet.proximus.be is the accesspoint I need to use)
check cancel if not connected for 120s
port settings:
8, none, 1, hardware
(three next unchecked)
Click to expand...
Click to collapse
I don't have these settings. Nothing about baudrate or extra dial string can be setup on my Hermes. I only have the IP settings stuff.
tcp/ip:
use server assigned
uncheck slip
check software compression
check ip header compression
servers:
check use server assigned
Click to expand...
Click to collapse
Same config here
Most likely, you don't have the extra dialstring set. I'm not sure what
you should set (I would suggest using the same one as the one I have, but
with the name of your accesspoint). Without this string, I also couldn't
dial.
For test purposes, you can first try to dial a regular phone number: this
doesn't require an extra dial string. That way you can tell if the modem
works correctly.
(FWIW, the same configruation is also usable over an IR connection )
Best of luck,
Jörg
Click to expand...
Click to collapse
Tried adding the dial string on the *99# number, but it does not work either. It doesn't even appear to try to dial on the other phone. And if I try to enter a normal number, as it is searching for a modem, it says there is no modem on the entered number...
I guess I'll have to google a bit more as it is more likely to be abnormal behaviour of my LG phone.
Anyway, anyother ideas are welcomed.
Thanks!
Here are all my steps:
First I have a screen where I can choose the name of the connection and
the modem. After choosing "bluetooth" and "next", I get a list of paired
devices that support the DUN profile; here I select my Nokia 6260 which
has been paired beforehand.
Next page is the phone number.
Next page has username, password and domain; plus a button labeled
"Advanced". The soft keys are now labeled back and finish.
I click the button Advanced, which brings up a screen with 4 tabs:
general, port settings, tcp/ip and servers.
Then general tab is where I can find the extra dial-string commands.
There must be a way in WM6 to get to these settings, as they are very
standard modem settings.
Jörg
Sorry, double post...
(browser issues)
Jörg
I just upgraded my TyTN with the official wm6 upgrade... and also lost that general tab. Like you, I can't get the TyTN to connect via my other mobile...
Anyone know if there is a registry string that can be added and filled in as extra dial string?
(I have mailed HTC support Europe)
(a search on google yields that this is a common issue on many wm6 devices)
Jörg
It seems you've found the same as I have in google. If I can get anything new, I'll keep u posted.
Cheers for the help anyway.
I found a workaround for my situation (where I use a Nokia 6260 als bluetooth modem).
The 6260 runs Symbian 60 v2.x, and it has this setting:
Menu > Settings > Connection > GPRS
where you can enter an access point. When I enter internet.proximus.be (the same one as the one I'd put in the extra dial string), the TyTN doesn't need an extra dial string to be able to use this connection. I suspect this setting adds tells the Nokia to alter the dialstring so that it works.
On Meinnesyys (or however it is written) blog, it is mentioned that the similar workaround is possible when the device used as modem is running Windows Mobile:
http://www.pocketpcmag.com/blogs/index.php?blog=3&p=1282&more=1&c=1&tb=1&pb=1#more1282
So the extra dial string is not necessary when the modem runs Symbian or WM... As these features are NOT well documented (I guessed the Symbian workaround by reading the referenced blog), perhaps other phones might have similar settings?
Jörg

Activesync Issues w/Kavana ROM & Toshiba BT Stack

OK so this may sound like a broken record, but i will NOT ask 4 help if i feel if i haven't already tried everything else. So here goes (takes a biiig deep breath) .......
This has worked exactly one time since i've upgraded to the kavana 6.1 ROM. I know it's not something wrong with the ROM that would require a reset, since this currently works on my work PC which uses the bluesoleil BT stack.
These are the many many steps I have already tried ( with a little assistance by a few of you already) :
I have made sure that i have gone on my PC to control panel-->bluetooth local COM. Created a toshiba COM port (server-side not client) and have created COM ports ranging from COM Port(s) 2,3,5,6,7,8,9,10,15,16,17,18&19 and each time I've created those COM Ports, I have also mirrored that COM port in Activesync (v 4.5) on my PC to read that COM Port. Second, I have removed any previous pairings from both the PC and from my phone. I then start activesync on my phone and of course it does not detect a partnership, so I search for BT devices and find my PC. I pair to it and when I get to services, it shows wireless stereo and serial port. At this point, I know that I am connected to the PC via BT since my BT icon on my sytem tray has gone from blue w/white BT log to blue w/green BT logo. I then refresh my services several times only for it to give me the same previous 2 services as before. So I thought "maybe it's detecting a serial port that im not assigning Activesync to?"
I then delete the serial COM port I just added in the control panel and refresh my services again on my phone and low and behold, the only service it now shows is wireless stereo. ( SO THIS MUST MEAN THAT IT IS ONLY DETECTING THE SERIAL COM PORT THAT I AM CREATING RIGHT?) I have tried creating a new outgoing COM port on my phone. ( have tried both COM 6 & 7 and also secure connection checked and unchecked. I have also turned on and off OBEX security on my phone. ) I have even tried completely removing activesync and the toshiba bluetooth stack from my PC and re-installing. I have even gone as far as installing toshiba BT stack ver. 4,5 & 6.
Heck, I even found a trial version of bluesoliel just to see if it worked and it didn't even work, same thing with the default MS BT stack. Same issue. I have tried the pairing process from my PC but the only service it wants to connect going that route is wireless file transfer. I have my security on my toshiba BT stack set to low, ( I've even tried standard too) I have tried turning off my firewall (windows firewall only). I have tried disabling my anti-virus ( avast! home edition). I even tried chaning the device name to see if that would work. But no go. Both devices (PC & Phone) have been reset a multitude of times. I have absolutely no problems connecting my device via ActiveSync using the USB Cable. I have tried checking and uncheking the allow USB Connections in connection settings in AS.) I have even tried connecting via connection settings to sniff out the COM ports while I'm trying to refresh the services on my phone at the exact same time it shows smiffing the com port I'm connected to.
So, as you can see by my book I have now written. I am at my wits end on this. Hopefully that wasnt too much to read. I felt like it was important to give you everything I have done so far as not to leave no stone unturned. I really hope this is some sort of simple oversigt on my part. and will welcome any suggestions from anyone, but please, only post a suggestion if you have read what I've already been through. I am not a novice, not a noob and and extremely proficient on my own handling these issues usually. However, I am humbling myself this time for any suggestions that might be a great help.
Thank you and Godspeed.
Anyway. I'm closing my thread. I didnt necessarily figure out exactly what the problem was, but i did somehow, some way fix it.
What id did do in addition to the aforementioned steps was:
i went into regedit on my PC @ HKCU-->Software-->Windows CE Services and i noticed the "defname" value was set to a previous name i had set for the phone. So i changed that to reflect my current phone name. I also changed HKCU-->Software-->Windows CE Services the "serialport" value from COM7 to COM6.
I then went to HKLM-->Software-->Microsoft-->Windows CE Services and Set the "serialport" value to from COM7 to COM6.
So i then opened up control panel and went to bluetooth local COM and deleted any com ports that windows would let me. I then created Com port 6 to be server side serial port. Then i went into activesync on my PC--> connection settings and set it to read COM Port 6. I then removed any pairings from both my PC and my phone and from the phone, I searched for new bluetooth device. When it found the PC it I then saw the bluetooth icon change to green in my taskbar and the active sync symbol started spinning for a couple of seconds. Once i finished adding the device on my phone, I then attempted a connectiion via bluetooth from my phone and voila! i was connected! I went ahead and rebooted both my phone and my PC after i saw that it worked to see if it wasn't a fluke and tried again once both devices were rebooted. And this time......wait for it......It works still! Hooray! So now that i have less than half of the hair in my head since starting this gauntlet of terror. I can now say. PROBLEM SOLVED. Maybe this will help others that may have had this issue b-4. The one thing i read on another forum that i hadn't tried yet (which is most likely what solved it 4 me) was that i made sure i removed any com ports, whether it me server or client side com ports on my PC and i left them off when i created just one new server serial COM port.

Bluetooth Serial Port message is a problem

Hi all,
On the HTC TP2 we receive the serial port message every time we try to open a blue tooth connection. Is there any way to get rid of this, of have it automatically pick the correct port each time a connection is made??
We have a Windows application written in VB that utilizes several bluetooth devices.
This is the exact message
Bluetooth Serial Port
Please Select a serial port connection shortcut to connect.
Add...
/*
List of existing connections
*/
I was able to find this link which has the same problem as we do, but was unhelpful.
http : / / forum . xda - developers . com / showthread.php ? t = 573828
(cant add links to my posts because I am a new member, please remove spaces)
I look forward to hearing from you all,
Thanks ,
Ryan
diito have exactly the same problem on hd2....
somebody help please
We are still experiencing difficulties with this. We have found out that the blue tooth stack used in the HTC Touch pro 2 is made by Broadcom. We are currently trying to work with them for a solution, and any help here is appreciated.
Same problem ...
How can i fix it? I have the same problem ...

[Q] visual c# GPS application using OGL library

Hi!
I am triing to make a Windows Mobile gps application that is able to determine the current position and writes it on a form. Iam using the OGL open source GPS library.
My device is a trimble geo xh 2005. When i deploy my project on it, and try to connect to the receiver it keeps throwing an error: "An error has occured connecting to the receiver(error code5)" .
I've attached my project.
Maybe my gps setting are incorrect, i dont know. Just in case: GPS software port: 3; GPS hardware port:8 Baud rate: 9600 and Manage GPS automatically checkbox is set.
The above error appears giving port 3 in the application. If i choose port 8 it tells me that the port is already in use.
I cant figure out what am i doing wrong:-(
The GPS settings or something in the code?
Any help would be appreciated!
Never mind!
I have solved it, I was using the wrong port as i suspected

Categories

Resources