Send data to serial port for other application

schimanski

Well-Known Member
Licensed User
Longtime User
Hello!

Is it possible to send GPS-data out of a basic4ppc-application to a serial port with serial.output(String) and tap this data with other GPS-applications?

I have asked the same problem in another thread with looking for a null modem emulator, but i thought, that i have perhaps oversee something. Perhaps there is another chance to to it by using ther serial lib.

:sign0148:

:confused::confused::confused:

m.f.G.

schimanski
 

taximania

Well-Known Member
Licensed User
Longtime User
To reply to both your posts in 1,
and I'm probably wrong :sign0148:

Connect the TX and RX lines of your COM port together.
Anything you send will be received from the same port.

You may need an RS232 serial cable for your unit,
as apposed to a USB cable. :sign0137:
 

willisgt

Active Member
Licensed User
All right, you've got me curious...

It sounds as though you want to run one application which would read the GPS data and pass it to other applications.

What prevents these other applications from simply reading the GPS data directly?

Gary
 

schimanski

Well-Known Member
Licensed User
Longtime User
the sense of reading GPS-data

Hello Gary!

"What prevents these other applications from simply reading the GPS data directly?"

I have written an application, that takes the GPS-data from a server. Now, my application creates a NMEA-protokoll with these GPS-data. After that, I want to show these GPS-data in every navigation software (like TomTom for example), which is able to read NMEA-strings. (Both applications runs on one Pocket-PC)

I have tested two null modem emulators. The first is "VSPD Mobile", it runs fine, but it is to expensive. The second is "ComPipe", but i'm not able to run it, there is no data-transfer between the existing com-ports.

Taxmania says, that i have to connect the TX and RX lines of the COM port together and anything will be received from the same port. I think, it's like a cross-over cable, but how should i make this in my Pocket-PC?

Is there no way to program the TX and RX lines in the COM ports?

:confused::confused::confused:

schimanski
 

schimanski

Well-Known Member
Licensed User
Longtime User
I have found an answer for my problem....

Hello!

I have found an answer for my problem and I will post it, because it is perhaps interested for someone::sign0060:

Under

http://www.franson.com/serialtools/

you can get different libraries for .Net Framework and .Net Compact Framework (1.0 and 2.0) to create serial and virtual serial ports. So it is very easy to create a virtual serial port pair and send and receive data from the first to the second port. In the sequel, you can create your own null modem emulator for example.

To create a null modem emulator on your device under .Net Compact Framework 2.0, you only have to do this:

Contain first the SerialNET.200.CF.dll and create a virtual serial input and output-object. For example:

Vserial_input.VPort
Vserial_output.VPort

After that, you init the virtual ports and open them. In the code, I will create a virtual serial port pair with port 7 and 8.

B4X:
Sub App_Start
    Vserial_input.New1
    Vserial_output.New1

    Vserial_input.ComPort=7
    Vserial_output.ComPort=8

    Vserial_input.Created=true     'open virtual port 7'
    Vserial_output.Created=true   'open virtual port 8'

    timer1.Enabled=true
End Sub

Sub Timer1_Tick
    Errorlabel(IOError)
    DataString=Vserial_input.DataFromPort(0,0)   'null modem function'
    Vserial_output.DataToPort(DataString)
    IOError:
End Sub

With this simple code, you have your own null modem emulator. Now you can send with serial.output(String) from the Serial2.dll data out of your own application to COM7, which is received from COM8. So you can get this data with serial.readstring out of another application. In this way, you can send data from your own application to a navigation-software like GoogleMaps or TomTom Navigator for example.

To use SerialTools SDK from Franson, you first have to create a license-object with a trial- or full-licensekey.

I hope, there is someone who can use this in his own applications.
 
Top