I try to open a virual com port to read the datastream of a GPS
receiver (TomTom Navigator) which is connected via bluetooth to my
iPAQ 5550 Pocket PC

I am using using Microsoft eMbedded Visual C++ 4. My Bluetooth-
Settings say Inbound COM port is 5, outbound COM port is 8.

The following code always returns an invalid handle and error code
55:

HANDLE hSerialPort = CreateFile(TEXT("COM8:"),
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);

if (hSerialPort == INVALID_HANDLE_VALUE)
{
CString ErrorMsg = _T("");
ReturnValue = GetLastError();
ErrorMsg.Format(_T("Cannot open com port! Error: %d"), ReturnValue);

m_SOEdit.SetWindowText((LPCTSTR)ErrorMsg);
return TRUE;

}

if(GetCommState(hSerialPort, &commDCB))
{
CString Props = _T("");
Props.Format(_T("DCBLength: %d\r\nBaudRate: %d\r\nBinary: %d\r\n")
_T("Parity: %d\r\n"),
commDCB.DCBlength, commDCB.BaudRate,
commDCB.fBinary, commDCB.fParity);
m_SOEdit.SetWindowText((LPCTSTR)Props);
}

if (hSerialPort)
CloseHandle(hSerialPort);

The receiver is connected and the connection is valid. Does anybody
have an idea whats wrong?

Many thanks for your help!
Tom

*-------------------------------------------------*
* *
* Smart Solutions AG *
* Baarerstrasse 98, Postfach 2642 *
* 6302 Zug / Switzerland *
* *
* Your partner in enterprise and mobile computing *
* *
* http://www.smart-solutions.ch *
* *
*-------------------------------------------------*

Re: Accessing virtual serial port (COM8) of a bluetooth connected GPS receiver by NikV

NikV
Tue Apr 26 12:00:56 CDT 2005

ttn3 is renowned for messing up the bluetooth stack and preventing access by
others (even with ttn3 not running) - I use gpsgate - shareware which takes
the input from the com8 port and provides a virtual port (in my case port 7)
avaiable for other application(s). It is possible to get the data from ttn3
using their sdk but that costs more.

Apologies if this does not relate to your problem

Nik


"Thomas Bednarz" <bednarz AT smartsol DOT ch> wrote in message
news:O$g8ignSFHA.3788@tk2msftngp13.phx.gbl...
>I try to open a virual com port to read the datastream of a GPS
> receiver (TomTom Navigator) which is connected via bluetooth to my
> iPAQ 5550 Pocket PC
>
> I am using using Microsoft eMbedded Visual C++ 4. My Bluetooth-
> Settings say Inbound COM port is 5, outbound COM port is 8.
>
> The following code always returns an invalid handle and error code
> 55:
>
> HANDLE hSerialPort = CreateFile(TEXT("COM8:"),
> GENERIC_READ,
> 0,
> NULL,
> OPEN_EXISTING,
> FILE_ATTRIBUTE_NORMAL, NULL);
>
> if (hSerialPort == INVALID_HANDLE_VALUE)
> {
> CString ErrorMsg = _T("");
> ReturnValue = GetLastError();
> ErrorMsg.Format(_T("Cannot open com port! Error: %d"), ReturnValue);
>
> m_SOEdit.SetWindowText((LPCTSTR)ErrorMsg);
> return TRUE;
>
> }
>
> if(GetCommState(hSerialPort, &commDCB))
> {
> CString Props = _T("");
> Props.Format(_T("DCBLength: %d\r\nBaudRate: %d\r\nBinary: %d\r\n")
> _T("Parity: %d\r\n"),
> commDCB.DCBlength, commDCB.BaudRate,
> commDCB.fBinary, commDCB.fParity);
> m_SOEdit.SetWindowText((LPCTSTR)Props);
> }
>
> if (hSerialPort)
> CloseHandle(hSerialPort);
>
> The receiver is connected and the connection is valid. Does anybody
> have an idea whats wrong?
>
> Many thanks for your help!
> Tom
>
> *-------------------------------------------------*
> * *
> * Smart Solutions AG *
> * Baarerstrasse 98, Postfach 2642 *
> * 6302 Zug / Switzerland *
> * *
> * Your partner in enterprise and mobile computing *
> * *
> * http://www.smart-solutions.ch *
> * *
> *-------------------------------------------------*



