iOS Toolkit App

Hi Everyone,
Thank you for the comments and ideas relating to the implementation of the Multipeer framework for local messages - definite food for thought…

Version 3.4 of Mesh Developers Toolkit is now available in the iTunes App Store.

This has a number of stability improvements when using Multipeer to communicate with other iOS devices.

A new preference “Multipeer Key” has been added.

This allows you to set a unique key to ensure that only devices with the same key appear in your list of devices and shouts will also only go to iOS devices with the same key.

If the preference is left blank you will see all devices running Mesh Developers Toolkit which don’t have a key set.

Although it should be noted that due to the restrictions on the length and encoding of the service name a long key will be truncated, this is to prevent a crash I identified if an incorrect encoding or too long key is used.

You can now share any messages received over a Multipeer connection by swiping left on the message in the “Messages” tab and selecting “Share” which will then allow you to share the message using iOS share panel.

You cannot share to a Mutlipeer connection using the iOS share panel as Apple’s Multipeer framework does not remain active when the App is in the background (and you cannot use it in a Share Extension!) but you can still share over the goTenna connection.:slightly_smiling_face:

4 Likes

Version 3.5 of Mesh Developers Toolkit is now available in the iTunes App store, in this version the Script editor has been reworked.

It is now possible to have different scripts for “events” (e.g. “timer event” or “start up” event) and the available events are listed in the Script tab, removing the need for a large “if/else” statement.

If you don’t have a script for an event the message will be passed to the default script “scriptfile.js”.

You can also setup new “events” or “keywords” which allows you to define a script which will be parsed if it matches the first word of the incoming message.

For example if you have a script with gets weather data from openweathermap.org - you can create a script called “weather” and then any message starting with weather will be passed to the script, without the need for you to parse it out of the full message script.

The point size of the script editor has also been increased to make it more readable :slightly_smiling_face:

2 Likes

Hi @MrTSolar I have finally found some time to build some more battery monitoring functionality.

Version 3.6 of Mesh Developers Toolkit ,which has been released in the iTunes store, now generates a message when the iOS device or goTenna’s battery drops below 10%, 5% or 1%.

The message is either sent as a predefined message using the GUID set in the new setting, “Reporting GUID”, without the need for a custom javascript, in line with your suggestion.

If the “Reporting GUID” preference is blank a script event will be generated (6 different events 10%,5%, 1% iPhone and goTenna). You can see the “event” names in the new script editor tab.

If the script is blank the “event” will be passed to the default script.

When the battery level drops below a threshold the message will be sent twice, with a 1 minute interval between the two messages - just incase the first message does not get through.

If the voltage goes back over a threshold (e.g. from Solar charging) no event will be generated.

The messages Tab UI has been changed so that if the goTenna retries sending a message or fails to the send the message, it is now recorded in the tab - Colour coded yellow for message resends or red for failures.

4 Likes

@Pete94,

I have been experimenting with the app, adding functionality via Javascript for automating a station to be remotely controlled. One problem I noticed during testing is that shout(message) when called via Javascript does not appear to work.

After trying many different things to troubleshoot, it seems that shouts to other instances of MDTK work. That is, independent nodes paired with MDTK do receive the shout messages. However, nodes paired with the official goTenna app do not receive the shout messages. Or if the radio is receiving, the official app is not presenting it to the user.

Do you know if there is something intentionally different between MDTK shouts and ‘official’ goTenna shouts that would cause this? Is this something that can be controlled, or do I potentially have a setting set incorrectly?

Testing with iOS 12.0, FW 1.1.8, goTenna app 5.3.1, MDTK 3.7.

Thanks! This is truly a great app, and amazingly flexible!

2 Likes

Hi Chiggins,
Thank you for your comments.

I think that there is a difference between SDK Shouts and the ‘Official’ GoTenna shouts and that it was changed in the last Firmware (or I am doing something wrong…).

When I put together the next build (I am looking to build some functionality to allow easer interaction with the Python SDK) I will check if there is anything obvious.

The toolkit app is good for using. But it’s not compatible with iTunes on my iPhone. Whenever I am installing the toolkit app then the iTunes automatically uninstalled and then I need to go through https://itunessupport.org/blog/why-cant-install-itunes-on-windows-10/ for the proper solution.

