Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direction controls... #66

Closed
ptruman opened this issue Aug 2, 2020 · 7 comments · Fixed by #147
Closed

Direction controls... #66

ptruman opened this issue Aug 2, 2020 · 7 comments · Fixed by #147

Comments

@ptruman
Copy link

ptruman commented Aug 2, 2020

I'm not much up on my python/sockets, but I have a node script which I've extended to get cursor controls (left/right/up/down/click etc) working

Would you be able to extend yours to incorporate? They are really useful when using the built-in/downloaded Apps.

I see you already have getCursorSocket but are not yet using it?

In Node, I have a function for each direction/command, which runs:

var input_pointer_click = function(fn) {
    input_pointer_send(function() {
      pointer.send("type:click\n" + "\n\n");
    }, fn);
};
var input_pointer_up = function(fn) {
    input_pointer_send(function() {
      pointer.send("type:button\n" + "name:UP\n" + "\n");
    }, fn);
};
var input_pointer_down = function(fn) {
    input_pointer_send(function() {
      pointer.send("type:button\n" + "name:DOWN\n" + "\n");
    }, fn);
};
var input_pointer_left = function(fn) {
    input_pointer_send(function() {
      pointer.send("type:button\n" + "name:LEFT\n" + "\n");
    }, fn);
};
var input_pointer_right = function(fn) {
    input_pointer_send(function() {
      pointer.send("type:button\n" + "name:RIGHT\n" + "\n");
    }, fn);
};
var input_pointer_back = function(fn) {
    input_pointer_send(function() {
      pointer.send("type:button\n" + "name:BACK\n" + "\n");
    }, fn);
};
var input_pointer_disconnect = function(fn) {
  if (pointer) {
      pointer.close();
      pointer = null;
  };
  if (typeof fn === 'function') {
    fn(RESULT_OK);
  }
};
var input_enter = function(fn) {
  send_command("", "request", "ssap://com.webos.service.ime/sendEnterKey", null$
};

The scripts connect to the TV, run the direction command (which gets and then opens the pointer socket) and passes a command to it) - and then calls a disconnect on the socket

input_pointer_send is just issuing the commands to the opened socket.

pointer is declared globally as null, and then set once the pointer socket is opened and reset to null on disconnect

@klattimer
Copy link
Owner

This will be coming in due course.

@klattimer
Copy link
Owner

Added cursor.py, and updated remote.py to include sendEnterKey.

@klattimer
Copy link
Owner

@Tenzer this is largely just hooking up cursor.py to the command line interface at this point as far as I can tell. Maybe you're interested?

@Tenzer
Copy link
Collaborator

Tenzer commented Dec 9, 2023

@klattimer I had a quick go at this today, I could however not get the websocket connection for LGTVCursor set up. It seems like the LGTVCursor.__finalize callback never is called. Have you had this working at all?

@klattimer
Copy link
Owner

@Tenzer not yet, I haven't had the time to look at it recently, I wrote the code a while back and had to dig it out from a couple of different places to push it up. I'll dig around on here and see if I can see why it's not triggered.

@klattimer
Copy link
Owner

This would be an issue here I think.

def getCursorSocket(self, callback=None):
    self.__send_command("request", "ssap://com.webos.service.networkinput/getPointerInputSocket", None, callback)
    
    Maybe the address here is incorrect? 

@Tenzer
Copy link
Collaborator

Tenzer commented Dec 10, 2023

I got it working and I've made a PR with a new command for this in #147. The problem was the command getPointerInputSocket wasn't sent properly to the TV, which caused the callback to never be triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants