kodi
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Attributes | List of all members
org.xbmc.eventclient.Packet Class Referenceabstract

XBMC Event Client Class. More...

Inheritance diagram for org.xbmc.eventclient.Packet:
Inheritance graph
[legend]
Collaboration diagram for org.xbmc.eventclient.Packet:
Collaboration graph
[legend]

Public Member Functions

int getNumPackets ()
 Get Number of Packets which will be sent with current Payload... More...
 
void send (InetAddress adr, int port) throws IOException
 Sends this packet to the EventServer. More...
 

Static Public Attributes

static final byte ICON_NONE = 0x00
 
static final byte ICON_JPEG = 0x01
 
static final byte ICON_PNG = 0x02
 
static final byte ICON_GIF = 0x03
 

Protected Member Functions

 Packet (short packettype)
 This is an Abstract class and cannot be instanced. More...
 
void appendPayload (String payload)
 Appends a String to the payload (terminated with 0x00) More...
 
void appendPayload (byte payload)
 Appends a single Byte to the payload. More...
 
void appendPayload (byte[] payloadarr)
 Appends a Byte-Array to the payload. More...
 
void appendPayload (int i)
 Appends an integer to the payload. More...
 
void appendPayload (short s)
 Appends a short to the payload. More...
 

Static Protected Attributes

static final byte PT_HELO = 0x01
 
static final byte PT_BYE = 0x02
 
static final byte PT_BUTTON = 0x03
 
static final byte PT_MOUSE = 0x04
 
static final byte PT_PING = 0x05
 
static final byte PT_BROADCAST = 0x06
 
static final byte PT_NOTIFICATION = 0x07
 
static final byte PT_BLOB = 0x08
 
static final byte PT_LOG = 0x09
 
static final byte PT_ACTION = 0x0A
 
static final byte PT_DEBUG = (byte)0xFF
 

Detailed Description

XBMC Event Client Class.

Implementation of XBMC's UDP based input system. A set of classes that abstract the various packets that the event server currently supports. In addition, there's also a class, XBMCClient, that provides functions that sends the various packets. Use XBMCClient if you don't need complete control over packet structure.

The basic workflow involves:

  1. Send a HELO packet
  2. Send x number of valid packets
  3. Send a BYE packet

IMPORTANT NOTE ABOUT TIMEOUTS: A client is considered to be timed out if XBMC doesn't received a packet at least once every 60 seconds. To "ping" XBMC with an empty packet use PacketPING or XBMCClient.ping(). See the documentation for details.

Base class that implements a single event packet.

  -----------------------------
  | -H1 Signature ("XBMC")    | - 4  x CHAR                4B
  | -H2 Version (eg. 2.0)     | - 2  x UNSIGNED CHAR       2B
  | -H3 PacketType            | - 1  x UNSIGNED SHORT      2B
  | -H4 Sequence number       | - 1  x UNSIGNED LONG       4B
  | -H5 No. of packets in msg | - 1  x UNSIGNED LONG       4B
  | -H6 Payloadsize of packet | - 1  x UNSIGNED SHORT      2B
  | -H7 Client's unique token | - 1  x UNSIGNED LONG       4B
  | -H8 Reserved              | - 10 x UNSIGNED CHAR      10B
  |---------------------------|
  | -P1 payload               | -
  -----------------------------
Author
Stefan Agner

Constructor & Destructor Documentation

◆ Packet()

org.xbmc.eventclient.Packet.Packet ( short  packettype)
inlineprotected

This is an Abstract class and cannot be instanced.

Please use one of the Packet implementation Classes (PacketXXX).

Implements an XBMC Event Client Packet. Type is to be specified at creation time, Payload can be added with the various appendPayload methods. Packet can be sent through UDP-Socket with method "send".

Parameters
packettypeType of Packet (PT_XXX)

Member Function Documentation

◆ appendPayload() [1/5]

void org.xbmc.eventclient.Packet.appendPayload ( String  payload)
inlineprotected

Appends a String to the payload (terminated with 0x00)

Parameters
payloadPayload as String

◆ appendPayload() [2/5]

void org.xbmc.eventclient.Packet.appendPayload ( byte  payload)
inlineprotected

Appends a single Byte to the payload.

Parameters
payloadPayload

◆ appendPayload() [3/5]

void org.xbmc.eventclient.Packet.appendPayload ( byte []  payloadarr)
inlineprotected

Appends a Byte-Array to the payload.

Parameters
payloadarrPayload

◆ appendPayload() [4/5]

void org.xbmc.eventclient.Packet.appendPayload ( int  i)
inlineprotected

Appends an integer to the payload.

Parameters
iPayload

◆ appendPayload() [5/5]

void org.xbmc.eventclient.Packet.appendPayload ( short  s)
inlineprotected

Appends a short to the payload.

Parameters
sPayload

◆ getNumPackets()

int org.xbmc.eventclient.Packet.getNumPackets ( )
inline

Get Number of Packets which will be sent with current Payload...

Returns
Number of Packets

◆ send()

void org.xbmc.eventclient.Packet.send ( InetAddress  adr,
int  port 
) throws IOException
inline

Sends this packet to the EventServer.

Parameters
adrAddress of the EventServer
portPort of the EventServer
Exceptions
IOException

The documentation for this class was generated from the following file: