META Refresh Object
There are user interface (UI) objects common to embedded systems that are not supported by standard HTML. These UI objects are referred to as Amulet widgets. There are also UI objects that are supported by HTML, but Amulet has extended their capabilities. These objects can be separated into two distinct categories, Control Objects (META refreshes), which can call the functions defined in Appendix B, and View Objects (images, animated images), which have methods that can be invoked via Inter-Widget Communications, but can't call functions on their own.
META REFRESH <META HTTP-EQUIV="REFRESH">
The most powerful, and potentially the most confusing, object in the Amulet system is the META Refresh object. It can be thought of as an invisible anchor that exists on a page, but isn't visible on the LCD.
There are four different ways to use the META Refresh control object:
1) Call a function(s) based upon a timer event.
2) Call a function(s) when a timer-based function returns a specific value. (if...then...else function)
3) Initialize InternalRAM variables with a value returned from a timer-based function.
4) Be a container object that makes no function calls, essentially becoming a variable which other objects/widgets can reference.
<META HTTP-EQUIV="REFRESH" CONTENT="1st number, 2nd number;URL=function(s);VALUE=number;NAME=string">
This meta tag acts like an anchor that calls its function based upon a timer event instead of a user "hit". Notice the strange syntax with all of the semi-colon delimited fields enclosed within one set of quotes. Also, REFRESH must be all uppercase. CONTENT fields are described below:
1st number, 2nd number
The 1st number specifies the frequency that the URL function(s) is called (specified in seconds, with a single floating-point number). The range is 0.00 - 655.35. 0.00 means update never. The 2nd number specifies the delay time from when the page is loaded until the initial URL function(s) is called (specified in seconds, with a single floating-point number). The range is 0.01 - 655.35. If the 2nd number is not specified, then the delay time defaults to the 1st number (frequency) value. If the 2nd number is specified and the 1st number is 0.00, then the function(s) is called after the delay time specified by the second number and does not update again.
URL=function(s)
The allowable syntax for the "URL=function(s)"string are identical to that of the HREF attribute of the tag or the HREF attribute for a user-input widget. See Appendix B for available functions.
VALUE=number
Specifies the intrinsic value of this meta refresh object. This parameter is optional because the intrinsic value can be specified directly within the URL function call as the argument to the method. See note regarding Control Object intrinsic values.
NAME=string
Specifies the internal name of this meta refresh object. Used for Inter-Widget Communication only.
Examples:
To send out an "invoke RPC #5" message every 500ms, use the following META REFRESH object:
<META HTTP-EQUIV="REFRESH" CONTENT="0.5;URL=Amulet:UART.invokeRPC(5)">
To send out an "invoke RPC #5" message once immediately upon loading the HTML page, but never again, use the following:
<META HTTP-EQUIV="REFRESH" CONTENT="0,0.01;URL=Amulet:UART.invokeRPC(5)">
Note: The 0 of "0,0.01" means that the URL function will not have an update rate. The 0.01 of "0,0.01" means that the URL function will be called 10ms after loading the HTML page.
To launch to a page called parrot.html after 5 seconds, use the following:
<META HTTP-EQUIV="REFRESH" CONTENT="5;URL=parrot.html">
<META HTTP-EQUIV="REFRESH"
CONTENT="updateRate, delayRate;
IF=function;
{EQ | GT | LT | NEQ}=value;
THEN=function(s);
ELSE=function(s);
NAME=string">
This meta tag acts like an anchor that calls its THEN or ELSE function(s) when the timer-based IF function returns a specific value, instead of a user "hit". Notice the strange syntax with all of the semi-colon delimited fields enclosed within one set of quotes. The IF attribute is like a View Widget's HREF parameter. The THEN and ELSE attributes are like a Control Widget's HREF parameter. CONTENT fields are described below:
updateRate,delayRate
The updateRate specifies the frequency that the IF function is called (specified in seconds, with a single floating-point number). The range is 0.00 - 655.35. 0.00 means update never. The delayRate specifies the delay time from when the page is loaded until the initial ONVAR function is called (specified in seconds, with a single floating-point number). The range is 0.01 - 655.35. If the delayRate is not specified, then the delay time defaults to the updateRate (frequency) value. If the delayRate is specified and the updateRate is 0.00, then the IF function(s) is called after the delay time specified by the delayRate and does not update again.
IF=function
The value returned by this function call is used to trigger the function(s) in THEN=. The behavior and syntax of this META attribute is identical to that of the HREF parameter for a View Widget. See Appendix B for available functions.
{EQ | GT | LT | NEQ}=number
This attribute specifies the value and condition that triggers the THEN= function(s). If the value returned from the IF= function meets the condition, the immediately following THEN= function(s) is called. The value of number can be a byte, word, InternalRAM byte variable or InternalRAM word variable.
THEN=function(s)
The allowable syntax for the "THEN=function(s)"string are identical to that of the HREF attribute of the tag or the HREF parameter for a Control Widget. See Appendix B for available functions.
ELSE=function(s) (Optional)
The allowable syntax for the "ELSE=function(s)"string are identical to that of the HREF attribute of the tag or the HREF parameter for a Control Widget. See Appendix B for available functions.
NAME=string
Specifies the internal name of this meta refresh object. Used for Inter-Widget Communication only.
For example, to create a META Refresh object that checks the value of InternalRAM.byte(0) every 500ms and if it equals 0 it sends out an RPC(0), else it will send out an RPC(0xFF), use the following:
<META http-equiv="Refresh" content="0.5;
IF=Amulet:InternalRAM.byte(0).value();
EQ=0;
THEN=Amulet:UART.invokeRPC(0);
ELSE=Amulet:UART.invokeRPC(0xFF);
NAME=metaRPCLauncher">
META HTTP-EQUIV="REFRESH" CONTENT="1st number, 2nd number;ONVAR=function;VALUE=InternalRAM.type(x) ;NAME=string">
This meta tag does not require a URL function since the META object only exists to initialize an Internal RAM variable value, either a BYTE, WORD or STRING.
The most obvious use for this type of META is for initializing an Internal RAM variable to an internal Amulet value. For example, to set Internal RAM word variable 0 to the current page number, you could use the following:
<META HTTP-EQUIV="Refresh" CONTENT="0,0.01;ONVAR=Amulet:internal.fileNumber.value();value=InternalRAM.word(0)">
Since the value=InternalRAM.word(0), instead of the META Refresh saving the value in its own memory space, it actually saves it directly to Internal RAM word variable #0.
Another case where this could be useful is if someone wanted to initialize an Internal RAM variable, but wanted to maintain the slave relationship with the Amulet. Therefore, you could have the META request a variable and store it directly into an Internal RAM variable without ever sending a master message.
<META HTTP-EQUIV="Refresh" CONTENT="0,0.01;ONVAR=Amulet:UART.byte(5).value();value=InternalRAM.byte(5)">
The above example will request the value of external byte variable #5 once 10ms after loading the page and save that value into InternalRAM byte variable #5.
<META HTTP-EQUIV="Refresh" CONTENT="0,0.01;ONVAR=Amulet:UART.words(0).array(4);value=InternalRAM.words(0)">
The above example will request the value of external word variables #0 - #3 once 10ms after loading the page and save that value into InternalRAM word variables #0 - #3.
META HTTP-EQUIV="REFRESH" CONTENT="1st number, 2nd number;ONVAR=function;URL=Amulet:nop();VALUE=number ;NAME=string">
This meta tag does not need to call any functions. It exists to hold a variable value, either a BYTE, WORD or STRING. Other control objects/widgets can set the value of this "variable" by using Amulet:document.name.setValue(), and the value of the "variable" can be read by using Amulet:document.name.value(), where name is the internal name given in NAME=string. See note regarding Control Object intrinsic values.
With the addition of InternalRAM variables, using the META as a container object is not needed. InternalRAM uses less uHTML space as well as the additional benefit of existing outside of a specific page. META objects are only valid in the page that they are defined in and will be reinitialized every time the page is re-entered. InternalRAM can survive from page to page, will not be reinitialized every time the page is re-entered unless you specify it and InternalRAM can actually be saved back to the flash, so the variable can persist even after powering down.
Examples:
To send out an"invoke RPC #5" message when the value of a slider (Slider1) equals 0xFF, which is polled every 500ms, use the following META REFRESH object:
<META HTTP-EQUIV="REFRESH" CONTENT="0.5;ONVAR=Amulet:document.Slider1.value();TRIGGER=0xFF;URL=Amulet:UART.invokeRPC(5);NAME=MetaOne">
This META will continue to send the RPC every 500ms until the slider value no longer equals 0xFF. To have the META send it out only once, you could have the META URL include the following function after the invokeRPC function: Amulet:document.MetaOne.setUpdateRate(0)
This will make the META turn itself off after the first invokeRPC is sent.
To send out a "set byte variable #2 to 0x78" message when the value of external byte variable #4 equals 0xFF, which is polled every 500ms, use the following META REFRESH object:
<META HTTP-EQUIV="REFRESH" CONTENT="0.5;ONVAR=Amulet:UART.byte(4).value();TRIGGER=0xFF;URL=Amulet:UART.byte(2).setValue(0x78)">
To send out a 'set string variable #5 to "My String"' message when the value of external byte variable #4 equals 0xF0, which is polled every 500ms, use the following META REFRESH object:
<META HTTP-EQUIV="REFRESH" CONTENT='0.5;ONVAR=Amulet:UART.byte(4).value();TRIGGER=0xF0;URL=Amulet:UART.string(5).setValue("My String")'>
To launch to "Page1.html"when the value of external byte variable #1 is greater than 0xC0, which is polled every 500ms, and to "Page2.htm" if the value is less than 0x40, use the following META REFRESH objects:
<META HTTP-EQUIV="REFRESH" CONTENT="0.5;ONVAR=Amulet:UART.byte(1).value();TRIGGER.GT=0xC0;URL=../setValue()/Page1.html"> <META HTTP-EQUIV="REFRESH" CONTENT="0.5;ONVAR=Amulet:UART.byte(1).value();TRIGGER.LT=0x40;URL=../setValue()/Page2.html">

Start Here
Development Tools
| Site Use Terms | Terms of Sale | Privacy | Warranty | Site Map | |