001: /*
002: *
003: *
004: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: */
026:
027: //-----------------------------------------------------------------------------
028: // PACKAGE DEFINITION
029: //-----------------------------------------------------------------------------
030: package sim.toolkit;
031:
032: //-----------------------------------------------------------------------------
033: // IMPORTS
034: //-----------------------------------------------------------------------------
035:
036: /**
037: *
038: * The <code>MEProfile</code> class contains methods to question the handset
039: * profile, regarding the SIM Application Toolkit and supposing that this
040: * profile has been set by the <b>Terminal Profile</b> APDU command.
041: * The following table gives the index value according to the facility to
042: * check. This class contains only static methods, no instance of this class is
043: * necessary.<p>
044: *
045: * <br><br><Table Border="1" Cellpadding="3"><tr bgcolor=#c0c0c0 align=center>
046: * <td> <b>Facility</b> </td>
047: * <td> <b>Index</b> </td></tr>
048: * <tr><td> Profile download </td>
049: * <td> 0 </td></tr>
050: * <tr><td> SMS-PP data download </td>
051: * <td> 1 </td></tr>
052: * <tr><td> Cell Broadcast data download </td>
053: * <td> 2 </td></tr>
054: * <tr><td> Menu selection </td>
055: * <td> 3 </td></tr>
056: * <tr><td> '9E xx' response code for SIM data download error</td>
057: * <td> 4 </td></tr>
058: * <tr><td> Timer Expiration </td>
059: * <td> 5 </td></tr>
060: * <tr><td> USSD string data object supported in Call Control</td>
061: * <td> 6 </td></tr>
062: * <tr><td> Envelope Call Control sent during auto. redial </td>
063: * <td> 7 </td></tr>
064: * <tr><td> command result </td>
065: * <td> 8 </td></tr>
066: * <tr><td> Call Control by SIM </td>
067: * <td> 9 </td></tr>
068: * <tr><td> Cell identity included in Call Control by SIM </td>
069: * <td> 10 </td></tr>
070: * <tr><td> MO short message control by SIM </td>
071: * <td> 11 </td></tr>
072: * <tr><td> Handling of the alpha identifier, user indication</td>
073: * <td> 12 </td></tr>
074: * <tr><td> UCS2 Entry supported </td>
075: * <td> 13 </td></tr>
076: * <tr><td> UCS2 Display supported </td>
077: * <td> 14 </td></tr>
078: * <tr><td> Display of the extension Text </td>
079: * <td> 15 </td></tr>
080: * <tr><td> Proactive SIM: Display Text </td>
081: * <td> 16 </td></tr>
082: * <tr><td> Proactive SIM: Get Inkey </td>
083: * <td> 17 </td></tr>
084: * <tr><td> Proactive SIM: Get Input </td>
085: * <td> 18 </td></tr>
086: * <tr><td> Proactive SIM: More Time </td>
087: * <td> 19 </td></tr>
088: * <tr><td> Proactive SIM: Play Tone </td>
089: * <td> 20 </td></tr>
090: * <tr><td> Proactive SIM: Poll Interval </td>
091: * <td> 21 </td></tr>
092: * <tr><td> Proactive SIM: Polling Off </td>
093: * <td> 22 </td></tr>
094: * <tr><td> Proactive SIM: Refresh </td>
095: * <td> 23 </td></tr>
096: * <tr><td> Proactive SIM: Select Item </td>
097: * <td> 24 </td></tr>
098: * <tr><td> Proactive SIM: Send Short Message </td>
099: * <td> 25 </td></tr>
100: * <tr><td> Proactive SIM: Send SS </td>
101: * <td> 26 </td></tr>
102: * <tr><td> Proactive SIM: Send USSD </td>
103: * <td> 27 </td></tr>
104: * <tr><td> Proactive SIM: Set Up Call </td>
105: * <td> 28 </td></tr>
106: * <tr><td> Proactive SIM: Set Up Menu </td>
107: * <td> 29 </td></tr>
108: * <tr><td> Proactive SIM: Provide Local Information </td>
109: * <td> 30 </td></tr>
110: * <tr><td> Proactive SIM: Provide Local Information (NMR) </td>
111: * <td> 31 </td></tr>
112: * <tr><td> Proactive SIM: Set Up Event List </td>
113: * <td> 32 </td></tr>
114: * <tr><td> Event: MT call </td>
115: * <td> 33 </td></tr>
116: * <tr><td> Event: Call connected </td>
117: * <td> 34 </td></tr>
118: * <tr><td> Event: Call disconnected </td>
119: * <td> 35 </td></tr>
120: * <tr><td> Event: Location status </td>
121: * <td> 36 </td></tr>
122: * <tr><td> Event: User activity </td>
123: * <td> 37 </td></tr>
124: * <tr><td> Event: Idle screen available </td>
125: * <td> 38 </td></tr>
126: * <tr><td> Event: Card reader status </td>
127: * <td> 39 </td></tr>
128: * <tr><td> Event: Language selection </td>
129: * <td> 40 </td></tr>
130: * <tr><td> Event: Browser termination </td>
131: * <td> 41 </td></tr>
132: * <tr><td> RFU </td>
133: * <td> 42 </td></tr>
134: * <tr><td> RFU </td>
135: * <td> 43 </td></tr>
136: * <tr><td> RFU </td>
137: * <td> 44 </td></tr>
138: * <tr><td> RFU </td>
139: * <td> 45 </td></tr>
140: * <tr><td> RFU </td>
141: * <td> 46 </td></tr>
142: * <tr><td> RFU </td>
143: * <td> 47 </td></tr>
144: * <tr><td> Proactive SIM: Power ON Card </td>
145: * <td> 48 </td></tr>
146: * <tr><td> Proactive SIM: Power OFF Card </td>
147: * <td> 49 </td></tr>
148: * <tr><td> Proactive SIM: Perform Card APDU </td>
149: * <td> 50 </td></tr>
150: * <tr><td> Proactive SIM: Get Reader Status (reader status) </td>
151: * <td> 51 </td></tr>
152: * <tr><td> Proactive SIM: Get Reader Status (reader ident.) </td>
153: * <td> 52 </td></tr>
154: * <tr><td> RFU </td>
155: * <td> 53 </td></tr>
156: * <tr><td> RFU </td>
157: * <td> 54 </td></tr>
158: * <tr><td> RFU </td>
159: * <td> 55 </td></tr>
160: * <tr><td> Proactive SIM: Timer Management (start, stop) </td>
161: * <td> 56 </td></tr>
162: * <tr><td> Proactive SIM: Timer Management (get cur. value) </td>
163: * <td> 57 </td></tr>
164: * <tr><td> Proactive SIM: Provide Local Info (date,time...) </td>
165: * <td> 58 </td></tr>
166: * <tr><td> Binary choice in Get Inkey </td>
167: * <td> 59 </td></tr>
168: * <tr><td> Set Up Idle Mode Text </td>
169: * <td> 60 </td></tr>
170: * <tr><td> Run AT Command </td>
171: * <td> 61 </td></tr>
172: * <tr><td> 2nd Alpha Id in Set Up Call </td>
173: * <td> 62 </td></tr>
174: * <tr><td> 2nd Capability configuration par. in Call Control</td>
175: * <td> 63 </td></tr>
176: * <tr><td> Sustained Display Text </td>
177: * <td> 64 </td></tr>
178: * <tr><td> Send DTMF </td>
179: * <td> 65 </td></tr>
180: * <tr><td> Proactive SIM: Provide Local Info. (BCCH) </td>
181: * <td> 66 </td></tr>
182: * <tr><td> Proactive SIM: Provide Local Info. (language) </td>
183: * <td> 67 </td></tr>
184: * <tr><td> Proactive SIM: Provide Local Info. (Timing Adv.) </td>
185: * <td> 68 </td></tr>
186: * <tr><td> Proactive SIM: Language Notification </td>
187: * <td> 69 </td></tr>
188: * <tr><td> Proactive SIM: Launch Browser </td>
189: * <td> 70 </td></tr>
190: * <tr><td> RFU </td>
191: * <td> 71 </td></tr>
192: * <tr><td> Soft keys support for Select Item </td>
193: * <td> 72 </td></tr>
194: * <tr><td> Soft keys support for Set Up Menu </td>
195: * <td> 73 </td></tr>
196: * <tr><td> RFU </td>
197: * <td> 74 </td></tr>
198: * <tr><td> RFU </td>
199: * <td> 75 </td></tr>
200: * <tr><td> RFU </td>
201: * <td> 76 </td></tr>
202: * <tr><td> RFU </td>
203: * <td> 77 </td></tr>
204: * <tr><td> RFU </td>
205: * <td> 78 </td></tr>
206: * <tr><td> RFU </td>
207: * <td> 79 </td></tr>
208: * <tr><td> Maximum number of softkeys available (b0) </td>
209: * <td> 80 </td></tr>
210: * <tr><td> Maximum number of softkeys available (b1) </td>
211: * <td> 81 </td></tr>
212: * <tr><td> Maximum number of softkeys available (b2) </td>
213: * <td> 82 </td></tr>
214: * <tr><td> Maximum number of softkeys available (b3) </td>
215: * <td> 83 </td></tr>
216: * <tr><td> Maximum number of softkeys available (b4) </td>
217: * <td> 84 </td></tr>
218: * <tr><td> Maximum number of softkeys available (b5) </td>
219: * <td> 85 </td></tr>
220: * <tr><td> Maximum number of softkeys available (b6) </td>
221: * <td> 86 </td></tr>
222: * <tr><td> Maximum number of softkeys available (b7) </td>
223: * <td> 87 </td></tr>
224: * <tr><td> RFU </td>
225: * <td> 88 </td></tr>
226: * <tr><td> RFU </td>
227: * <td> 89 </td></tr>
228: * <tr><td> RFU </td>
229: * <td> 90 </td></tr>
230: * <tr><td> RFU </td>
231: * <td> 91 </td></tr>
232: * <tr><td> RFU </td>
233: * <td> 92 </td></tr>
234: * <tr><td> RFU </td>
235: * <td> 93 </td></tr>
236: * <tr><td> RFU </td>
237: * <td> 94 </td></tr>
238: * <tr><td> RFU </td>
239: * <td> 95 </td></tr>
240: * <tr><td> RFU </td>
241: * <td> 96 </td></tr>
242: * <tr><td> RFU </td>
243: * <td> 97 </td></tr>
244: * <tr><td> RFU </td>
245: * <td> 98 </td></tr>
246: * <tr><td> RFU </td>
247: * <td> 99 </td></tr>
248: * <tr><td> RFU </td>
249: * <td> 100 </td></tr>
250: * <tr><td> RFU </td>
251: * <td> 101 </td></tr>
252: * <tr><td> RFU </td>
253: * <td> 102 </td></tr>
254: * <tr><td> RFU </td>
255: * <td> 103 </td></tr>
256: * <tr><td> Nb of characters down ME display (b0) </td>
257: * <td> 104 </td></tr>
258: * <tr><td> Nb of characters down ME display (b1) </td>
259: * <td> 105 </td></tr>
260: * <tr><td> Nb of characters down ME display (b2) </td>
261: * <td> 106 </td></tr>
262: * <tr><td> Nb of characters down ME display (b3) </td>
263: * <td> 107 </td></tr>
264: * <tr><td> Nb of characters down ME display (b4) </td>
265: * <td> 108 </td></tr>
266: * <tr><td> RFU </td>
267: * <td> 109 </td></tr>
268: * <tr><td> RFU </td>
269: * <td> 110 </td></tr>
270: * <tr><td> Screen Sizing parameters supported </td>
271: * <td> 111 </td></tr>
272: * <tr><td> Nb of characters accross ME display (b0) </td>
273: * <td> 112 </td></tr>
274: * <tr><td> Nb of characters accross ME display (b1) </td>
275: * <td> 113 </td></tr>
276: * <tr><td> Nb of characters accross ME display (b2) </td>
277: * <td> 114 </td></tr>
278: * <tr><td> Nb of characters accross ME display (b3) </td>
279: * <td> 115 </td></tr>
280: * <tr><td> Nb of characters accross ME display (b4) </td>
281: * <td> 116 </td></tr>
282: * <tr><td> Nb of characters accross ME display (b5) </td>
283: * <td> 117 </td></tr>
284: * <tr><td> Nb of characters accross ME display (b6) </td>
285: * <td> 118 </td></tr>
286: * <tr><td> Variable size fonts supported </td>
287: * <td> 119 </td></tr>
288: * <tr><td> Display can be resized </td>
289: * <td> 120 </td></tr>
290: * <tr><td> Text Wrapping supported </td>
291: * <td> 121 </td></tr>
292: * <tr><td> Text Scrolling supported </td>
293: * <td> 122 </td></tr>
294: * <tr><td> RFU </td>
295: * <td> 123 </td></tr>
296: * <tr><td> RFU </td>
297: * <td> 124 </td></tr>
298: * <tr><td> Width reduction when in a menu (b0) </td>
299: * <td> 125 </td></tr>
300: * <tr><td> Width reduction when in a menu (b1) </td>
301: * <td> 126 </td></tr>
302: * <tr><td> Width reduction when in a menu (b2) </td>
303: * <td> 127 </td></tr>
304: * <tr><td> RFU </td>
305: * <td> 128 </td></tr>
306: * <tr><td> RFU </td>
307: * <td> 129 </td></tr>
308: * <tr><td> RFU </td>
309: * <td> 130 </td></tr>
310: * <tr><td> RFU </td>
311: * <td> 131 </td></tr>
312: * <tr><td> RFU </td>
313: * <td> 132 </td></tr>
314: * <tr><td> RFU </td>
315: * <td> 133 </td></tr>
316: * </Table><br>
317: *
318: * Example of use in a standard Toolkit applet:<pre><code>
319: * private static final byte PROFILE_USSD = (byte)27;
320: *
321: * if (MEProfile.check(PROFILE_USSD) == true) {
322: * // USSD available on the handset
323: * sendTheRequest();
324: * } else {
325: * // abort applet
326: * return;
327: * }
328: * </code></pre>
329: *
330: * @version 8.3.0
331: */
332: public final class MEProfile {
333:
334: // ------------------------------- Constructors ---------------------------
335: /**
336: * constructor
337: */
338: private MEProfile() {
339: }
340:
341: // ------------------------------- Public methods -------------------------
342: /**
343: * Checks a facility in the handset profile.
344: *
345: * @param index the number of the facility to check, according to
346: * the table above.
347: *
348: * @return true if the facility is supported, false otherwise
349: *
350: * @exception ToolkitException with the following reason codes:
351: * <ul> <li>ME_PROFILE_NOT_AVAILABLE if Terminal Profile data
352: * are not available</ul>
353: */
354: public static boolean check(byte index) throws ToolkitException {
355: return false;
356: }
357:
358: /**
359: * Checks a set of facilities in the handset profile.
360: * The method checks all the facilities corresponding to bits set to 1 in
361: * the mask buffer.
362: *
363: * <p> Notes:<ul> <li><em>If </em><code>offset</code><em> or
364: * </em><code>length</code><em> parameter is negative an
365: * </em><code>ArrayIndexOutOfBoundsException</code> <em> exception
366: * is thrown and no check is performed.</em> <li><em>If
367: * </em><code>offset+length</code><em> is greater than
368: * </em><code>mask.length</code><em>, the length of the
369: * </em><code>mask</code><em> array an
370: * </em><code>ArrayIndexOutOfBoundsException</code><em> exception
371: * is thrown and no check is performed.</em> </ul>
372: *
373: * @param mask a byte array containing the mask to compare with the profile
374: * @param offset the starting offset of the mask in the byte array
375: * @param length the length of the mask (at least 1)
376: *
377: * @return true if the set of facilities is supported, false
378: * otherwise. If <code>length</code> is equal to <code>0</code>,
379: * true is returned.
380: *
381: * @exception NullPointerException if <code>mask</code> is <code>null</code>
382: * @exception ArrayIndexOutOfBoundsException if check would cause
383: * access of data outside mask array bounds
384: * @exception ToolkitException with the following reason codes:
385: * <ul> <li>ME_PROFILE_NOT_AVAILABLE if Terminal Profile data
386: * are not available</ul>
387: */
388: public static boolean check(byte[] mask, short offset, short length)
389: throws NullPointerException,
390: ArrayIndexOutOfBoundsException, ToolkitException {
391: return false;
392: }
393:
394: /**
395: * Checks a facility in the handset profile.
396: *
397: * @param index the number of the facility to check, according to
398: * the table above.
399: *
400: * @return true if the facility is supported, false otherwise
401: *
402: * @exception ToolkitException with the following reason codes:
403: * <ul> <li>ME_PROFILE_NOT_AVAILABLE if Terminal Profile data
404: * are not available</ul>
405: */
406: public static boolean check(short index) throws ToolkitException {
407: return false;
408: }
409:
410: /**
411: * Returns the binary value of a parameter, delimited by two
412: * indexes, from the handset profile.
413: *
414: * @param indexMSB index of the Most Significant Bit of the
415: * handset profile .
416: * @param indexLSB index of the Lowest Significant Bit of the
417: * handset profile .
418: *
419: * @return binary value of the data field indicated in the handset profile.
420: *
421: * @exception ToolkitException with the following reason codes:
422: * <ul> <li>ME_PROFILE_NOT_AVAILABLE if Terminal Profile data
423: * are not available <li>BAD_INPUT_PARAMETER if (indexMSB >
424: * indexLSB +16) or (indexMSB < indexLSB) or (indexMSB < 0)
425: * or (indexLSB < 0) </ul>
426: */
427: public static short getValue(short indexMSB, short indexLSB)
428: throws ToolkitException {
429: return 0;
430: }
431:
432: /**
433: * Copies a part of the handset profile in a buffer.
434: *
435: * <p> Notes:<ul> <li><em>If </em><code>dstOffset</code><em> or
436: * </em><code>dstLength</code><em> parameter is negative an
437: * </em><code>ArrayIndexOutOfBoundsException</code> <em> exception
438: * is thrown and no copy is performed.</em> <li><em>If
439: * </em><code>dstOffset+dstLength</code><em> is greater than
440: * </em><code>dstBuffer.length</code><em>, the length of the
441: * </em><code>dstBuffer</code><em> array an
442: * </em><code>ArrayIndexOutOfBoundsException</code><em> exception
443: * is thrown and no copy is performed.</em> </ul>
444: *
445: * @param startOffset offset of the handset profile first byte to be copied
446: * @param dstBuffer destination byte array
447: * @param dstOffset offset within destination byte array to start copy into
448: * @param dstLength byte length to be copy
449: *
450: * @return dstOffset + dstLength
451: *
452: * @exception ArrayIndexOutOfBoundsException if copy would cause
453: * access of data outside array bounds
454: * @exception NullPointerException if <code>dstBuffer<code> is null
455: * @exception ToolkitException with the following reason codes:
456: * <ul> <li>ME_PROFILE_NOT_AVAILABLE if Terminal Profile data
457: * are not available</ul>
458: */
459: public static short copy(short startOffset, byte[] dstBuffer,
460: short dstOffset, short dstLength)
461: throws ArrayIndexOutOfBoundsException,
462: NullPointerException, ToolkitException {
463: return 0;
464: }
465: }
|