View Full Version : ajax_sendevent with an additional payload

August 14th, 2012, 06:22 AM
I've built a WedApp on an Android tablet to trigger Girder Events using ajax_sendevent.lhtml. The App works well triggering Girder Events and Macro's but doesn't really address volume changes well.

The javascript that applies to a Volume Slider is;

function handler_Z4VolSlider_onStop(value){
var value_str = escape("Z4Vol" + value);
$.get(""+ (value_str) +"&device="+escape("251"));

Currently I need to have an Event for each level of volume (say 0-50) and I have 6 zones; there must be a better way!

Can ajax_sendevent pass an additional variable back to Girder - ie in addition to the "Event" being triggered and the "Device", can I send (value) in the above example? Is there a simple modification to ajax_sendevent required to do this?

What I'm looking to do is use that variable in a script to send a volume setting to my Multizone amplifier. The script currently opens an IP socket and writes to that socket to adjust volume (stopped at 20 in this example);

local socket = gip.Open('192.168.456.456',9621)
if socket then
socket:Write ('EVENT C[1].Z[4]!KeyPress Volume 20\r')

August 14th, 2012, 03:50 PM
Look for my modified sendevent that allows payloads or the websocket I developed for constant 2 way communication between Girder and a browser.

August 14th, 2012, 09:25 PM

I can find the thread where you refer to the modified files (http://www.promixis.com/forums/showthread.php?20521) but the files are not attached;

" The example file SendEvent.html from the included webpage only sends the event and device. To get it to pass additional info you have to edit SendEvent.html and girder.js to include more variables..."

Can I ask that you send me your modified SendEvent.html and girder.js please?

August 14th, 2012, 09:51 PM