telnet

derez

Expert
Licensed User
Longtime User
The Android Emulator can run GPS applications. It recieves the GPS data from the console after creating telnet connection:
> telnet localhost <port> (for example 5554)

and then the commands with nmea sentences:

geo nmea $GPGGA.....etc.

how can I send the nmea data from a text file to the application ? may be by using network library ?

Thanks in advance for ideas.
 
Last edited:

derez

Expert
Licensed User
Longtime User
Erel
I don't believe it. You invented Basic4PPC and you send me to look at java ?:confused:

I expected a way to do it by B4P...:(

If I understand correctly, the functionality at the link is for creation of GPS listener in order to use it as part of GPS application.
What I asked for is to be able to send a stream of NMEA sentences from a file to an already existing application, using the existing option of console commands.
 
Last edited:
Upvote 0

derez

Expert
Licensed User
Longtime User
Erel
Can it be implemented by B4PPC ? how do I send the stream to the emulator port ?
 
Last edited:
Upvote 0

derez

Expert
Licensed User
Longtime User
From the Android emulator site:
To connect to the console of any running emulator instance at any time, use this command:

B4X:
telnet localhost <console-port>
An emulator instance occupies a pair of adjacent ports: a console port and an adb port. The port numbers differ by 1, with the adb port having the higher port number. The console of the first emulator instance running on a given machine uses console port 5554 and adb port 5555. Subsequent instances use port numbers increasing by two — for example, 5556/5557, 5558/5559, and so on. Up to 16 concurrent emulator instances can run a console facility.
The console provides commands to let you set the geo position used by an emulator emulated device. You can use the geo command to send a simple GPS fix to the emulator, without needing to use NMEA 1083 formatting. The usage for the command is:

B4X:
geo <fix|nmea>
The geo command supports the subcommands listed in the table below.

Subcommand Description Comments
B4X:
fix <longitude> <latitude> [<altitude>]
Send a simple GPS fix to the emulator instance. Specify longitude and latitude in decimal degrees. Specify altitude in meters.
B4X:
nmea <sentence>
Send an NMEA 0183 sentence to the emulated device, as if it were sent from an emulated GPS modem. <sentence> must begin with '$GP'. Only '$GPGGA' and '$GPRCM' sentences are currently supported.

You can issue the geo command to fix the GPS location as soon as an emulator instance is running.

I checked it and it works with a simple GPS application, when typed on the Console. I tried to put the nmea in a batch file but after the telnet command it does not accept inputs from the batch file. So I need a program to send the stream instead of typing it line by line.

Edit: I found this in the same site, it should be the answer but it may take sometime until I'll figure it out.

Setting up Redirections through the Emulator Console
Each emulator instance provides a control console the you can connect to, to issue commands that are specific to that instance. You can use the redir console command to set up redirections as needed for an emulator instance.

First, determine the console port number for the target emulator instance. For example, the console port number for the first emulator instance launched is 5554. Next, connect to the console of the target emulator instance, specifying its console port number, as follows:

B4X:
telnet localhost 5554
Once connected, use the redir command to work with redirections. To add a redirection, use:.

B4X:
add <protocol>:<host-port>:<guest-port>
where <protocol> is either tcp or udp, and <host-port> and <guest-port> sets the mapping between your own machine and the emulated system, respectively.

For example, the following command sets up a redirection that will handle all incoming TCP connections to your host (development) machine on 127.0.0.1:5000 and will pass them through to the emulated system's 10.0.2.15:6000.:

B4X:
redir add tcp:5000:6000
 
Last edited:
Upvote 0
Top