Sending keyboard characters through web API?
#1
Question 
Is there any way to invoke character presses in the virtual keyboard using the web API? I tried sending the code F000 (as defined in key.h) + the ASCII code, but this did nothing.
Reply
#2
Feel free to help keep the manual up-to-date while you are working on related topics:
http://www.xboxmediacenter.com/wiki/inde..._Functions
http://www.xboxmediacenter.com/wiki/inde...erHTTP-API
http://www.xboxmediacenter.com/wiki/inde..._Interface
http://www.xboxmediacenter.com/wiki/inde...e_Commands

Rolleyes
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#3
The httpiapi doc still has a bit more info on the sendkey command (ill update the wiki in a bit) http://sourceforge.net/project/showfiles..._id=198866

For keyboard input you have to use 0xF100 + ascii value.

I wrote a script (to be run on a PC) that tunnels most keyboard keys through the httpapi layer. I had a few weird issues with special keys though.. and I've never been able to get mouse events to work.

Code:
#!/usr/bin/python
import socket,threading,urllib,time, sys
import curses
XBOX_IP = '192.168.1.101'

stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(1)


def SubthreadProcStarter(url,port):
    subThread = threading.Thread(target=SubthreadProc, args=(url,port))
    subThread.setDaemon(True)
    subThread.start()
    subThread.join(1.0)


def SubthreadProc(url,key):
    try:
        newurl = url+str(0xF100+key)
        urllib.urlopen(newurl).close()
    except:
        pass


url = 'http://'+XBOX_IP+'/xbmcCmds/xbmcHttp?command=sendkey&parameter='
mapping = {263:0x108,10:0x0D,339:0x21,338:0x22,360:0x23,262:0x24,260:0x25,259:0x26,261:0x27,258:0x28,331:0x2D,330:0x2E}

while 1:
    try:
        c = stdscr.getch()
        if c == -1:
            curses.nocbreak()
            stdscr.keypad(0)
            curses.echo()
            curses.endwin()
            break
        if mapping.has_key(c):
            c = mapping[c] -0x100
        if c <= 255:
            print c
            SubthreadProcStarter(url,c)
# Enter character and enter command are different?        
            if c == 13-256:
                SubthreadProcStarter(url,10)
# Escape character and escape command are different?
            if c == 27:
                SubthreadProcStarter(url,27-256)
    except: pass
Reply
#4
Gamester17 - I'll see what I can do Laugh

Asteron Wrote:For keyboard input you have to use 0xF100 + ascii value.

Just what I was looking for! I must have been reading the Wiki incorrectly. Thanks for the help.

In case anyone is wondering what I am doing, I am developing a remote control that runs on the Nokia 770 (http://en.wikipedia.org/wiki/Nokia_770). It's a handheld Linux computer with an 800x480 touch screen, WiFi, etc. The prices for these have dropped dramatically since the release of the next model - some sites, like Expansys, are selling them off for around £70.00.

With the decent sized touch screen, I should be able to implement a full virtual keyboard - not big enough for touch-typing, but big enough for thumb typing Big Grin

I have some other neat ideas - perhaps using the screenshot function to show a fullscreen view of the interface, then using the mouse functions to allow the user to control the Xbox by tapping on parts of the screen view (if that makes sense).
Reply

Logout Mark Read Team Forum Stats Members Help
Sending keyboard characters through web API?0