Why are you running W10 on an iOS system? In any case, most users are unlikely to have this issue, because relatively few would run W10 and the MD Tool Kit together on a iOS system. It works fine with iTunes itself.

So I am late to the party. I have goTenna to goTenna messages working between my iPhone and iPad. Running the goTenna app on both ends, pings work. Running the Toolkit on the iPad, attempts to send it messages from the goTenna app on the phone go nowhere. I would expect the iPad to respond via the default script, right?

A shout from the Toolkit on the phone gets to Toolkit on the iPad. Do I have to send the iPad a message from Toolkit on the iPhone to get the default response? If so, how is that done, as all I see in the GUI for the Toolkit for message composition is “shout”?

Sorry if I am being a dull pooch here. I’d like to get to where I can do range-testing with the iPad running Toolkit as one end, and the phone running whatever on the other. Mostly so I don’t have to drag my sweetie into early stages of this stuff.

–Richard

You’re not doing anything wrong. The SDK and the standard mesh protocol used on the GTM devices are mostly the same, but goTenna seems to have come to regard them as distinct development platforms. The catch right now is that each version issues its own token, making them incompatible between platforms. goTenna its reasons for doing so, some of which is speculated about here: Interoperability of SDK and GoTenna App?

So to get responses from an instance running the Mesh Toolkit, I need to send messages from another instance of the Mesh Toolkit, correct? And since there’s no obvious way in the GUI to do anything but shout, I’d need to create a short sender script in JS, and run that, right?

Have successfully resisted learning JS to this point. COBOL, FORTRAN, Basic, C, C++, x86 assembly, SPARC assembly, Perl, TCL/Tk, Python, Lua, and of late, OpenSCAD. Sigh. I guess it’s just another twig on the language bonfire.

Thanks for your answer, Mike!

–Richard

Yes, exactly. And your proposed solution is what seems most likely to solve the issue, although I’ll admit that I am not a programmer and can’t offer more than encouragement to give that a try. There may be others working on that solution, but AFAIK none have yet been offered up here for testing and enhancement by the mesh community.

So I have a couple silly new beliefs that you can probably easily disabuse me of:

  1. goTenna to goTenna “pings” are just special messages, and hop as far as the sender is allowed.
  2. Only goTenna to goTenna messages get the bonus three hops from “plus”…that is, that enhancement is tied to the goTenna user+app, and an SDK app using the same GUID will only hop three times, whether the user is “plus” or not. (I mean, heck, how could they tell? I suppose it could be tied to the GUID, and something gets left in the device until the GUID changes, but I can also see the behavior I described above the way they would go).

One more general question here: how does one set which Javascript file to use for processing incoming messages? I can’t find anything in settings or in the “scripts” tab. Does it just run whatever is currently named “scriptfile.js”, as that’s the observed behavior?

----> Someomne more familiar than I am with the SDK will have to answer those.

So more futzing about here. I’ve written (and mostly debugged) a Pythonista script for setting up pinned locations for Mesh Toolkit. I thought Pete94’s use case of being able to place a QR code for a fixed location was really cool. But what if you’re about to venture off into the wild or not so wild, without a printer, and would like to mark an anchor to your current location? Or maybe a destination you’re not at but are heading for? The script (which I invoke from an iOS shortcut, hence the URL scheme to get back at the end(s)) pops up a dialog, asking the user to choose between using the device’s current location or inputting a LAT/LONG pair in decimal format, with space between the two values. It then asks the user to name the new location (and embedded spaces are OK), and creates the pinned location as a pseudo device in Mesh Toolkit…assuming it’s running. It then asks if the user would like to share the location creation command as a SHOUT. This would allow a group member to establish an ad hoc pinned location and share it with nothing more than goTenna local comms. They’d just have to copy the shout text and paste it into Safari. Or a rescue worker could flag something or someone that needs attended to and move on.

It’s not perfect. The URL invocations of MTK stay at that app, so you have to tap the little (return to) Pythonista link in the upper left corner. This can probably be fixed by someone more clever with URL scheme stuff than I. Pete may support x-callback-url…dunno.

