diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
commit | c04dcc2e7d834218ef2d4194331e383402495ae1 (patch) | |
tree | 7333e38d10d75386e60f336b80c2443c1166031d /tools/EventClients/examples/java/XBMCDemoClient1.java | |
parent | Initial commit. (diff) | |
download | kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip |
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/EventClients/examples/java/XBMCDemoClient1.java')
-rw-r--r-- | tools/EventClients/examples/java/XBMCDemoClient1.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tools/EventClients/examples/java/XBMCDemoClient1.java b/tools/EventClients/examples/java/XBMCDemoClient1.java new file mode 100644 index 0000000..5bb2821 --- /dev/null +++ b/tools/EventClients/examples/java/XBMCDemoClient1.java @@ -0,0 +1,70 @@ +package org.xbmc.eventclient.demo; + +import java.io.File; +import java.io.IOException; +import java.net.Inet4Address; +import java.net.InetAddress; + +import org.xbmc.eventclient.XBMCClient; + +/** + * Simple Demo EventClient + * @author Stefan Agner + * + */ +public class XBMCDemoClient1 { + + /** + * Simple Demo EventClient + * @param args + */ + public static void main(String[] args) throws IOException, InterruptedException { + InetAddress host = Inet4Address.getByAddress(new byte[] { (byte)127, 0, 0, 1 } ); + + Thread.sleep(20000); + + String iconFile = "/usr/share/xbmc/media/icon.png"; + + if (! new File(iconFile).exists()) { + iconFile = "../../icons/icon.png"; + + if (! new File(iconFile).exists()) { + iconFile = ""; + } + } + + XBMCClient oXBMCClient = null; + + if (iconFile != "") { + oXBMCClient = new XBMCClient(host, 9777, "My Client", iconFile); + } else { + oXBMCClient = new XBMCClient(host, 9777, "My Client"); + } + + Thread.sleep(7000); + + oXBMCClient.sendNotification("My Title", "My Message"); + + + Thread.sleep(7000); + + oXBMCClient.sendButton("KB", "escape", false, true, false, (short)0 , (byte)0); + + + Thread.sleep(7000); + oXBMCClient.sendButton("KB", "escape", true, true, false, (short)0 , (byte)0); + oXBMCClient.sendNotification("My Title", "Escape sent"); + + Thread.sleep(1000); + + oXBMCClient.sendButton("KB", "escape", true, false, false, (short)0 , (byte)0); + oXBMCClient.sendNotification("My Title", "Escape released"); + + Thread.sleep(7000); + oXBMCClient.sendLog((byte)0, "My Client disconnects...."); + oXBMCClient.sendNotification("My Title", "Client will disconnect"); + oXBMCClient.stopClient(); + + } + +} |