Android Fragment JavaScript - ComThings/PandwaRF GitHub Wiki
Important note: JavaScript activation is part of the "Dev Mode" feature, which can be enabled in Menu/Settings/Features/Developer Mode. Refer to Android-Dev-Mode for more information.
PandwaRF embeds the Duktape JavaScript engine. It is running on the Android host, in our PandwaRF Android application. You can access it using a dedicated page.
I emphasize again that JS engine runs on the host, you need to understand this to correctly use this feature. Running on the host means:
- the script is hosted on the host (pleonasm)
- JS Engine process the JavaScript file normally, so you have access to all JavaScript keywords, functions, etc...
- Each time JS engine finds of these custom Gollum function , it calls the underlying gollumXXX() RF function (C language) still located on the host
- this gollumXXX() RF function is internally translated into a set of custom RF commands, send in BLE (or USB) to the PandwaRF dongle.
- PandwaRF receives this command, executes it, and may return a result or not.
- Note that the Gollum JavaScript functions are blocking functions, that will not return until completed
- The full loop, from Android to PandwaRF and back, can take several ms, so it is not well suited for realtime application.
For example to do a Brute Force using JavaScript, you would need a big loop running on the host and sending RF data, then incrementing the data, then sending it again, etc... This would be particularily long and un-effective. This is why we developped dedicated native functions on the PandwaRF app. Doing the Brute Force entirely on the PandwaRF HW removes totally this loop bottleneck.