And this and all my blundering development brings up a (simple) feature request for MTK: it’d be very nice to have some means to remove devices and pseudo devices from the Devices list. Mine is now lousy with bogus pinned locations that I’d like to delete. Maybe someone here has already figured out a way to do that, short of removing the app and reinstalling?

I would happily share the code here, but have not out-smarted the forum vis-a-vis posting code that doesn’t get reformatted into hamburger. Python is annoyingly twitchy about formatting, including whitespace.

–Richard

PS: Another thing that seems reasonable to want would be to be able to copy message or shout content to the clipboard?

PPS: And I figured out how to do this. A bit clunky…swiped left on the shout, share=>copy, pasted that into a note, and then tapped on the part that was the actual message, and got offered a chance to open it in Mesh Toolkit. Which then created the pinned location on the receiving device.

PPPS: and figured out how to post code:

import location
import console
import webbrowser
import urllib
import sys
import time

use_loc = console.alert('Choose','Location?:','CURRENT','ENTER LAT LONG')
if use_loc == 1:
	my_loc = location.get_location()
	LAT = my_loc['latitude']
	LNG = my_loc['longitude']
elif use_loc == 2:
	lat_lon = input('Enter LAT LONG (decimal format)')
	LAT = lat_lon.split()[0]
	LNG = lat_lon.split()[1]
else: 
	console.clear()
	console.hide_output()
	webbrowser.open('shortcuts://')
	sys.exit()

# get location name here
loc_name = input('name for this location:')
quoted_name = urllib.parse.quote(loc_name)

# format URL scheme for MTK
output = ('?guid=0&name={}&lat={}&lng={}'.format(quoted_name, LAT, LNG))

cmd = 'mtk://create{}'.format(output)

print(cmd)

webbrowser.open(cmd)
time.sleep(2)

# optionally shout out the URL string to nearby neighbors
answer = console.alert('Share','Send result as SHOUT?:','OK')
if answer == 1:
	cmd2 = 'mtk://shout?message={}'.format(urllib.parse.quote(cmd))
	print(cmd2)
	time.sleep(2)
	webbrowser.open(cmd2)

webbrowser.open('shortcuts://')
console.clear()
console.hide_output()
sys.exit()
1 Like

So larger question here: is the Mesh Developers Toolkit largely abandoned at this point? I realize the author has a life, and don’t expect him to drop everything and respond to questions. But aside from MikeL, I’ve not seen any traffic besides what I am generating for some time.

In hopes of being able to do more testing without dragging other humans into the fray, I’ve picked up a used iPhone 8, and have it set up without a SIM, and not associated with my Apple ID and such. I’ve installed goTenna and MTK on it, and paired it with a goTenna. Messages and pings using the goTenna app work fine between it and my “day phone”. When I try to do much of anything using the MTK, things go south.

Shouts sent from unPhone to iPhone give me a “@syntax error Check activty log” on the iPhone. The log shows nothing. Since this is MTK to MTK communication, I’ve toggled “Don’t Ignore Mesh Toolkit” on both devices. If I try a direct message, I get a (probably endless) exchange where the iPhone throws an error, that goes back to the unPhone, and away we go.

So this prompts some questions I hope someone can answer:

  1. Is the token disconnect between MTK and goTenna communication something that came late in MTK’s development? I ask, because if not, it’s hard to see why the “ignore Mesh Toolkit” setting is a thing…what other shouts or messages would it ever receive?

  2. I’m sure the @syntax error is something happening in “the script”. I don’t see any useful debug information in the activity log (does that ramp up with “Extended logging”?), and there’s no obvious way to tell what script is being run, and no obvious way to change that. I could cons up a trivial script to see if I can dope out what’s going on, but I don’t know how to make that be the default processing of inbound comms. Every script under the “Script” tab has a lock symbol by it. I see stuff up higher in this thread where people are clearly doing scripting. But no mention of how they enabled their script to run. I have tried creating a new script named “scriptfile.js”, in an attempt to overwrite what I am guessing is the default, and that just drops back to the listing of locked scripts. Nothing changes. Somehow I once managed to get the content of “scriptfile.js” to display, but not since.

  3. There’s a discussion about enabling scheduled tasks, but all I find in the GUI is the toggle for that. Toggling it on doesn’t give me anywhere to make a choice about what to schedule or how often. I fear that means there’s a fixed schedule somewhere that is unknowable, let alone modifiable.

