In java,how to get other devices GPS information from API?

GPS module is loaded through the serial port on the RouterOS device, and then in the java environment through “ret.sendCommand ("/ system / gps / monitor \ n = once =. Proplist = date-and-time, latitude, longitude, altitude, satellites \ n ") ”to get the RouterOS device GPS information, but how to get other RouterOS devices GPS information,other RouterOS devices have established a connection with the RouterOS device.

Use

/system/gps/set
=port=usb2

to change the port from your current GPS, to the other GPS (in the above example, assumed to be at port “usb2”), and then call “monitor”, which would be taking effect on that new GPS.

Or do you want to capture the data from all connected GPS devices at once? I don’t think RouterOS supports that… But I mean, who has multiple GPS devices on a single RouterOS device anyway?

I mean, getting other RouterOS devices GPS information,not getting multiple GPS information on a single RouterOS device.

[quote=“boen_robot”]Use

/system/gps/set
=port=usb2

to change the port from your current GPS, to the other GPS (in the above example, assumed to be at port “usb2”), and then call “monitor”, which would be taking effect on that new GPS.

Or do you want to capture the data from all connected GPS devices at once? I don’t think RouterOS supports that… But I mean, who has multiple GPS devices on a single RouterOS device anyway?[/quote I mean, getting other RouterOS devices GPS information,not getting multiple GPS information on a single RouterOS device.

You’d have to connect to each RouterOS device separately, the same way you connected to this first one. You can create a new thread for every connection, so that you can query all routers’ GPS devices at almost the same time.

Creating a new thread for every connection is a good way,but how can I know from which routerOS device I get the GPS information?creating a connection is by IP address,and all routerOS devices component mesh networks.

Depends on how exactly you’d organize your whole code, but the gist is that you can pass a string alongside the connection to each thread.

Alternatively, you can send a different “.tag” to each router, and analyze the response to check with tag is it, but that only needlessly increases the bandwidth required between the routers and your app.

Thank you,I hava anther question. When we enter RouterOS by Winbox,in content: IP, Neighbors,we can see other devices IP addresses and MAC addresses.Why?some devices MAC addresses are ether1’s MAC addresses and some devices MAC addresses are wireless’s MAC addresses.How can I set?Let me get the MAC address is just wireless’s MAC address.

You can do it by using a query. They work similarly to the filters in Winbox.

/ip/neighbor/print
?interface=wlan1

will show you all neibours reachable via the “wlan1” interface.

The equivalent from console is the “where” argument:

/ip neighbor print where interface=wlan1