This shows you the differences between two versions of the page.
software:gui-designer:tokens [2012/12/21 04:54] jarrod [Using Tokens] |
software:gui-designer:tokens [2015/03/19 01:56] (current) jarrod |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Tokens ====== | ====== Tokens ====== | ||
- | A token is basically a variable that you can store data in or retrieve data from at runtime in your guiDesigner projects. A token is given a name and a value. | + | A token is basically a variable that you can store data in or retrieve data from at runtime in your guiDesigner projects. A token has a name and a value. |
===== Token Naming ===== | ===== Token Naming ===== | ||
Line 19: | Line 19: | ||
Using our [[software:iviewer:iviewer-javascript-api|JavaScript API]], you could persist a JSON string across sessions and restore the JSON object on each launch, allowing you to theoretically store any dynamic data across launches. | Using our [[software:iviewer:iviewer-javascript-api|JavaScript API]], you could persist a JSON string across sessions and restore the JSON object on each launch, allowing you to theoretically store any dynamic data across launches. | ||
+ | |||
+ | <WRAP center round important 80%> | ||
+ | NOTE: Data is not persisted across GUI reloads. Each time the GUI is reloaded (when Reload GUI Layout is enabled in [[software:iviewer:settings|iViewer Settings]]), global token values will be reset to their default value (or blank if no value is defined in the Global Token Manager). | ||
+ | </WRAP> | ||
+ | |||
==== Predefined Tokens ==== | ==== Predefined Tokens ==== | ||
There are a number of tokens that are predefined for you in certain cases, depending where the token is being used. | There are a number of tokens that are predefined for you in certain cases, depending where the token is being used. | ||
Line 28: | Line 33: | ||
* ''[ipv6address]'' - The IPv6 Address of the device. | * ''[ipv6address]'' - The IPv6 Address of the device. | ||
* ''[ipv6netmask]'' - The IPv6 subnet mask of the device. | * ''[ipv6netmask]'' - The IPv6 subnet mask of the device. | ||
- | * ''[MACAddress]'' - The MAC Address of the device. | + | * ''[networkSSID]'' - The SSID of the Wi-Fi network currently connected. |
+ | * ''[networkType]'' - The network type currently being used for communications. Eg. None, WiFi, WAN, Other, VPN. | ||
+ | * ''[uuid]'' - The device ID of the mobile device running iViewer that is used for licensing purposes. | ||
+ | * ''[MACAddress]'' - The MAC Address of the device. Note this will return '02:00:00:00:00:00', since Apple denies any app from accessing the MAC Address since iOS7 onwards. | ||
=== Attached to every GUI object === | === Attached to every GUI object === | ||
- | * ''[join]'' - The join number and join type of the object, e.g. 'd10' for a digital join of a button, 's4' for the serial join of an image object, 'a12' for the analog join of a slider object. | + | * ''[join]'' - The join number and join type of the object, e.g. 'd10' for a [[software:gui-designer:joins|digital join]] of a [[software:gui-designer:buttons|button]], 's4' for the [[software:gui-designer:joins|serial join]] of an [[software:gui-designer:images|image object]], 'a12' for the [[software:gui-designer:joins|analog join]] of a [[software:gui-designer:sliders|slider object.]] |
+ | * ''[@<join>]'' - Get the 'value' of a specific join. eg: ''[@s10]'' would return the value of serial join 10. ''[@d5]'' would return the value (0 or 1) of digital join 5. | ||
+ | * ''[@<join>:<token>]'' - Same as above, but returning the value of a specific token assigned to a specific join. eg. ''[@l5:[count]]'' would return the number of list items in the list assigned join 5. | ||
=== Attached to all Objects within Lists === | === Attached to all Objects within Lists === | ||
- | Any object within a list (button, slider, image, etc) will automatically have the following tokens attached to it: | + | Any object within a list ([[software:gui-designer:buttons|button]], [[software:gui-designer:sliders|slider]], [[software:gui-designer:images|image]], etc) will automatically have the following tokens attached to it: |
* ''[list_join]'' - The join number of the list that the object resides in | * ''[list_join]'' - The join number of the list that the object resides in | ||
* ''[item_index]'' - The list index (zero based) of the list item that the object resides in. | * ''[item_index]'' - The list index (zero based) of the list item that the object resides in. | ||
Line 46: | Line 56: | ||
=== Attached to sliders === | === Attached to sliders === | ||
- | * ''[sliderval]'' - The numerical value of the current slider position, based on the slider's min and max settings. | + | * ''[sliderval]'' - The numerical value of the current slider position, based on the [[software:gui-designer:sliders|slider's]] min and max settings. |
=== Attached to input fields === | === Attached to input fields === | ||
Line 58: | Line 68: | ||
* [[http://www.commandfusion.com/docs/scripting/gui.html#cF.setToken|Setting token values]] | * [[http://www.commandfusion.com/docs/scripting/gui.html#cF.setToken|Setting token values]] | ||
* [[http://www.commandfusion.com/docs/scripting/gui.html#cF.getJoin|Getting token values]] | * [[http://www.commandfusion.com/docs/scripting/gui.html#cF.getJoin|Getting token values]] | ||
- | * Within command values - simply use the token name within a command value and it will automatically replaced with the token value. | + | * Within command values - simply use the token name within a command value and it will automatically be replaced with the token value when the command is sent. |
* In [[software:gui-designer:system-manager:feedback-parsing:feedback-properties|feedback processing]] | * In [[software:gui-designer:system-manager:feedback-parsing:feedback-properties|feedback processing]] | ||
* Within [[software:gui-designer:math-expressions|math expressions]] | * Within [[software:gui-designer:math-expressions|math expressions]] |