0
Beantwoord

gestures with device commands

Barry Jones 9 jaar geleden in Products / Other drivers bijgewerkt door Ekaterina (head of support) 9 jaar geleden 5
dose anyone have a gestures script or demo with device commands i.e. ir, serial, ip, would like to to control devices from a gesture rather than a button, i.e. up, down, left, right, enter,
have looked at the gestures scripts but don't know how to link the device command to it.


barry
hi Ekaterina, thanks for the sample, not sure at this stage how i would add a command to the gesture can you give me an example and i can work it out from there, say atach a global case driver to it and run a dvd player up, down, let t, right ,and enter, this would allow me to understand the script little more, look thanks if you can and thanks if you can't

barry
Ok, no problem!

Here you can see the instruction about how to send the command to GC via the script. You can use this instruction when configure the commands in our Gestures script.
So, you have to add the command to DVD by UP gesture. It could be done there:


This command
have to be created in Project Device Panel, on some GC output:


We have to use script command Set to send the command already created in driver, it looks like this:
IR.GetDevice("Global Cache").Set("COMMAND", ""); 
In our situation:
IR.GetDevice("Global Cache").Set("MENU TOP", ""); 
We have to add this command to correct place of script called GRemote_AddCommands, here:


You can add the commands to Down, Left, Right, Double-Click event using the same way.
This script doesn't support Enter, it supports Double Click instead of it.

To make the area for gestures work, you have to press this button when project started:

When the button Blue, you can control with Gestures.
is there a way of having this different for every page in the project, say dvd on the dvd page, sat tv on the sat tv page and so on.
Yes you can do it. You have to make a copy of Remote function, like this (change in GRemote_AddCommands):

/*
      Add here your actions for Swipe Left, Right, Up, Down and for Double Tap
*/

// Zone 1. begin
var remote_1 = new GestureRemote({
   Area: IR.GetItem("Remote").GetItem("Area"),  // GESTURES AREA
   Switcher: IR.GetItem("Remote").GetItem("Switcher"), // GESTURES SWITCHER
   Up: function (){           // up
      //IR.Log("Action Up");
      //IR.GetItem("Remote").GetItem("Item 4").Text = "U";
      IR.GetDevice("Global Cache").Set("MENU TOP", "");
      // add more commands
   },
   Down: function (){         // down
      IR.Log("Action Down");
      IR.GetItem("Remote").GetItem("Item 4").Text = "D";
      // add more commands
   },
   Left: function (){         // left
      IR.Log("Action Left");
      IR.GetItem("Remote").GetItem("Item 4").Text = "L";
      // add more commands
   },
   Right: function (){        //right
      IR.Log("Action Right");
      IR.GetItem("Remote").GetItem("Item 4").Text = "R";
      // add more commands
   },
   DoubleTap: function (){    // DTap
      IR.Log("Action DoubleTap");
      IR.GetItem("Remote").GetItem("Item 4").Text = "T";
      // add more commands
   }
}); 
// Zone 1. end 

// Zone 2. begin
var remote_2 = new GestureRemote({                // set the new name of var remote_XX  !!!
   Area: IR.GetItem("Remote 2").GetItem("Area"),  // GESTURES AREA
   Switcher: IR.GetItem("Remote 2").GetItem("Switcher"), // GESTURES SWITCHER
   Up: function (){           // up
      //IR.Log("Action Up");
      //IR.GetItem("Remote").GetItem("Item 4").Text = "U";
      IR.GetDevice("Global Cache").Set("MENU TOP 1", "");
      // add more commands
   },
   Down: function (){         // down
      IR.Log("Action Down");
      IR.GetItem("Remote").GetItem("Item 4").Text = "D";
      // add more commands
   },
   Left: function (){         // left
      IR.Log("Action Left");
      IR.GetItem("Remote").GetItem("Item 4").Text = "L";
      // add more commands
   },
   Right: function (){        //right
      IR.Log("Action Right");
      IR.GetItem("Remote").GetItem("Item 4").Text = "R";
      // add more commands
   },
   DoubleTap: function (){    // DTap
      IR.Log("Action DoubleTap");
      IR.GetItem("Remote").GetItem("Item 4").Text = "T";
      // add more commands
   }
}); 
// Zone 2. end