Built-In Namespace _global_
| Field Attributes | Field Name and Description |
|---|---|
|
The cave_poller is the object that maintains contact with the gateway and sends/gets the messages
|
|
|
this is the type of a database column when it is a boolean value
|
|
|
this is the type of a database column when it is an 8 bit character
|
|
|
this is the type of a database column when it is a 64 bit float
|
|
|
this is the type of a database column when it is a 32 bit float
|
|
|
this is the type of a database column when it is a 16 bit short integer
|
|
|
this is the type of a database column when it is a 32 bit integer
|
|
|
this is the type of a database column when it is a 64 bit integer
|
|
|
this is the type of a database column when it is an 8 bit integer
|
|
|
this is the type of a database column when it is a 128 bit float
|
|
|
this is the type of a column when its NULL
|
|
|
this is the type of a database column when it contains a string (text, char, varchar etc)
|
|
|
this is the type of a database column when it is a 16 bit unsigned integer
|
|
|
this is the type of a database column when it is a 32 bit unsigned integer
|
|
|
this is the type of a database column when it is a 64 bit unsigned integer
|
|
|
this is the type of a database column when it is an 8 bit unsigned integer
|
|
| Method Attributes | Method Name and Description | |
|---|---|---|
|
beginTransaction(name, doneCallback)
Create a new caveTransaction object and insert it into the list of waiting transactions.
|
||
|
caveQueryInProgress(name)
Check if there is a transaction already in progress with the same name.
|
||
|
caveStop()
Stop the poller.
|
||
|
This will extract the numeric part of a string or object.
|
||
|
createCaveList(id, columns)
This is a convenience function for creating a caveList object.
|
||
|
debug(str)
This is a handy function to use while debugging.
|
||
|
deleteCaveList(id)
This function deletes the specified (by ID) caveList object.
|
||
|
findCaveList(id)
This function finds the specified caveList object in the list.
|
||
|
findParametersInTransaction(trans, params)
Pass this function the transaction object and an array of caveParam objects which you are interested it,
and it will search through the transaction to find the parameters you are intersted in, set their type and
value.
|
||
|
fromIEEE(num, mantissa_width, mantissa_mask, mancap, exponent_mask, exponent_bias, negative_bit)
|
getHexOfPreparedCaveQuery(name, id, params, seq)
This function will be called by a FORM with via the "onsubmit" attribute.
|
|
|
Get a random alpha-numeric character.
|
||
|
getType(val)
Gets the type of an Object.
|
||
|
initCave(poll_delay, url)
This function initiates the cave interface.
|
||
|
parseBoolean(val)
This is a generally useful function for parsing a boolean value from an Object.
|
||
|
sendCaveQuery(name, id, params, doneCallback, rock_name)
This is a convenience function for sending a message to the cave rock.
|
||
|
setBusy(busy)
Call this function to cause the busy icon to spin.
|
||
|
toIEEE(val, mantissa_width, mantissa_mask, mancap, exponent_mask, exponent_bias, negative_bit)
Writes a floating point number into IEEE binary format.
|
||
|
remove all queued transactions (so they don't get sent, or if they already have been sent, so their
replies are ignored.
|
Defined in: cave.js.
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: cave.js.
- See:
- caveParam
Defined in: client.js.
Defined in: client.js.
See also the overview and examples.
Defined in: cave.js.
- Parameters:
- {string} name
- unique transaction name from the client-side. This is used as a key into the list of waiting transactions, for associating requests with replies.
- {function} doneCallback
- the function to call when a reply comes in for this transaction.
- Returns:
- the transaction object
- See:
- sendCaveQuery
See also the overview and examples.
Defined in: cave.js.
- Parameters:
- {string} name
- the client-side unique name of the transaction that was used when beginTransaction was called.
- Returns:
- true if there is a transaction in progress now.
See also the overview and examples.
Defined in: cave.js.
Defined in: client.js.
- Parameters:
- n
- the Object that represents a number
- Returns:
- the Object after parsing to a number
See also the overview and examples.
Defined in: cave.js.
- Parameters:
- {string} id
- the unique ID of this list widget
- {Array} columns
- an array of caveColumn objects
Defined in: client.js.
- Parameters:
- {string} str
- the message to be displayed
See also the overview and examples.
Defined in: cave.js.
- Parameters:
- {string} id
- the unique ID of this list widget
See also the overview and examples.
Defined in: cave.js.
- Parameters:
- {string} id
- the unique ID of this list widget
- Returns:
- the caveList object or null if not found
See also the overview and examples.
Defined in: cave.js.
- Parameters:
- {caveTransaction} trans
- the transaction object from the remote cave object
- {Array} params
- an array of CaveParam objects
- Parameters:
- {number} num
- the binary format
- {number} mantissa_width
- e.g. for a 32 bit float, this is 23
- {number} mantissa_mask
- e.g. for a 32 bit float, this is 0x007FFFFF
- {number} mancap
- this is the mantissa cap e.g. for a 32 bit float, it is 0x00800000
- {number} exponent_mask
- e.g. for a for a 32 bit float, it is 0x7F800000
- {number} exponent_bias
- e.g. for a for a 32 bit float, it is 127
- {number} negative_bit
- e.g. for a for a 32 bit float, it is 0x80000000
- Returns:
- the number once converted
See also the overview and examples.
Defined in: cave.js.
- Parameters:
- {string} name
- the client-side unique name of the transaction
- {string} id
- the cave session ID to be called.
- {Array} params
- an array of caveParam objects containing the parameters to be sent to the service
- {number} seq
- a unique sequence number
- Returns:
- a HEX encoded message body reaty for sending to a service
Defined in: client.js.
- Returns:
- a randomly selected alpha-numeric character
Defined in: client.js.
- Parameters:
- val
- the object to be queried
- Returns:
- "number", "string", or "array".
See also the overview and examples.
Defined in: cave.js.
- Parameters:
- {number} poll_delay
- the number of milliseconds between polls, 5000 is recommended (5 seconds).
- {string} url
- the URL of the service.
- Returns:
- there is no return value.
See also the overview and examples.
Defined in: cave.js.
- Parameters:
- val
- the object to be parsed
- Returns:
- true if the val was "true"
See also the overview and examples.
Assuming you have a service defined in your cave rock's configuration file something like this:Defined in: cave.js.
<service name="user" id="login">
<sql transaction="commit">
select permission,username,sessionid from login(
<parameter name="username"/>,
<parameter name="password"/>);
</sql>
</service>
... then you could have something like the following as the javascript
that is called when the "login" button is clicked:
function doLogin()
{
if (!caveQueryInProgress("login")) {
var params = new Array();
params[0] = new caveParam("username", DB_DATA_TYPE_STRING, username);
params[1] = new caveParam("password", DB_DATA_TYPE_STRING, password);
sendCaveQuery("login", "login", params, doneLoginCallback, "ke-cave");
}
}
The callback function will eventually be called and passed one parameter:
the caveTransaction object.
function doneLoginCallback(trans)
{
var params = new Array();
params[0] = new caveParam("permission");
params[1] = new caveParam("sessionid");
findParametersInTransaction(trans, params);
permission = 0;
sessionid = null;
if (params[0].value) {
permission = params[0].value;
}
if (params[1].value) {
sessionid = params[1].value;
}
if (permission == 0) {
alert("invalid username or password");
}
else if ((permission & 3) != 3) {
alert("no permission to make changes");
}
if ((permission & 3) != 3) {
logout();
}
else {
login();
}
caveStop(); // stop the polling now, no need to, we have the reply
}
- Parameters:
- {string} name
- the client-side unique name of the transaction
- {string} id
- the ID of the cave service that you are calling
- {Array} params
- an array of caveParam objects that are being used to send parameters to the service
- {function} doneCallback
- the function to call when the reply has completed
- {string} rock_name
- the name of the cave rock.
See also the overview and examples.
Defined in: cave.js.
- Parameters:
- {boolean} busy
- true if it is busy
Oops there should be a problem: this should only work for up to 32 bit floats. Above that, there will be a rounding off of precision because the Javascript number is actually a 64-bit float, with only 48 bits for pure integer values. This must be fixed, probably best to convert it so it uses a string, and hex encoded values. Suprisingly, it works!
Defined in: client.js.
- Parameters:
- {number} val
- the floating point number
- {number} mantissa_width
- e.g. for a 32 bit float, this is 23
- {number} mantissa_mask
- e.g. for a 32 bit float, this is 0x007FFFFF
- {number} mancap
- this is the mantissa cap e.g. for a 32 bit float, it is 0x00800000
- {number} exponent_mask
- e.g. for a for a 32 bit float, it is 0x7F800000
- {number} exponent_bias
- e.g. for a for a 32 bit float, it is 127
- {number} negative_bit
- e.g. for a for a 32 bit float, it is 0x80000000
- Returns:
- the binary format
See also the overview and examples.
Defined in: cave.js.