Re: Re: Accessing virtual serial port (COM8) of a bluetooth by Thomas

Thomas
Tue Apr 26 13:26:44 CDT 2005

Hello Nik,

This is EXACTLY my problem. But I DO have the TomTom SDK but I did
not find an API which lets me read the stream from the receiver. As I
understand the documentation you can SEND data to TomTom. I probably
have to ask TomTom Support.

Thanks a lot.
Tom
26.04.2005 19:00:56
NikV <nk@nospam.demon.co.uk> wrote in message
<d4ls4a$u5$1$8300dec7@news.demon.co.uk>

> ttn3 is renowned for messing up the bluetooth stack and preventing
access by
> others (even with ttn3 not running) - I use gpsgate - shareware
which takes
> the input from the com8 port and provides a virtual port (in my
case port 7)
> avaiable for other application(s). It is possible to get the data
from ttn3
> using their sdk but that costs more.
>
> Apologies if this does not relate to your problem
>
> Nik
>
>
> "Thomas Bednarz" <bednarz AT smartsol DOT ch> wrote in message
> news:O$g8ignSFHA.3788@tk2msftngp13.phx.gbl...
> >I try to open a virual com port to read the datastream of a GPS
> > receiver (TomTom Navigator) which is connected via bluetooth to
my
> > iPAQ 5550 Pocket PC
> >
> > I am using using Microsoft eMbedded Visual C++ 4. My Bluetooth-
> > Settings say Inbound COM port is 5, outbound COM port is 8.
> >
> > The following code always returns an invalid handle and error
code
> > 55:
> >
> > HANDLE hSerialPort = CreateFile(TEXT("COM8:"),
> > GENERIC_READ,
> > 0,
> > NULL,
> > OPEN_EXISTING,
> > FILE_ATTRIBUTE_NORMAL, NULL);
> >
> > if (hSerialPort == INVALID_HANDLE_VALUE)
> > {
> > CString ErrorMsg = _T("");
> > ReturnValue = GetLastError();
> > ErrorMsg.Format(_T("Cannot open com port! Error: %d"),
ReturnValue);
> >
> > m_SOEdit.SetWindowText((LPCTSTR)ErrorMsg);
> > return TRUE;
> >
> > }
> >
> > if(GetCommState(hSerialPort, &commDCB))
> > {
> > CString Props = _T("");
> > Props.Format(_T("DCBLength: %d\r\nBaudRate: %d\r\nBinary:
%d\r\n")
> > _T("Parity: %d\r\n"),
> > commDCB.DCBlength, commDCB.BaudRate,
> > commDCB.fBinary, commDCB.fParity);
> > m_SOEdit.SetWindowText((LPCTSTR)Props);
> > }
> >
> > if (hSerialPort)
> > CloseHandle(hSerialPort);
> >
> > The receiver is connected and the connection is valid. Does
anybody
> > have an idea whats wrong?
> >
> > Many thanks for your help!
> > Tom
> >
> > *-------------------------------------------------*
> > * *
> > * Smart Solutions AG *
> > * Baarerstrasse 98, Postfach 2642 *
> > * 6302 Zug / Switzerland *
> > * *
> > * Your partner in enterprise and mobile computing *
> > * *
> > * http://www.smart-solutions.ch *
> > * *
> > *-------------------------------------------------*

Re: Re: Accessing virtual serial port (COM8) of a bluetooth connected GPS receiver by Mike

Mike
Wed Apr 27 03:11:23 CDT 2005

I don't think you can directly read the GPS stream using the SDK - you would
use their function to get the basic location information (lat / long /
heading / speed) from the application. Or, you can open the port, read the
stream, then use their function to put the data back into TTN. Basically if
TTN has the input stream, you can only access parts of the data. But the
comments regarding the TomTom Bluetooth driver are also valid - even if you
don't run TTN, some versions of their driver will prevent you accessing the
GPS port.

Mike.


"Thomas Bednarz" <pub AT bednarz DOT ch> wrote in message
news:uMnyh0oSFHA.2304@tk2msftngp13.phx.gbl...
> Hello Nik,
>
> This is EXACTLY my problem. But I DO have the TomTom SDK but I did
> not find an API which lets me read the stream from the receiver. As I
> understand the documentation you can SEND data to TomTom. I probably
> have to ask TomTom Support.
>
> Thanks a lot.
> Tom
> 26.04.2005 19:00:56
> NikV <nk@nospam.demon.co.uk> wrote in message
> <d4ls4a$u5$1$8300dec7@news.demon.co.uk>
>
>> ttn3 is renowned for messing up the bluetooth stack and preventing
> access by
>> others (even with ttn3 not running) - I use gpsgate - shareware
> which takes
>> the input from the com8 port and provides a virtual port (in my
> case port 7)
>> avaiable for other application(s). It is possible to get the data
> from ttn3
>> using their sdk but that costs more.
>>
>> Apologies if this does not relate to your problem
>>
>> Nik
>>
>>
>> "Thomas Bednarz" <bednarz AT smartsol DOT ch> wrote in message
>> news:O$g8ignSFHA.3788@tk2msftngp13.phx.gbl...
>> >I try to open a virual com port to read the datastream of a GPS
>> > receiver (TomTom Navigator) which is connected via bluetooth to
> my
>> > iPAQ 5550 Pocket PC
>> >
>> > I am using using Microsoft eMbedded Visual C++ 4. My Bluetooth-
>> > Settings say Inbound COM port is 5, outbound COM port is 8.
>> >
>> > The following code always returns an invalid handle and error
> code
>> > 55:
>> >
>> > HANDLE hSerialPort = CreateFile(TEXT("COM8:"),
>> > GENERIC_READ,
>> > 0,
>> > NULL,
>> > OPEN_EXISTING,
>> > FILE_ATTRIBUTE_NORMAL, NULL);
>> >
>> > if (hSerialPort == INVALID_HANDLE_VALUE)
>> > {
>> > CString ErrorMsg = _T("");
>> > ReturnValue = GetLastError();
>> > ErrorMsg.Format(_T("Cannot open com port! Error: %d"),
> ReturnValue);
>> >
>> > m_SOEdit.SetWindowText((LPCTSTR)ErrorMsg);
>> > return TRUE;
>> >
>> > }
>> >
>> > if(GetCommState(hSerialPort, &commDCB))
>> > {
>> > CString Props = _T("");
>> > Props.Format(_T("DCBLength: %d\r\nBaudRate: %d\r\nBinary:
> %d\r\n")
>> > _T("Parity: %d\r\n"),
>> > commDCB.DCBlength, commDCB.BaudRate,
>> > commDCB.fBinary, commDCB.fParity);
>> > m_SOEdit.SetWindowText((LPCTSTR)Props);
>> > }
>> >
>> > if (hSerialPort)
>> > CloseHandle(hSerialPort);
>> >
>> > The receiver is connected and the connection is valid. Does
> anybody
>> > have an idea whats wrong?
>> >
>> > Many thanks for your help!
>> > Tom
>> >
>> > *-------------------------------------------------*
>> > * *
>> > * Smart Solutions AG *
>> > * Baarerstrasse 98, Postfach 2642 *
>> > * 6302 Zug / Switzerland *
>> > * *
>> > * Your partner in enterprise and mobile computing *
>> > * *
>> > * http://www.smart-solutions.ch *
>> > * *
>> > *-------------------------------------------------*



Re: Re: Re: Accessing virtual serial port (COM8) of a bluetooth by Thomas

Thomas
Wed Apr 27 08:33:57 CDT 2005

Hello Mike,

Well I solved it. Fact is, that the TomTom Bluetooth driver is crap.
I replaced it with the default driver of my device. No I can access
COM8 and read the datastream from the receiver. This data can now be
sent to TomTom with their SDK function CopyDataToTomTomGPSEngine(...).

So the base problem is really their Bluetooth driver.
Thanks and cheers

Tom
27.04.2005 10:11:23
Mike <test@test.com> wrote in message
<uhUkuCwSFHA.1040@TK2MSFTNGP10.phx.gbl>

> I don't think you can directly read the GPS stream using the SDK -
you would
> use their function to get the basic location information (lat /
long /
> heading / speed) from the application. Or, you can open the port,
read the
> stream, then use their function to put the data back into TTN.
Basically if
> TTN has the input stream, you can only access parts of the data.
But the
> comments regarding the TomTom Bluetooth driver are also valid -
even if you
> don't run TTN, some versions of their driver will prevent you
accessing the
> GPS port.
>
> Mike.
>
>
> "Thomas Bednarz" <pub AT bednarz DOT ch> wrote in message
> news:uMnyh0oSFHA.2304@tk2msftngp13.phx.gbl...
> > Hello Nik,
> >
> > This is EXACTLY my problem. But I DO have the TomTom SDK but I
did
> > not find an API which lets me read the stream from the receiver.
As I
> > understand the documentation you can SEND data to TomTom. I
probably
> > have to ask TomTom Support.
> >
> > Thanks a lot.
> > Tom
> > 26.04.2005 19:00:56
> > NikV <nk@nospam.demon.co.uk> wrote in message
> > <d4ls4a$u5$1$8300dec7@news.demon.co.uk>
> >
> >> ttn3 is renowned for messing up the bluetooth stack and
preventing
> > access by
> >> others (even with ttn3 not running) - I use gpsgate - shareware
> > which takes
> >> the input from the com8 port and provides a virtual port (in my
> > case port 7)
> >> avaiable for other application(s). It is possible to get the
data
> > from ttn3
> >> using their sdk but that costs more.
> >>
> >> Apologies if this does not relate to your problem
> >>
> >> Nik
> >>
> >>
> >> "Thomas Bednarz" <bednarz AT smartsol DOT ch> wrote in message
> >> news:O$g8ignSFHA.3788@tk2msftngp13.phx.gbl...
> >> >I try to open a virual com port to read the datastream of a GPS
> >> > receiver (TomTom Navigator) which is connected via bluetooth
to
> > my
> >> > iPAQ 5550 Pocket PC
> >> >
> >> > I am using using Microsoft eMbedded Visual C++ 4. My Bluetooth-

> >> > Settings say Inbound COM port is 5, outbound COM port is 8.
> >> >
> >> > The following code always returns an invalid handle and error
> > code
> >> > 55:
> >> >
> >> > HANDLE hSerialPort = CreateFile(TEXT("COM8:"),
> >> > GENERIC_READ,
> >> > 0,
> >> > NULL,
> >> > OPEN_EXISTING,
> >> > FILE_ATTRIBUTE_NORMAL, NULL);
> >> >
> >> > if (hSerialPort == INVALID_HANDLE_VALUE)
> >> > {
> >> > CString ErrorMsg = _T("");
> >> > ReturnValue = GetLastError();
> >> > ErrorMsg.Format(_T("Cannot open com port! Error: %d"),
> > ReturnValue);
> >> >
> >> > m_SOEdit.SetWindowText((LPCTSTR)ErrorMsg);
> >> > return TRUE;
> >> >
> >> > }
> >> >
> >> > if(GetCommState(hSerialPort, &commDCB))
> >> > {
> >> > CString Props = _T("");
> >> > Props.Format(_T("DCBLength: %d\r\nBaudRate: %d\r\nBinary:
> > %d\r\n")
> >> > _T("Parity: %d\r\n"),
> >> > commDCB.DCBlength, commDCB.BaudRate,
> >> > commDCB.fBinary, commDCB.fParity);
> >> > m_SOEdit.SetWindowText((LPCTSTR)Props);
> >> > }
> >> >
> >> > if (hSerialPort)
> >> > CloseHandle(hSerialPort);
> >> >
> >> > The receiver is connected and the connection is valid. Does
> > anybody
> >> > have an idea whats wrong?
> >> >
> >> > Many thanks for your help!
> >> > Tom
> >> >
> >> > *-------------------------------------------------*
> >> > * *
> >> > * Smart Solutions AG *
> >> > * Baarerstrasse 98, Postfach 2642 *
> >> > * 6302 Zug / Switzerland *
> >> > * *
> >> > * Your partner in enterprise and mobile computing *
> >> > * *
> >> > * http://www.smart-solutions.ch *
> >> > * *
> >> > *-------------------------------------------------*
*-------------------------------------------------*
* *
* Smart Solutions AG *
* Baarerstrasse 98, Postfach 2642 *
* 6302 Zug / Switzerland *
* *
* Your partner in enterprise and mobile computing *
* *
* http://www.smart-solutions.ch *
* *
*-------------------------------------------------*

Re: Accessing virtual serial port (COM8) of a bluetooth connected by andrej

andrej
Wed Apr 27 13:11:47 CDT 2005

Hi,

Yes that's the problem of the TT driver. It prevents other App. to use
the Port. They replaced the original driver to fix a BUG on the iPAQ
2210 device. (If you have a Bluetooth connection and turn off the device
you can not turn it on anymore!)
Navigon the biggest competitor have also a fix for this BUG, but they
did it much better, there the Port is usable for all App.

Regards, Andrej

PS: You should try Navigon MobileNavigator in my opinion it's much
better then TT.




Thomas Bednarz schrieb:
> Hello Mike,
>
> Well I solved it. Fact is, that the TomTom Bluetooth driver is crap.
> I replaced it with the default driver of my device. No I can access
> COM8 and read the datastream from the receiver. This data can now be
> sent to TomTom with their SDK function CopyDataToTomTomGPSEngine(...).
>
> So the base problem is really their Bluetooth driver.
> Thanks and cheers
>
> Tom
> 27.04.2005 10:11:23
> Mike <test@test.com> wrote in message
> <uhUkuCwSFHA.1040@TK2MSFTNGP10.phx.gbl>
>
>>I don't think you can directly read the GPS stream using the SDK -
>
> you would
>
>>use their function to get the basic location information (lat /
>
> long /
>
>>heading / speed) from the application. Or, you can open the port,
>
> read the
>
>>stream, then use their function to put the data back into TTN.
>
> Basically if
>
>>TTN has the input stream, you can only access parts of the data.
>
> But the
>
>>comments regarding the TomTom Bluetooth driver are also valid -
>
> even if you
>
>>don't run TTN, some versions of their driver will prevent you
>
> accessing the
>
>>GPS port.
>>
>>Mike.
>>
>>
>>"Thomas Bednarz" <pub AT bednarz DOT ch> wrote in message
>>news:uMnyh0oSFHA.2304@tk2msftngp13.phx.gbl...
>>
>>>Hello Nik,
>>>
>>>This is EXACTLY my problem. But I DO have the TomTom SDK but I
>
> did
>
>>>not find an API which lets me read the stream from the receiver.
>
> As I
>
>>>understand the documentation you can SEND data to TomTom. I
>
> probably
>
>>>have to ask TomTom Support.
>>>
>>>Thanks a lot.
>>>Tom
>>>26.04.2005 19:00:56
>>>NikV <nk@nospam.demon.co.uk> wrote in message
>>><d4ls4a$u5$1$8300dec7@news.demon.co.uk>
>>>
>>>>ttn3 is renowned for messing up the bluetooth stack and
>
> preventing
>
>>>access by
>>>
>>>>others (even with ttn3 not running) - I use gpsgate - shareware
>>>
>>>which takes
>>>
>>>>the input from the com8 port and provides a virtual port (in my
>>>
>>>case port 7)
>>>
>>>>avaiable for other application(s). It is possible to get the
>
> data
>
>>>from ttn3
>>>
>>>>using their sdk but that costs more.
>>>>
>>>>Apologies if this does not relate to your problem
>>>>
>>>>Nik
>>>>
>>>>
>>>>"Thomas Bednarz" <bednarz AT smartsol DOT ch> wrote in message
>>>>news:O$g8ignSFHA.3788@tk2msftngp13.phx.gbl...
>>>>
>>>>>I try to open a virual com port to read the datastream of a GPS
>>>>>receiver (TomTom Navigator) which is connected via bluetooth
>
> to
>
>>>my
>>>
>>>>>iPAQ 5550 Pocket PC
>>>>>
>>>>>I am using using Microsoft eMbedded Visual C++ 4. My Bluetooth-
>
>
>>>>>Settings say Inbound COM port is 5, outbound COM port is 8.
>>>>>
>>>>>The following code always returns an invalid handle and error
>>>
>>>code
>>>
>>>>>55:
>>>>>
>>>>>HANDLE hSerialPort = CreateFile(TEXT("COM8:"),
>>>>> GENERIC_READ,
>>>>> 0,
>>>>> NULL,
>>>>> OPEN_EXISTING,
>>>>> FILE_ATTRIBUTE_NORMAL, NULL);
>>>>>
>>>>>if (hSerialPort == INVALID_HANDLE_VALUE)
>>>>>{
>>>>> CString ErrorMsg = _T("");
>>>>> ReturnValue = GetLastError();
>>>>> ErrorMsg.Format(_T("Cannot open com port! Error: %d"),
>>>
>>>ReturnValue);
>>>
>>>>> m_SOEdit.SetWindowText((LPCTSTR)ErrorMsg);
>>>>> return TRUE;
>>>>>
>>>>>}
>>>>>
>>>>>if(GetCommState(hSerialPort, &commDCB))
>>>>>{
>>>>> CString Props = _T("");
>>>>> Props.Format(_T("DCBLength: %d\r\nBaudRate: %d\r\nBinary:
>>>
>>>%d\r\n")
>>>
>>>>> _T("Parity: %d\r\n"),
>>>>> commDCB.DCBlength, commDCB.BaudRate,
>>>>> commDCB.fBinary, commDCB.fParity);
>>>>> m_SOEdit.SetWindowText((LPCTSTR)Props);
>>>>>}
>>>>>
>>>>>if (hSerialPort)
>>>>> CloseHandle(hSerialPort);
>>>>>
>>>>>The receiver is connected and the connection is valid. Does
>>>
>>>anybody
>>>
>>>>>have an idea whats wrong?
>>>>>
>>>>>Many thanks for your help!
>>>>>Tom
>>>>>
>>>>>*-------------------------------------------------*
>>>>>* *
>>>>>* Smart Solutions AG *
>>>>>* Baarerstrasse 98, Postfach 2642 *
>>>>>* 6302 Zug / Switzerland *
>>>>>* *
>>>>>* Your partner in enterprise and mobile computing *
>>>>>* *
>>>>>* http://www.smart-solutions.ch *
>>>>>* *
>>>>>*-------------------------------------------------*
>
> *-------------------------------------------------*
> * *
> * Smart Solutions AG *
> * Baarerstrasse 98, Postfach 2642 *
> * 6302 Zug / Switzerland *
> * *
> * Your partner in enterprise and mobile computing *
> * *
> * http://www.smart-solutions.ch *
> * *
> *-------------------------------------------------*