1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.marre.sms.nokia;
24
25 import java.io.ByteArrayOutputStream;
26 import java.io.IOException;
27
28 import org.marre.sms.SmsConstants;
29 import org.marre.sms.SmsPortAddressedMessage;
30 import org.marre.sms.SmsUserData;
31
32 /***
33 * Nokia Group Graphic (CLI) message
34 * <p>
35 * <b>Note!</b> I haven't been able to verify that this class works since
36 * I don't have access to a phone that can handle Group Graphic.
37 * @author Markus Eriksson
38 * @version $Id: NokiaGroupGraphic.java,v 1.10 2004/11/20 19:02:35 c95men Exp $
39 */
40 public class NokiaGroupGraphic extends SmsPortAddressedMessage
41 {
42 protected byte[] myOtaBitmap;
43
44 /***
45 * Creates a group graphic SMS message
46 *
47 * @param theOtaBitmap An OtaBitmap object representing the
48 * image to send
49 */
50 public NokiaGroupGraphic(OtaBitmap theOtaBitmap)
51 {
52 this(theOtaBitmap.getBytes());
53 }
54
55 /***
56 * Creates a group graphic SMS message
57 * <p>
58 * The given byte array must be in the Nokia OTA image format.
59 *
60 * @param theOtaImage The ota image as a byte-array
61 */
62 public NokiaGroupGraphic(byte[] theOtaImage)
63 {
64 super(SmsConstants.PORT_NOKIA_CLI_LOGO, 0);
65
66 myOtaBitmap = theOtaImage;
67 }
68
69 public SmsUserData getUserData()
70 {
71 ByteArrayOutputStream baos = new ByteArrayOutputStream(140);
72
73 try
74 {
75
76 baos.write(0x30);
77
78 baos.write(myOtaBitmap);
79
80 baos.close();
81 }
82 catch (IOException ex)
83 {
84
85 }
86
87 return new SmsUserData(baos.toByteArray());
88 }
89 }