[cosmetics] update date in GPL header
[vuplus_xbmc] / tools / EventClients / lib / java / src / org / xbmc / eventclient / PacketHELO.java
1 /*
2  *  Copyright (C) 2008-2013 Team XBMC
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License along
15  *  with this program; if not, write to the Free Software Foundation, Inc.,
16  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19 package org.xbmc.eventclient;
20 import java.nio.charset.Charset;
21
22 /**
23  * XBMC Event Client Class
24  * 
25  * A HELO packet establishes a valid connection to XBMC. It is the
26  * first packet that should be sent.
27  * @author Stefan Agner
28  *
29  */
30 public class PacketHELO extends Packet {
31         
32         
33         /**
34          * A HELO packet establishes a valid connection to XBMC.
35          * @param devicename Name of the device which connects to XBMC
36          */
37         public PacketHELO(String devicename)
38         {
39                 super(PT_HELO);
40                 this.appendPayload(devicename);
41                 this.appendPayload(ICON_NONE);
42                 this.appendPayload((short)0); // port no
43                 this.appendPayload(0); // reserved1
44                 this.appendPayload(0); // reserved2
45         }
46
47         /**
48          * A HELO packet establishes a valid connection to XBMC.
49          * @param devicename Name of the device which connects to XBMC
50          * @param iconType Type of the icon (Packet.ICON_PNG, Packet.ICON_JPEG or Packet.ICON_GIF)
51          * @param iconData The icon as a Byte-Array
52          */
53         public PacketHELO(String devicename, byte iconType, byte[] iconData)
54         {
55                 super(PT_HELO);
56                 this.appendPayload(devicename);
57                 this.appendPayload(iconType);
58                 this.appendPayload((short)0); // port no
59                 this.appendPayload(0); // reserved1
60                 this.appendPayload(0); // reserved2
61                 this.appendPayload(iconData); // reserved2
62         }
63         
64 }