diff options
author | h.udo <hudokkow@gmail.com> | 2016-07-01 13:03:00 +0100 |
---|---|---|
committer | h.udo <hudokkow@gmail.com> | 2016-07-01 13:03:00 +0100 |
commit | 069578741149baab7b7881bf82b7f13e4c5de079 (patch) | |
tree | 1cf2a923a9e9f6d5d4b8d26d1c6b06cff63e61a1 /tools | |
parent | 7939afc4b499929eb3a1eb552c6284378085e641 (diff) |
[eventclients] Nuke J2ME
Diffstat (limited to 'tools')
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/README | 23 | ||||
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/build.xml | 31 | ||||
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/icons/icon.png | bin | 3949 -> 0 bytes | |||
-rwxr-xr-x | tools/EventClients/Clients/J2ME Client/j2me_remote.py | 175 | ||||
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/manifest.mf | 7 | ||||
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/src/BluetoothCommunicator.java | 228 | ||||
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/src/BluetoothEvent.java | 27 | ||||
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/src/BluetoothServiceDiscovery.java | 126 | ||||
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/src/KeyCanvas.java | 66 | ||||
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/src/KeyHandler.java | 23 | ||||
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/src/MainScreen.java | 271 | ||||
-rw-r--r-- | tools/EventClients/Clients/J2ME Client/src/XBMCRemote.jad | 9 | ||||
-rw-r--r-- | tools/EventClients/Makefile.in | 5 | ||||
-rw-r--r-- | tools/EventClients/README.txt | 11 |
14 files changed, 0 insertions, 1002 deletions
diff --git a/tools/EventClients/Clients/J2ME Client/README b/tools/EventClients/Clients/J2ME Client/README deleted file mode 100644 index ee1426812c..0000000000 --- a/tools/EventClients/Clients/J2ME Client/README +++ /dev/null @@ -1,23 +0,0 @@ -1. Can I use it? -To use the J2ME client only CLDC 1.0 and MIDP 1.0 is needed. -The client will also need bluetooth and must be able to initialize the connection. - -2. Compiling the client -To compile the J2ME Application some libraries are needed: - *Suns Wireless Toolkit - *Java - *Ant -Before it can be compiled the link to Suns Wireless Toolkit are needed and are in build.xml -under <property name="WTK" value=""> where the value should be the path to the toolkit. -When compiling in ubuntu all that is needed are the following command -# ant -The final jar file will end up in build/release/ -For installations on some J2ME devices a jad file is needed and it needs the correct filesize of the JAR. This is not an -automated process and thus open the build/release/XBMCRemote.jad and alter it is requiered. The filesize is in bytes -and reflects that of build/release/XBMCRemote.jar - -3. Pre Usage -To use the EventClient you'll need to run the EventClient on a computer by: -# python XBMCJ2ME.py -It depends on Pybluez (http://org.csail.mit.edu/pybluez/) and is available in repository -# sudo apt-get install python-bluetooth diff --git a/tools/EventClients/Clients/J2ME Client/build.xml b/tools/EventClients/Clients/J2ME Client/build.xml deleted file mode 100644 index 4e583b21bc..0000000000 --- a/tools/EventClients/Clients/J2ME Client/build.xml +++ /dev/null @@ -1,31 +0,0 @@ -<project name="XBMC Remote" default="make"> - <property name="WTK" value=""/> - <property name="OUTNAME" value="XBMCRemote"/> - <property name="MIDP10_LIB" value="${WTK}/lib/midpapi10.jar"/> - <property name="CLDC10_LIB" value="${WTK}/lib/cldcapi10.jar"/> - <property name="JSR082_LIB" value="${WTK}/lib/jsr082.jar"/> - <property name="ALL_LIB" value="${MIDP10_LIB}:${CLDC10_LIB}:${JSR082_LIB}"/> - - <target name="compile"> - <tstamp/> - <mkdir dir="build/compiled"/> - <javac destdir="build/compiled" srcdir="src" bootclasspath="${ALL_LIB}" target="1.1"/> - </target> - - <target name="preverify" depends="compile"> - <mkdir dir="build/preverified"/> - <exec executable="${WTK}/bin/preverify"> - <arg line="-classpath ${ALL_LIB}"/> - <arg line="-d build/preverified"/> - <arg line="build/compiled"/> - </exec> - </target> - - <target name="make" depends="preverify"> - <mkdir dir="build/release"/> - <jar basedir="build/preverified" jarfile="build/release/${OUTNAME}.jar" manifest="manifest.mf"> - <fileset dir="icons"/> - </jar> - <copy file="src/XBMCRemote.jad" tofile="build/release/${OUTNAME}.jad"/> - </target> -</project> diff --git a/tools/EventClients/Clients/J2ME Client/icons/icon.png b/tools/EventClients/Clients/J2ME Client/icons/icon.png Binary files differdeleted file mode 100644 index 812237b3ac..0000000000 --- a/tools/EventClients/Clients/J2ME Client/icons/icon.png +++ /dev/null diff --git a/tools/EventClients/Clients/J2ME Client/j2me_remote.py b/tools/EventClients/Clients/J2ME Client/j2me_remote.py deleted file mode 100755 index b963a87a79..0000000000 --- a/tools/EventClients/Clients/J2ME Client/j2me_remote.py +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/python -# -# XBMC Media Center -# J2ME Remote -# Copyright (c) 2008 topfs2 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# - -import sys -try: - from kodi.xbmcclient import * - from kodi.bt.bt import * - from kodi.defs import * -except: - sys.path.append('../../lib/python') - from xbmcclient import * - from bt.bt import * - ICON_PATH = "../../icons/" - -from socket import * -import os -from threading import Thread - -host = "localhost" -port = 9777 -addr = (host, port) -sock = socket(AF_INET,SOCK_DGRAM) - -def send_key(key): - packet = PacketBUTTON(map_name="JS0:J2ME", code=key, repeat=0, queue=0) - packet.send(sock, addr) - -def send_message(caption, msg): - packet = PacketNOTIFICATION(caption, - msg, - ICON_PNG, - icon_file=ICON_PATH + "/phone.png") - - packet.send(sock, addr) - -def send_ImageToBluetooth(Image): - imageData = file( Image ).read() - print "Data len ", len( imageData ) - client_sock.send( format.uint32( len( imageData) ) ) - client_sock.sendall(imageData) - print "Sent file" - -class Ping(Thread): - def __init__ (self): - Thread.__init__(self) - def run(self): - import time - while 1: # ping the server every 19s - packet = PacketPING() - packet.send(sock, addr) - time.sleep (19) - -def main(): - import time - - # connect to localhost, port 9777 using a UDP socket - # this only needs to be done once. - # by default this is where XBMC will be listening for incoming - # connections. - server_sock=bt_create_rfcomm_socket() - server_sock.listen(2) - - portBT = server_sock.getsockname()[1] - - uuid = "ACDC" - bt_advertise(socket=server_sock, name="XBMC Remote", uuid=uuid) - - print "Waiting for connection on RFCOMM channel %d" % portBT - - packet = PacketHELO(devicename="J2ME Remote", - icon_type=ICON_PNG, - icon_file=ICON_PATH + "/phone.png") - packet.send(sock, addr) - Ping().start() - while(True): - try: - client_sock, client_info = server_sock.accept() - print "Accepted connection from ", client_info - client_addr, client_port = client_info - runFlag = True - firstRun = True - print "Accepted connection from ", client_addr - except KeyboardInterrupt: - packet = PacketLOG(LOGNOTICE, "J2ME: User interrupted") - packet.send(sock, addr) - bt_stop_advertising(socket = server_sock) - server_sock.close() - sys.exit(0) - try: - while runFlag: - if firstRun: - client_name = client_sock.recv(1024) - firstRun = False - send_message("J2ME: Phone Connected", client_name) - packet = PacketLOG(LOGNOTICE, "Phone Connected") - packet.send(sock, addr) - data = client_sock.recv(3) - if(data[0] == "0"): - if(data[1] == "0"): - runFlag = False - packet = PacketLOG(LOGNOTICE, "J2ME: Recieved disconnect command") - packet.send(sock, addr) - client_sock.close() - if(data[1] == "1"): - print "Shuting down server" - client_sock.close() - bt_stop_advertising(socket = server_sock) - server_sock.close() - packet = PacketBYE() - packet.send(sock, addr) - sys.exit(0) - - elif(data[0] == "2"): - print "<button id=\"%i\">" % ord( data[1] ) - send_key(ord( data[1] ) ) - else: - print "Unkown received data [%s]" % data - except IOError: - print "Lost connection too %s" % client_name - runFlag = False - send_message("Phone Disconnected", client_name) - pass - except KeyboardInterrupt: - packet = PacketLOG(LOGNOTICE, "J2ME: User interrupted") - packet.send(sock, addr) - client_sock.close() - bt_stop_advertising(socket = server_sock) - server_sock.close() - packet = PacketBYE() # PacketPING if you want to ping - packet.send(sock, addr) - sys.exit(0) - -def usage(): - print """ -Java Bluetooth Phone Remote Control Client for XBMC v0.1 - -Usage for xbmcphone.py - --address ADDRESS (default: localhost) - --port PORT (default: 9777) - --help (Brings up this message) -""" - -if __name__=="__main__": - try: - i = 0 - while (i < len(sys.argv)): - if (sys.argv[i] == "--address"): - host = sys.argv[i + 1] - elif (sys.argv[i] == "--port"): - port = sys.argv[i + 1] - elif (sys.argv[i] == "--help"): - usage() - sys.exit(0) - i = i + 1 - main() - except: - sys.exit(0) diff --git a/tools/EventClients/Clients/J2ME Client/manifest.mf b/tools/EventClients/Clients/J2ME Client/manifest.mf deleted file mode 100644 index 49cddf5c28..0000000000 --- a/tools/EventClients/Clients/J2ME Client/manifest.mf +++ /dev/null @@ -1,7 +0,0 @@ -MIDlet-1: MainScreen, , MainScreen -MIDlet-Vendor: team-xbmc -MIDlet-Name: XBMC Remote -MIDlet-Icon: icon.png -MIDlet-Version: 0.1 -MicroEdition-Configuration: CLDC-1.0 -MicroEdition-Profile: MIDP-1.0 diff --git a/tools/EventClients/Clients/J2ME Client/src/BluetoothCommunicator.java b/tools/EventClients/Clients/J2ME Client/src/BluetoothCommunicator.java deleted file mode 100644 index 2db3f54dd2..0000000000 --- a/tools/EventClients/Clients/J2ME Client/src/BluetoothCommunicator.java +++ /dev/null @@ -1,228 +0,0 @@ -/* -* XBMC Media Center -* UDP Event Server -* Copyright (c) 2008 topfs2 -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -import javax.microedition.io.Connector; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import javax.microedition.io.StreamConnection; -import java.lang.NullPointerException; -import java.util.Vector; -import javax.bluetooth.*; -import javax.bluetooth.LocalDevice; -import javax.microedition.lcdui.Form; -import javax.microedition.lcdui.Image; -import javax.microedition.lcdui.Display; -import java.lang.*; - -public class BluetoothCommunicator extends Thread -{ - private boolean Run; - private Form Log; - private BluetoothEvent recvEvent; - - protected static String Address = null; - private static StreamConnection Connection = null; - private static DataInputStream inputStream = null; - private static DataOutputStream outputStream = null; - - public BluetoothCommunicator(BluetoothEvent recvEvent, Form Log) - { - this.recvEvent = recvEvent; - this.Log = Log; - } - - public static boolean Connect(Form Log, String addr) - { - Log.append("Going to connect\n"); - try - { - Connection = (StreamConnection)Connector.open(addr); - - if (Connection == null) - { - Log.append("Connector.open returned null\n"); - return false; - } - else - { - Log.append("Connector.open returned connection\n"); - inputStream = Connection.openDataInputStream(); - outputStream = Connection.openDataOutputStream(); - Address = addr; - return true; - } - } - catch (Exception e) - { - Log.append("Exception" + e.getMessage() + "\n"); - try - { - if (Connection != null) - Connection.close(); - } - catch (Exception ee) - { - Log.append("Exception " + ee.getMessage() + "\n"); - } - Connection = null; - return false; - } - } - - public static boolean Handshake(Form Log, Display disp) - { - if (Connection == null) - return false; - try - { - LocalDevice localDevice = LocalDevice.getLocalDevice(); - Send(localDevice.getFriendlyName()); - - return true; - } - catch(NullPointerException NPE) - { - Log.append("Null " + NPE.getMessage()); - } - catch (IndexOutOfBoundsException IOBE) - { - Log.append("IndexOutOfBounds " + IOBE.getMessage()); - } - catch (IllegalArgumentException IAE) - { - Log.append("illegalArg " + IAE.getMessage()); - } - catch(Exception e) - { - Log.append("Exception in handshake " + e.getMessage()); - } - return false; - } - public void run() - { - Run = true; - while (Run) - { - try - { - if (inputStream.available() <= 0) - sleep(10); - else - { - Log.append("run:Ava " + inputStream.available() + "\n"); - byte []b = new byte[1]; - b[0] = (byte)255; // safe thing for now - inputStream.read(b, 0, 1); - byte[] recv = null; - switch (b[0]) - { - case BluetoothEvent.RECV_SYSTEM: - recv = new byte[]{ inputStream.readByte() }; - break; - case BluetoothEvent.RECV_COMMAND: - recv = new byte[]{ inputStream.readByte() }; - break; - case BluetoothEvent.RECV_IMAGE: - Log.append("Recv_Image\n"); - recv = RecvImage(Log); - break; - } - if (recv != null) - recvEvent.Recv(b[0], recv); - } - } - catch (Exception e) - { - Log.append("RecvException " + e.getMessage()); - } - } - } - public void close() - { - Run = false; - } - public static byte[] RecvImage(Form Log) - { - try - { - int length = inputStream.readInt(); - Log.append("readUnsignedShort: " + length + "\n"); - byte[] arrayToUse = new byte[length]; - inputStream.readFully(arrayToUse, 0, length); - return arrayToUse; - } - catch (Exception e ) - { - Log.append("Exception RecvImage " + e.getMessage()); - return null; - } - } - - public static int Recv(byte[] arrayToUse, Form Log ) - { - if (Connection == null) - return -1; - try - { - return inputStream.read(arrayToUse); - } - catch (Exception e) - { - Log.append("Exception in Recv " + e.getMessage()); - return -1; - } - } - - public static boolean Send(byte[] packet) - { - if (Connection == null) - return false; - try - { - outputStream.write(packet, 0, packet.length); - return true; - } - catch (Exception e) - { - return false; - } - } - - public static boolean Send(String packet) - { - return Send(packet.getBytes()); - } - - public static void Disconnect() - { - if (Connection == null) - return; - - try - { - byte[] packet = { '0', '0' }; - Send(packet); - Connection.close(); - } - catch (Exception e) - { } - - Connection = null; - } -} diff --git a/tools/EventClients/Clients/J2ME Client/src/BluetoothEvent.java b/tools/EventClients/Clients/J2ME Client/src/BluetoothEvent.java deleted file mode 100644 index 6557dca2e0..0000000000 --- a/tools/EventClients/Clients/J2ME Client/src/BluetoothEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -/* -* XBMC Media Center -* UDP Event Server -* Copyright (c) 2008 topfs2 -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -public interface BluetoothEvent { - public final int RECV_SYSTEM = 0; - public final int RECV_COMMAND = 1; - public final int RECV_IMAGE = 2; - - // The header is a byte IRL. 0 - 255 and tells packet type - public void Recv(int Header, byte[] Payload); -} diff --git a/tools/EventClients/Clients/J2ME Client/src/BluetoothServiceDiscovery.java b/tools/EventClients/Clients/J2ME Client/src/BluetoothServiceDiscovery.java deleted file mode 100644 index 3ff71f13f2..0000000000 --- a/tools/EventClients/Clients/J2ME Client/src/BluetoothServiceDiscovery.java +++ /dev/null @@ -1,126 +0,0 @@ -/* -* XBMC Media Center -* UDP Event Server -* Copyright (c) 2008 topfs2 -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -import java.util.Vector; -import javax.bluetooth.DeviceClass; -import javax.bluetooth.DiscoveryAgent; -import javax.bluetooth.DiscoveryListener; -import javax.bluetooth.LocalDevice; -import javax.bluetooth.RemoteDevice; -import javax.bluetooth.ServiceRecord; -import javax.bluetooth.UUID; - -import javax.microedition.lcdui.*; - -public class BluetoothServiceDiscovery implements DiscoveryListener -{ - private static Object lock=new Object(); - private static Vector vecDevices=new Vector(); - private static String connectionURL=null; - - public static String Scan(Form Log, String ScanForUUID) throws Exception - { - BluetoothServiceDiscovery bluetoothServiceDiscovery=new BluetoothServiceDiscovery(); - //display local device address and name - LocalDevice localDevice = LocalDevice.getLocalDevice(); - //find devices - DiscoveryAgent agent = localDevice.getDiscoveryAgent(); - - agent.startInquiry(DiscoveryAgent.GIAC, bluetoothServiceDiscovery); - try - { - synchronized(lock) - { lock.wait(); } - } - catch (InterruptedException e) - { - e.printStackTrace(); - } - Log.append("Device Inquiry Completed. \n"); - - int deviceCount=vecDevices.size(); - if(deviceCount <= 0) - { - Log.append("No Devices Found .\n"); - return null; - } - else - { - Log.append("Bluetooth Devices: \n"); - for (int i = 0; i <deviceCount; i++) - { - RemoteDevice remoteDevice=(RemoteDevice)vecDevices.elementAt(i); - String t = i + ": \"" + remoteDevice.getFriendlyName(true) + "\""; - Log.append(t + "\n"); - } - } - UUID[] uuidSet = new UUID[1]; - if (ScanForUUID != null) - uuidSet[0]=new UUID(ScanForUUID, true); - else - uuidSet[0]=new UUID("ACDC", true); - - for (int i = 0; i < vecDevices.capacity(); i++) - { - RemoteDevice remoteDevice=(RemoteDevice)vecDevices.elementAt(i); - String t = remoteDevice.getFriendlyName(true); - agent.searchServices(null,uuidSet,remoteDevice,bluetoothServiceDiscovery); - try - { - synchronized(lock) - { lock.wait(); } - } - catch (InterruptedException e) - { - e.printStackTrace(); - } - if(connectionURL != null) - return connectionURL; - } - Log.append("Couldn't find any computer that were suitable\n"); - return null; - } - - public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) - { - if(!vecDevices.contains(btDevice)) - vecDevices.addElement(btDevice); - } - - public void servicesDiscovered(int transID, ServiceRecord[] servRecord) - { - if(servRecord!=null && servRecord.length>0){ - connectionURL=servRecord[0].getConnectionURL(0,false); - } - synchronized(lock) - { lock.notify(); } - } - - public void serviceSearchCompleted(int transID, int respCode) - { - synchronized(lock) - { lock.notify(); } - } - - public void inquiryCompleted(int discType) - { - synchronized(lock) - { lock.notify(); } - } -} diff --git a/tools/EventClients/Clients/J2ME Client/src/KeyCanvas.java b/tools/EventClients/Clients/J2ME Client/src/KeyCanvas.java deleted file mode 100644 index 8c2153c0d6..0000000000 --- a/tools/EventClients/Clients/J2ME Client/src/KeyCanvas.java +++ /dev/null @@ -1,66 +0,0 @@ -/* -* XBMC Media Center -* UDP Event Server -* Copyright (c) 2008 topfs2 -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -import javax.microedition.lcdui.*; - -public class KeyCanvas extends Canvas -{ - private KeyHandler m_SendKey = null; - private Image Cover = null; - private boolean SetCover = false; - - public KeyCanvas(KeyHandler sendKey) - { - m_SendKey = sendKey; - try - { -// Cover = Image.createImage("home.png"); - } - catch (Exception e) - { } - } - - public void SetCover(Image newCover) - { - if (newCover != null) - { - SetCover = true; - Cover = newCover; - } - } - - public void paint(Graphics g) - { - g.drawRect(0, 0, this.getWidth(), this.getHeight()); - if (Cover != null) - g.drawImage(Cover, 0, 0, g.TOP|g.LEFT); - } - - public void keyPressed(int keyCode) - { - if (m_SendKey != null) - m_SendKey.keyPressed(keyCode); - } - - public void keyRepeated(int keyCode) - { - if (m_SendKey != null) - m_SendKey.keyPressed(keyCode); - } -} diff --git a/tools/EventClients/Clients/J2ME Client/src/KeyHandler.java b/tools/EventClients/Clients/J2ME Client/src/KeyHandler.java deleted file mode 100644 index a6a5ac10d0..0000000000 --- a/tools/EventClients/Clients/J2ME Client/src/KeyHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/* -* XBMC Media Center -* UDP Event Server -* Copyright (c) 2008 topfs2 -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -public interface KeyHandler -{ - public void keyPressed(int keyCode); -} diff --git a/tools/EventClients/Clients/J2ME Client/src/MainScreen.java b/tools/EventClients/Clients/J2ME Client/src/MainScreen.java deleted file mode 100644 index 2e68c7d211..0000000000 --- a/tools/EventClients/Clients/J2ME Client/src/MainScreen.java +++ /dev/null @@ -1,271 +0,0 @@ -/* -* XBMC Media Center -* UDP Event Server -* Copyright (c) 2008 topfs2 -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -import java.util.Vector; -import javax.bluetooth.DeviceClass; -import javax.bluetooth.DiscoveryAgent; -import javax.bluetooth.DiscoveryListener; -import javax.bluetooth.LocalDevice; -import javax.bluetooth.RemoteDevice; -import javax.bluetooth.ServiceRecord; -import javax.bluetooth.UUID; - -import javax.microedition.midlet.*; -import javax.microedition.lcdui.*; - -public class MainScreen extends MIDlet implements CommandListener, KeyHandler, BluetoothEvent -{ - private boolean LogActive = true; - private final int VersionMajor = 0; - private final int VersionMinor = 1; - private final String Version = (VersionMajor + "." + VersionMinor); - - private final Command CMD_OK = new Command("OK", Command.OK, 1); - private final Command CMD_CONNECT = new Command("Connect", Command.OK, 1); - private final Command CMD_DISCONNECT = new Command("Disconnect", Command.CANCEL, 1); - private final Command CMD_EXIT = new Command("Exit", Command.CANCEL, 1); - private final Command CMD_LOG = new Command("Log", Command.OK, 1); - private final Command CMD_SHOWREMOTE = new Command("Remote", Command.OK, 1); - private Display display; - private Form MainForm; - - private KeyCanvas keyHandler; - private BluetoothCommunicator RecvThread; - - private final int CONNECTED = 1; - private final int NOT_CONNECTED = -1; - private final int CONNECTING = 0; - - private int Connect = NOT_CONNECTED; - - public MainScreen() - { - display = Display.getDisplay(this); - keyHandler = new KeyCanvas(this); - keyHandler.addCommand(CMD_LOG); - keyHandler.addCommand(CMD_DISCONNECT); - keyHandler.setCommandListener(this); - } - - - public void Disconnect() - { - RecvThread.close(); - BluetoothCommunicator.Disconnect(); - MainForm.removeCommand(CMD_DISCONNECT); - MainForm.removeCommand(CMD_SHOWREMOTE); - MainForm.addCommand(CMD_CONNECT); - Connect = NOT_CONNECTED; - } - - public void Connect() - { - if (Connect == CONNECTED) - return; - Connect = CONNECTING; - MainForm = CreateForm("Connect log"); - display.setCurrent(MainForm); - try - { - String Connectable = BluetoothServiceDiscovery.Scan(MainForm, "ACDC"); - if (Connectable != null) - { - MainForm.append("\n" + Connectable); - display.setCurrent(MainForm); - if (BluetoothCommunicator.Connect(MainForm, Connectable)) - Connect = CONNECTED; - else - Connect = NOT_CONNECTED; - - display.setCurrent(MainForm); - BluetoothCommunicator.Handshake(MainForm, display); - RecvThread = new BluetoothCommunicator(this, MainForm); - - display.setCurrent(MainForm); - } - } - catch (Exception e) - { - MainForm.append("Error: Couldn't Search"); - Connect = NOT_CONNECTED; - display.setCurrent(MainForm); - return; - } - - if (Connect == CONNECTED) - { - MainForm.addCommand(CMD_SHOWREMOTE); - MainForm.addCommand(CMD_DISCONNECT); - MainForm.append("Connected to a server now we start the receive thread\n"); - RecvThread.start(); - } - else - { - MainForm.addCommand(CMD_CONNECT); - MainForm.addCommand(CMD_EXIT); - MainForm.append("Not connected to a server"); - } - setCurrent(); - } - - public void startApp() - { - int length = ((255 << 8) | (255)); - System.out.println("Len " + length); - - - MainForm = CreateForm("XBMC Remote"); - MainForm.append("Hi and welcome to the version " + Version + " of XBMC Remote.\nPressing Connect will have this remote connect to the first available Server"); - setCurrent(); - } - - private Form CreateForm(String Title) - { - Form rtnForm = new Form(Title); - if (Connect == CONNECTED) - rtnForm.addCommand(CMD_OK); - else if (Connect == NOT_CONNECTED) - rtnForm.addCommand(CMD_CONNECT); - - if (Connect == CONNECTED) - rtnForm.addCommand(CMD_DISCONNECT); - else if (Connect == NOT_CONNECTED) - rtnForm.addCommand(CMD_EXIT); - - rtnForm.setCommandListener(this); - return rtnForm; - } - - private void setCurrent() - { - setCurrent(false); - } - private void setCurrent(boolean forceLog) - { - if (forceLog) - display.setCurrent(MainForm); - else if (Connect == CONNECTED) - { - display.setCurrent(keyHandler); - keyHandler.repaint(); - } - else - { - display.setCurrent(MainForm); - } - } - - public void pauseApp() - { - } - - public void destroyApp(boolean unconditional) - { - if (Connect == CONNECTED) - { - BluetoothCommunicator.Disconnect(); - RecvThread.close(); - } - } - - public void commandAction(Command c, Displayable d) - { - if (c.equals(CMD_LOG)) - setCurrent(true); - else if (c.equals(CMD_SHOWREMOTE)) - { - display.setCurrent(keyHandler); - keyHandler.repaint(); - } - else if (d.equals(MainForm)) - { - if (c.equals(CMD_OK)) - { - byte[] Packet = {'1', '1'}; // 48 == '0' - BluetoothCommunicator.Send(Packet); - } - else if (c.equals(CMD_CONNECT)) - { - this.Connect(); - } - else if (c.equals(CMD_EXIT)) - System.out.println("QUIT"); - else if (c.equals(CMD_DISCONNECT)) - { - this.Disconnect(); - this.RecvThread.close(); - setCurrent(); - } - } - else if (d.equals(keyHandler)) - { - if (c.equals(CMD_OK)) - { - byte[] Packet = {'2', (byte)251 }; - BluetoothCommunicator.Send(Packet); - } - else if (c.equals(CMD_DISCONNECT)) - { - this.Disconnect(); - Connect = NOT_CONNECTED; - setCurrent(); - } - } - } - - public void keyPressed(int keyCode) - { - byte[] Packet = {'2', (byte)keyCode}; - if (keyCode >= Canvas.KEY_NUM0 && keyCode <= Canvas.KEY_NUM9) - Packet[1] = (byte)keyCode; - - else if (keyCode == Canvas.UP || keyCode == -1) - Packet[1] = 'U'; - else if (keyCode == Canvas.DOWN || keyCode == -2) - Packet[1] = 'D'; - else if (keyCode == Canvas.LEFT || keyCode == -3) - Packet[1] = 'L'; - else if (keyCode == Canvas.RIGHT || keyCode == -4) - Packet[1] = 'R'; - - else if (keyCode == Canvas.KEY_STAR) - Packet[1] = '*'; - else if (keyCode == Canvas.KEY_POUND) - Packet[1] = '#'; - - BluetoothCommunicator.Send(Packet); - System.out.println("got" + keyCode + " I'll send [" + Packet[0] + "," + Packet[1] + "]"); - } - public void Recv(int Header, byte[] Payload) - { - switch(Header) - { - case BluetoothEvent.RECV_COMMAND: - break; - case BluetoothEvent.RECV_SYSTEM: - if (Payload[0] == 0) - this.Disconnect(); - break; - case BluetoothEvent.RECV_IMAGE: - keyHandler.SetCover(Image.createImage(Payload, 0, Payload.length)); - break; - } - } -} diff --git a/tools/EventClients/Clients/J2ME Client/src/XBMCRemote.jad b/tools/EventClients/Clients/J2ME Client/src/XBMCRemote.jad deleted file mode 100644 index e40999eef6..0000000000 --- a/tools/EventClients/Clients/J2ME Client/src/XBMCRemote.jad +++ /dev/null @@ -1,9 +0,0 @@ -MIDlet-1: MainScreen, , MainScreen -MIDlet-Icon: icon.png -MIDlet-Jar-Size: 12153 -MIDlet-Jar-URL: XBMC Remote.jar -MIDlet-Name: XBMC Remote -MIDlet-Vendor: team-xbmc -MIDlet-Version: 0.1 -MicroEdition-Configuration: CLDC-1.0 -MicroEdition-Profile: MIDP-1.0 diff --git a/tools/EventClients/Makefile.in b/tools/EventClients/Makefile.in index 757ee0b141..2cd5712bfa 100644 --- a/tools/EventClients/Makefile.in +++ b/tools/EventClients/Makefile.in @@ -10,14 +10,9 @@ Clients/WiiRemote/WiiRemote: cd Clients/WiiRemote && \ $(CXX) $(CXXFLAGS) $(LDFLAGS) CWIID_WiiRemote.cpp -lcwiid -lbluetooth -DICON_PATH="\"$(datarootdir)/pixmaps/@APP_NAME_LC@/\"" $(WII_EXTRA_OPTS) -o WiiRemote -j2me-remote: - cd Clients/J2ME\ Client - ant -f build.xml - install: Clients/WiiRemote/WiiRemote mkdir -p $(DESTDIR)$(bindir) cp -a Clients/WiiRemote/WiiRemote $(DESTDIR)$(bindir)/@APP_NAME_LC@-wiiremote - cp -a Clients/J2ME\ Client/j2me_remote.py $(DESTDIR)$(bindir)/@APP_NAME_LC@-j2meremote cp -a Clients/PS3\ BD\ Remote/ps3_remote.py $(DESTDIR)$(bindir)/@APP_NAME_LC@-ps3remote cp -a Clients/PS3\ Sixaxis\ Controller/ps3d.py $(DESTDIR)$(bindir)/@APP_NAME_LC@-ps3d cp -a Clients/Kodi\ Send/kodi-send.py $(DESTDIR)$(bindir)/@APP_NAME_LC@-send diff --git a/tools/EventClients/README.txt b/tools/EventClients/README.txt index 6e1a454e5b..591964fb98 100644 --- a/tools/EventClients/README.txt +++ b/tools/EventClients/README.txt @@ -88,14 +88,3 @@ The WiiRemote is mappable with keymap.xml where button id's are the following: 10 = 1 11 = 2 The name is by standard WiiRemote but this can be changed with the --joystick-name - -J2ME (Java Phone Application) ------------------------------ - -To use the J2ME client only CLDC 1.0 and MIDP 1.0 is needed. -The client will also need bluetooth and must be able to initialize the connection. -For compilation of the Java Application see Clients/J2ME Client/README but precompiled versions -exists in our forum. - -The Client is mappable in the same manner as PS3 in keymap.xml but with the name J2ME (<joystick name="J2ME">). -The KeyID's generated in terminal when running j2me_remote.py. |