Meshtastic-Android icon indicating copy to clipboard operation
Meshtastic-Android copied to clipboard

Waypoint message support

Open MaximKrasikov opened this issue 2 years ago • 13 comments

would it be possible to implement sending a location on the map, as a named marker displayed on the map, without having a device at that specific location? It would be great to be able to e.g define a common meeting point that appears on everyone’s map without having to be at that point already.

MaximKrasikov avatar Sep 08 '22 14:09 MaximKrasikov

this can be done adding support for Waypoint messages: https://meshtastic.org/docs/developers/protobufs/api#waypoint

andrekir avatar Sep 08 '22 20:09 andrekir

will i be able to send list of markers to other users via waypoint ? Do I need to fix the firmware of the device and proto for this?

MaximKrasikov avatar Sep 08 '22 21:09 MaximKrasikov

will i be able to send list of markers to other users via waypoint ?

yes. same as other message types.

Do I need to fix the firmware of the device and proto for this?

no. just the app side.

andrekir avatar Sep 08 '22 21:09 andrekir

I apologize in advance for the stupid question. I just started to deal with meshtastic I made changes to NodeInfo like EnvironmentMetrics in your last commits and add handleReceivedWaypoint in MeshService. Also create my custom marker in MapFragment via long click on osm view and save it in NodeInfo my new Waypoint, but nothing is sent. Are these all the changes I need? my device-firmware 1.3.39 and 1.3.40 application in android Thanks for adding osm)

MaximKrasikov avatar Sep 09 '22 10:09 MaximKrasikov

feel free to ask questions. make sure firmware and app are on 1.3.40, there are lots of breaking changes with previous versions.

waypoints are handled as DataPacket instead of NodeInfo. quick draft:

  • add WAYPOINT_APP_VALUE to recentDataPackets in MeshService (same as TEXT_MESSAGE_APP_VALUE)
  • add waypoint object in model/MessageState and filters by type == TEXT_MESSAGE_APP_VALUE / WAYPOINT_APP_VALUE for each list
  • from MapFragment use MessageState.waypoints.observe to build markers
  • add logic to send waypoint messages similar to MessageState.sendMessage (initially just send to the primary channel).

also need to check how the waypoint payload looks like and how to get the data from DataPacket.bytes

andrekir avatar Sep 09 '22 12:09 andrekir

Do I need to change something in MainActivity? Need to make edits only in MeshService, MessageState, MapFragment and NodeInfo?

MaximKrasikov avatar Sep 09 '22 17:09 MaximKrasikov

no changes in MainActivity or Nodeinfo. I added the DataPacket payload parser for Waypoints here. MeshService, MessageState and MapFragment should work. 👍

andrekir avatar Sep 10 '22 01:09 andrekir

please add example in next commit. One may without using on map. Just functional, like your parser

MaximKrasikov avatar Sep 12 '22 09:09 MaximKrasikov

check: https://github.com/andrekir/Meshtastic-Android/tree/waypoint-test

you can send a waypoint from the menu and it will show up on MapFragment.

andrekir avatar Sep 13 '22 23:09 andrekir

thank you very much!

MaximKrasikov avatar Sep 14 '22 07:09 MaximKrasikov

test point is initialized latitude=0 and longitude=0

MaximKrasikov avatar Sep 15 '22 11:09 MaximKrasikov

thanks for the help, i figured it out

MaximKrasikov avatar Sep 15 '22 13:09 MaximKrasikov

@MaximKrasikov we're moving our packet database to Room, I added a waypoints livedata source in MapFragment you can use here.

andrekir avatar Sep 16 '22 01:09 andrekir

basic functionality has been added in #578 but still a few TODOs:

  • [x] waypoint editing
  • [ ] display bearing/distance from local node
  • [x] add keyboard emoji picker
  • [ ] add Expire date/time picker

andrekir avatar Feb 01 '23 15:02 andrekir

Would be nice if there were notifications for new/edited waypoints too~

prokrypt avatar May 08 '23 18:05 prokrypt

Is there any way to add waypoints as a list of Lat/Lon/Name/Description/Icon from a file? It will be usefull in case of an emergency where a list of usefull POI can be activated at once. The file can be prepared in time and actualised without cluttering the map when there is no need. When the emergency is declared, the file can be imported and the POI then sent to the group. This can be usefull in emergencies; our emcomm team is set to go to some objectives to cover with radio communications some institutions. Thanks, YO3HJV

yo3hjv avatar Jan 24 '24 07:01 yo3hjv