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.UnsupportedEncodingException;
26
27 import org.marre.sms.SmsUserData;
28 /***
29 * Nokia Downloadable Profile
30 *
31 * @author Markus Eriksson
32 * @version $Id: NokiaDownloadableProfile.java,v 1.6 2004/11/02 17:59:50 c95men Exp $
33 */
34 public class NokiaDownloadableProfile extends NokiaMultipartMessage
35 {
36 private String myProfileName;
37 private byte[] myScreenSaver;
38 private byte[] myRingingTone;
39
40 public NokiaDownloadableProfile()
41 {
42 }
43
44 public NokiaDownloadableProfile(String theProfileName)
45 {
46 setProfileName(theProfileName);
47 }
48
49 public void setScreenSaver(byte[] theBitmap)
50 {
51 myScreenSaver = theBitmap;
52 }
53
54 public void setScreenSaver(OtaBitmap theBitmap)
55 {
56 myScreenSaver = theBitmap.getBytes();
57 }
58
59 public void setProfileName(String theProfileName)
60 {
61 myProfileName = theProfileName;
62 }
63
64 public void setRingingTone(byte[] theRingingTone)
65 {
66 myRingingTone = theRingingTone;
67 }
68
69 private void addProfileName(String theProfileName)
70 {
71 }
72
73 public SmsUserData getUserData()
74 {
75
76 clear();
77
78
79 if (myProfileName != null)
80 {
81 try
82 {
83 addMultipart(NokiaPart.ITEM_PROFILE_NAME, myProfileName.getBytes("UTF-16BE"));
84 }
85 catch (UnsupportedEncodingException ex)
86 {
87 throw new RuntimeException(ex.getMessage());
88 }
89 }
90
91 if (myScreenSaver != null)
92 {
93 addMultipart(NokiaPart.ITEM_SCREEN_SAVER, myScreenSaver);
94 }
95
96 if (myRingingTone != null)
97 {
98 addMultipart(NokiaPart.ITEM_RINGTONE, myRingingTone);
99 }
100
101 return super.getUserData();
102 }
103 }