The bottom line for me: it feels a bit like Peter got to a place where he hit diminishing returns from MTK…if the Token Tower of Babel happened mid-2018, I can really see why…and just locked things down and left it all be. I hope that’s not the case. I hope I am just being too slow on the uptake for how to get at and use some of the extensibility features I would expect from the discussion above.

Am I wasting my time?

–Richard

1 Like

Hi Richard,
Can you post your script which is throwing the syntax error. Every script needs to return a string of some form as the code is expecting this to pass onto the GoTenna framework.

What happens if you press the “Play” button when editing your script - does this return a syntax error?

If you enable scheduled tasks, the script “timer_event.js” needs to return a string.

You are correct, as confirmed by MikeL, the original SDK allowed for messages to be shared with the standard client however during 2018 the latter firmware and/or Aspen Grove 2 changed this behaviour (or I missed something).

I totally understand why this was done both from technical and commercial aspects but it also changed what “Mesh Developers Toolkit” needs to do.

As the “Mesh Developers Toolkit” can no longer interact with the standard client it needs to support better messaging functionality - which increases the development and testing time to put a release together. The standard GoTenna app also provides a lot more functionality.

Late in 2018 the Python SDK was also released which also gave the potential to provide the same functionality as “Mesh Developer’s Toolkit” but using far cheaper hardware (see GoTenna Python SDK).

The original reason for developing “Mesh Developers Toolkit” was to provide a bridge between the GoTenna network and a Raspberry Pi.

The python SDK means you don’t need the iPhone as a bridge to do this.

As it stands the original use cases for “Mesh Developers Toolkit” are still valid, for example building a network to monitor Gotenna’s repeaters but it is not a replacement for the original GoTenna App.

I did make some suggestions on how the GoTenna App could be changed to make integration with third parties in the post App integration and SDK support suggestions.

Hope this helps.

Pete

1 Like

Per my question #2 above: it’s not running my script. I have no script yet. It’s running whatever it runs by default. I asked how to determine which script that is, and how to set/change it. This is all happening on iOS 13. It’s not consistent. I had removed and reinstalled the MTK on both iOS devices to clear the “devices” list, since there appears to be no other way to do it. On reinstall, I started getting the syntax error messages on at least one of the devices, but I believe it was both. Have also seen sporadic messages that looked like JS calls to some location services interface were having issues. I’ve verified that MTK had access to location services in “settings”. The message saying to check the empty log isn’t that helpful. I am guessing as of iOS 13, an error is getting thrown outside your purview and not getting logged.

Again, per #2: how do I set what script gets run? Do I have to side-load a script named “scriptfile.js” on top of yours? Per #3, how do I even tell what “run scheduled services” runs, and on what schedule, let alone modify all that?

I assume that choosing “don’t ignore MTK” is required to have the messages/shouts show up in the GUI at all. But that also means they get handled (and responded to) by the recipient’s script, right? I know somewhere in this thread, you say you have tried to prevent loops, but maybe this error message thing escapes that somehow?

If this truly was intended to be just a bridge between goTenna and a rPi, and the Python SDK obviates that need, I get it. Does the Python SDK use yet-another distinct token?

Your app certainly has some features that are useful for iOS that don’t map onto rPi: URL schemes, QR code generation. I have numerous rPi devices around the house, but I don’t travel or hike with them. I’ve written a Pythonista script that builds on the URL scheme feature to create location pins and optionally share them via shout. If there are similar capabilties in the goTenna app, I’ve not found them.

I can make good use of your app. The things I don’t how to do are 1) control what script gets run; 2) control what “run scheduled services” does and when. The feature I am missing is the ability to edit (mostly, delete) contacts, especially pseudo-contacts.

I get proof-of-concept. I was a SW engineer and architect for Intel for just under 30 years, and have had more than a dozen POC efforts become “must support forever” albatross projects. If you’re done with MTK, I get it. If you can answer my “how to” questions, it will be pretty useful to me, regardless. If there were a way to edit/remove location pins short of deleting and reinstalling the app, it would be quite useful.

–Richard