Skip to content

Instantly share code, notes, and snippets.

@feedhenry-gists
feedhenry-gists / gist:1012276
Created June 7, 2011 13:42
Accelerometer Call - Device
$fh.acc( {interval:5000}, function(res){
alert( 'x='+res.x+', y='+res.y+', z='+res.z+', at='+res.when);
} );
$fh.act( { act:'myfunction',
secure: false,
req:{...} },
function(res) { alert(JSON.stringify(res));
function(code,errorprops,params) {...} ); }
$fh.audio( {"path":"rtsp://example.com/audio", "act" : "play"},
function(result){alert(result) },
function(result){alert("fail" + result)});
$fh.audio( {"act" : "pause"},
function(result){alert(result)},
function(result){alert("fail" + result)});
$fh.audio( {"act" : "stop"},
function(result){alert(result)},
$fh.cache(
{
act: 'save/load/remove',
key: <a key for the object>
val: <the data to cache>,
expire: <the duration of the object>
}
);
$fh.cam({act:'picture'}, function(res){
var img = new Image();
img.src='data:image/'+res.format+';base64,'+res.b64;
} );
$fh.contacts( function(res) {
var ul = document.createElement('ul');
for( var i in res.list ) {
var li = document.createElement('li');
li.innerHTML = '<i>'+res.list[i].name+'</i>';
ul.appendChild(li);
}
document.getElementById('contacts').appendChild(ul);
@feedhenry-gists
feedhenry-gists / gist:1015140
Created June 8, 2011 19:18
Cloud Request Details Call
var res = $fh.getRequestDetails();
@feedhenry-gists
feedhenry-gists / gist:1015142
Created June 8, 2011 19:19
Cloud Request Details Response
{
"userAgent": <user agent string>,
"maxWidth": <max width of device screen, in pixels>,
"maxHeight": <max height of device screen, in pixels>,
"visibleWidth": <visible width in the device browser, in pixels>,
"visibleHeight": <visible height in the device browser, in pixels>,
"ipAddress": <client IP Address>
}
@feedhenry-gists
feedhenry-gists / gist:1015148
Created June 8, 2011 19:21
Cloud Request Details Response Example
{
"userAgent":"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)",
"maxWidth":320,
"maxHeight":240,
"visibleWidth":300,
"visibleHeight":220,
"ipAddress":"127.0.0.1"
}
@feedhenry-gists
feedhenry-gists / gist:1015153
Created June 8, 2011 19:24
Device Environment Properties Call
$fh.env( {/*none*/},
function(envprops) { alert(JSON.stringify(envprops)) },
function(code,errorprops,params) { /*none*/ } );