* Add possibility to send "long Keypress" via WebRemote
authorStephan Reichholf <sreichholf@users.schwerkraft.elitedvb.net>
Mon, 26 Jul 2010 10:06:42 +0000 (10:06 +0000)
committerStephan Reichholf <sreichholf@users.schwerkraft.elitedvb.net>
Mon, 26 Jul 2010 10:06:42 +0000 (10:06 +0000)
* To use this in external Apps: The following example would send a "long" Info-Keypress: http://dm8000/web/remotecontrol?command=358&type=long

webinterface/src/WebComponents/Sources/RemoteControl.py
webinterface/src/web-data/tools.js
webinterface/src/web-data/tpl/default/tplWebRemote.htm
webinterface/src/web-data/tpl/default/tplWebRemoteOld.htm

index 36a99c0..f456900 100644 (file)
@@ -54,13 +54,20 @@ class RemoteControl(Source):
                        if type == "long":
                                #Doesn't work yet (WHY?)
                                #TODO Fix long key press
-                               flag = self.FLAG_LONG
+                               flag = self.FLAG_LONG           
                        elif type == "ascii":
                                flag = self.FLAG_ASCII
-                               
-               self.eam.keyPressed(self.TYPE_ADVANCED, key, flag)              
                
-               print "[RemoteControl.py] command was was sent (%s)" % key
+               #If type=="long" we need to press send FLAG_MAKE first 
+               if(flag == self.FLAG_LONG):                     
+                       self.eam.keyPressed(self.TYPE_ADVANCED, key, self.FLAG_MAKE)
+
+               #press the key with the desired flag
+               self.eam.keyPressed(self.TYPE_ADVANCED, key, flag)
+               #Release the key                
+               self.eam.keyPressed(self.TYPE_ADVANCED, key, self.FLAG_BREAK)
+                       
+               print "[RemoteControl.py] command was was sent (key: %s, flag: %s)" %(key,flag)
                return ( True, "RC command '" + str(key) + "' has been issued" ) 
 
        result = property(lambda self: self.res)
index 257d4ca..5f89d61 100644 (file)
@@ -33,7 +33,7 @@ var currentLocation = "/hdd/movie";
 var locationsList = [];
 var tagsList = [];
 
-var boxtype = "";
+var boxtype = "dm8000";
 
 function startUpdateCurrentPoller(){
        clearInterval(updateCurrentPoller);
@@ -73,7 +73,7 @@ function incomingDeviceInfoBoxtype(request){
 
 
 function getBoxtype(){
-       doRequest(URL.deviceinfo, incomingDeviceInfoBoxtype, false);
+//     doRequest(URL.deviceinfo, incomingDeviceInfoBoxtype, false);    
 }
 
 function toggleStandby(){
@@ -1142,7 +1142,7 @@ function openWebRemote(){
        if (!webRemoteWin.closed && webRemoteWin.location) {
                setWindowContent(webRemoteWin, template);
        } else {
-               webRemoteWin = openPopup('WebRemote', template, 250, 600);
+               webRemoteWin = openPopup('WebRemote', template, 250, 620);
        }
 
 }
@@ -1159,7 +1159,14 @@ function loadAndOpenWebRemote(){
 
 
 function sendRemoteControlRequest(command){
-       doRequest(URL.remotecontrol+'?command='+command, incomingRemoteControlResult, false);
+       var long = webRemoteWin.document.getElementById('long')
+       if(long.checked){
+               doRequest(URL.remotecontrol+'?command='+command+'&type=long', incomingRemoteControlResult, false);
+               long.checked = undefined;
+       } else {
+               doRequest(URL.remotecontrol+'?command='+command, incomingRemoteControlResult, false);
+       }
+       
        if(webRemoteWin.document.getElementById('getScreen').checked) {
                if(webRemoteWin.document.getElementById('getVideo').checked){
                        getScreenShot();
index 4985c1c..b649c07 100644 (file)
@@ -10,6 +10,7 @@
                <center>
                        Get a Screenshoot&nbsp;<input type="checkbox" id="getScreen" name="getScreen" checked><br>
                        Grab Picture & OSD&nbsp;<input type="checkbox" id="getVideo" name="getVideo"><br>
+                       Send "long" Keypress&nbsp;<input type="checkbox" id="long" name="long" /><br>
                </center>
                <br>
                <!--<center><input type="checkbox" id="getScreen" name="getScreen" checked>&nbsp;Show Screenshot</center><br>-->        
index ead7712..19977dc 100644 (file)
@@ -11,6 +11,7 @@
                <center>
                        Get a Screenshoot&nbsp;<input type="checkbox" id="getScreen" name="getScreen" checked><br>
                        Grab Picture & OSD&nbsp;<input type="checkbox" id="getVideo" name="getVideo"><br>
+                       Send "long" Keypress&nbsp;<input type="checkbox" id="long" name="long" /><br>
                </center>
                <br>
                <!--<center><input type="checkbox" id="getScreen" name="getScreen" checked>&nbsp;Show Screenshot</center><br>-->