API

Ready to call the shots? You can call SetOn{x} by launching it as an app from On{X}.

	
	// do something neat with SetOn{x} from your On{X} code
	
	device.modeOfTransport.on('changed', function (signal) {
	    if (signal.current === 'driving') {
			var params = {message:, ...}; // read below for param options
			device.applications.launch("setonx",params,null);
		}
	}
	

Audio Messages


Note: Some volume settings require v1.03+ and v1.04+
	
	/* Audio message attributes
	 * stream = "ring", "notification", "music"
	 * volume = "0" - "100"    // when specifying a stream
	 * volume = "silent", "vibrate", "normal"    // when only specifying volume
	 * vibrate = "true", "false"
	*/
	
	/*  == Volume Mode == 
	 * You can use the volume mode to easily switch the volume settings without
	 * having set specific percentages.
	*/
	
	// set volume mode to silent (req's v1.03+)
	var params = {message:"audio", volume:"silent"};
	device.applications.launch("setonx",params,null);
	
	// set volume mode to silent with vibrate (req's v1.03+)
	var params = {message:"audio", volume:"silent", vibrate:"true"};
	device.applications.launch("setonx",params,null);
	
	// set volume mode to normal (req's v1.04+)
	var params = {message:"audio", volume:"normal"};
	device.applications.launch("setonx",params,null);
	
	/*  == Custom Volume ==
	 * If you need to get specific with your volume, try the custom settings.
	 * Set specific audio channels to specific percentages and optionally also
	 * set the vibrate setting for that channel.
	*/
	
	//set volume for notifications to 0 and enable vibrate
	var params = {message:"audio", stream:"notification", volume:"0", vibrate:"true"};
	device.applications.launch("setonx",params,null);
	
	// set volume for music to 100
	var params = {message:"audio", stream:"music", volume:"100"};
	device.applications.launch("setonx",params,null);




Radio Messages


Note: Airplane Mode requires v1.04+
	
	/* Radio message attributes
	 * wifiState = "enable", "disable" 
	 * bluetoothState = "enable", "disable"
	 * airplaneMode = "enable", "disable", "toggle"
	 *
	 * Note: setting airplane mode will cause any other property settings
	 *       to be ignored.
	*/
	
	// enable Wi-Fi
	var params = {message:"network", wifiState:"enable"};
	device.applications.launch("setonx",params,null);
	
	// enable Airplane Mode
	var params = {message:"network", airplaneMode:"enable"};
	device.applications.launch("setonx",params,null);
	
	// toggle Airplane Mode
	var params = {message:"network", airplaneMode:"toggle"};
	device.applications.launch("setonx",params,null)




Screen Messages


Note: Requires v1.01+
	
	/* Screen message attributes
	 * on = "true"
	*/
	
	// turn the screen on
	var params = {message:"screen", on:"true"};
	device.applications.launch("setonx",params,null);




Toast Messages


Note: Requires v1.03+
	
	/* Screen message attributes
	 * text = "a custom toast message..."
	*/
	
	// Give a toast
	var params = {message:"toast", text:"Thinking outside the box here..."};
	device.applications.launch("setonx",params,null);