Overview
The Turck RFID app is available on both Android and iOS, and has identical functionality on each platform. Developers can use Javascript to customize Turck RFID and to write custom cross-platform RFID scripts.
The steps for using Javascript are:
- Create your Javascript script, either starting from Turck RFID or from one of the sample scripts.
The Turck RFID app (defaultApp.js) and several sample scripts are available here. You can download any of these as a starting point. - Make your script file(s) availble via URL, normally by hosting it on your server
- Load the script in Turck RFID
- manually in settings
In the Turck RFID app, press and hold the settings button. - by invoking Turck RFID via URL and specifying the script to run
On an Android or iOS device, invoke the URL
turckrfid://app?source=URL_TO_LOAD_APP_FROM
- manually in settings
- manually
Press and hold on the title bar in the home page of the sample. Choose "reset to default" - by invoking Turck RFID via URL
On an Android or iOS device, invoke the URL
turckrfid://app?source=
Anatomy of a Turck RFID script
This is a very simple script that just displays a button:
// // test app // 'use strict'; class HelloWorldApp extends turck.App { /////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////// constructor() { super(); } /////////////////////////////////////////////////////////////////////////////////////// // App has just launched, show the home screen /////////////////////////////////////////////////////////////////////////////////////// onLaunch(launchAction, launchPath, launchParameters) { app.showPage(new turck.ui.GadgetPage({ titleText: "hello world", gadgets:[ new turck.ui.Button({ position: [{type: "parent", ratio: 0.5, at: "center"}, {type: "parent", ratio: 0.5, at: "center"}], text: "button", click: function() { app.showToast("hi!"); } }) ]})); app.handleLaunchParameters(launchAction, launchPath, launchParameters); } } /////////////////////////////////// /////////////////////////////////// // // Create the app object // var app = new HelloWorldApp();
The app object
The script is a Javascript object named app that subclasses turck.App. Javascript's flexibility means that app can be declared may ways, here we use ECMA classes. The onLaunch() function is called when the script starts running. it normally uses app.showPage() to show the home page for the script. The object passed to the script is normally a
- turck.ui.GadgetPage (as in this sample)
This is a set of UI gadgets positioned on the page. The gadgets sample script has examples of each type of gadget, and how gadgets can be positioned. - turck.ui.ListPage
This is a array of list items displayed in a scrolling list. The lists sample script has examples of each type of list object.
Copyright © 2012-2017 U Grok It, Inc. connect@UGrokIt.com U Grok It and the U Grok It logo are registered trademarks of U Grok It, Inc. All other trademarks and copyrights are the property of their respective owners |