Revision: 2486
http://sourceforge.net/p/swingme/code/2486
Author: yuranet
Date: 2021-06-28 13:56:58 +0000 (Mon, 28 Jun 2021)
Log Message:
-----------
use shared impl classes
Modified Paths:
--------------
iOSME/build.gradle
iOSME/src/javax/microedition/io/Connector.java
iOSME/src/javax/microedition/lcdui/Image.java
Added Paths:
-----------
iOSME/src/javax/bluetooth/
iOSME/src/javax/bluetooth/BluetoothConnectionException.java
iOSME/src/javax/bluetooth/BluetoothStateException.java
iOSME/src/javax/bluetooth/DataElement.java
iOSME/src/javax/bluetooth/DeviceClass.java
iOSME/src/javax/bluetooth/DiscoveryAgent.java
iOSME/src/javax/bluetooth/DiscoveryListener.java
iOSME/src/javax/bluetooth/L2CAPConnection.java
iOSME/src/javax/bluetooth/L2CAPConnectionNotifier.java
iOSME/src/javax/bluetooth/LocalDevice.java
iOSME/src/javax/bluetooth/RemoteDevice.java
iOSME/src/javax/bluetooth/ServiceRecord.java
iOSME/src/javax/bluetooth/ServiceRegistrationException.java
iOSME/src/javax/bluetooth/UUID.java
Modified: iOSME/build.gradle
===================================================================
--- iOSME/build.gradle 2021-06-28 13:53:39 UTC (rev 2485)
+++ iOSME/build.gradle 2021-06-28 13:56:58 UTC (rev 2486)
@@ -22,4 +22,5 @@
dependencies {
compileOnly files(moe.platformJar, moe.sdk.coreJar)
+ implementation project(":SwingME")
}
\ No newline at end of file
Added: iOSME/src/javax/bluetooth/BluetoothConnectionException.java
===================================================================
--- iOSME/src/javax/bluetooth/BluetoothConnectionException.java (rev 0)
+++ iOSME/src/javax/bluetooth/BluetoothConnectionException.java 2021-06-28 13:56:58 UTC (rev 2486)
@@ -0,0 +1,123 @@
+/**
+ * Java docs licensed under the Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * (c) Copyright 2001, 2002 Motorola, Inc. ALL RIGHTS RESERVED.
+ *
+ *
+ * @version $Id: BluetoothConnectionException.java 1379 2007-10-13 02:00:43Z vlads $
+ */
+package javax.bluetooth;
+
+import java.io.IOException;
+
+/**
+ * This {@code BluetoothConnectionException} is thrown when a Bluetooth
+ * connection (L2CAP, RFCOMM, or OBEX over RFCOMM) cannot be established
+ * successfully. The fields in this exception class indicate the cause of
+ * the exception. For example, an L2CAP connection may fail due to a
+ * security problem. This reason is passed on to the application through
+ * this class.
+ *
+ * @version 1.0 February 11, 2002
+ *
+ */
+public class BluetoothConnectionException extends IOException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Indicates the connection to the server failed because no service
+ * for the given PSM was registered.
+ * <p>
+ * The value for {@code UNKNOWN_PSM} is 0x0001 (1).
+ */
+ public final static int UNKNOWN_PSM = 0x0001;
+
+ /**
+ * Indicates the connection failed because the security settings on
+ * the local device or the remote device were incompatible with the
+ * request.
+ * <p>
+ * The value for {@code SECURITY_BLOCK} is 0x0002 (2).
+ */
+ public final static int SECURITY_BLOCK = 0x002;
+ /**
+ * Indicates the connection failed due to a lack of resources either
+ * on the local device or on the remote device.
+ * <p>
+ * The value for {@code NO_RESOURCES} is 0x0003 (3).
+ */
+ public final static int NO_RESOURCES = 0x0003;
+
+ /**
+ * Indicates the connection to the server failed due to unknown
+ * reasons.
+ * <p>
+ * The value for {@code FAILED_NOINFO} is 0x0004 (4).
+ */
+ public final static int FAILED_NOINFO = 0x0004;
+
+ /**
+ * Indicates the connection to the server failed due to a timeout.
+ * <p>
+ * The value for {@code TIMEOUT} is 0x0005 (5).
+ */
+ public final static int TIMEOUT = 0x0005;
+
+ /**
+ * Indicates the connection failed because the configuration
+ * parameters provided were not acceptable to either the remote
+ * device or the local device.
+ * <p>
+ * The value for {@code UNACCEPTABLE_PARAMS} is 0x0006 (6).
+ */
+ public final static int UNACCEPTABLE_PARAMS = 0x0006;
+
+
+ private int errorCode;
+
+ /**
+ * Creates a new {@code BluetoothConnectionException} with the error
+ * indicator specified.
+ *
+ * @param error indicates the exception condition; must be one
+ * of the constants described in this class
+ * @throws java.lang.IllegalArgumentException if the input value
+ * is not one of the constants in this class
+ */
+ public BluetoothConnectionException(int error) {
+ super();
+ if(error < 1 || error > 6) {
+ throw new java.lang.IllegalArgumentException();
+ }
+ errorCode = error;
+ }
+
+ /**
+ * Creates a new {@code BluetoothConnectionException} with the error
+ * indicator and message specified.
+ *
+ * @param error indicates the exception condition; must be one of
+ * the constants described in this class
+ * @param msg a description of the exception; may by {@code null}
+ * @throws java.lang.IllegalArgumentException if the input value
+ * is not one of the constants in this class
+ */
+ public BluetoothConnectionException(int error, String msg){
+ super(msg);
+ if (error < 1 || error > 6) {
+ throw new java.lang.IllegalArgumentException();
+ }
+ errorCode = error;
+ }
+ /**
+ * Gets the status set in the constructor that will indicate the
+ * reason for the exception.
+ *
+ * @return cause for the exception; will be one of the constants
+ * defined in this class
+ */
+ public int getStatus() {
+ return errorCode;
+ }
+}
Property changes on: iOSME/src/javax/bluetooth/BluetoothConnectionException.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: iOSME/src/javax/bluetooth/BluetoothStateException.java
===================================================================
--- iOSME/src/javax/bluetooth/BluetoothStateException.java (rev 0)
+++ iOSME/src/javax/bluetooth/BluetoothStateException.java 2021-06-28 13:56:58 UTC (rev 2486)
@@ -0,0 +1,46 @@
+/**
+ * Java docs licensed under the Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * (c) Copyright 2001, 2002 Motorola, Inc. ALL RIGHTS RESERVED.
+ *
+ *
+ * @version $Id: BluetoothStateException.java 1379 2007-10-13 02:00:43Z vlads $
+ */
+
+package javax.bluetooth;
+
+import java.io.IOException;
+
+/**
+ * The <code>BluetoothStateException</code> is thrown when
+ * a request is made to the Bluetooth system that
+ * the system cannot support in its present state. If, however, the
+ * Bluetooth system was not in this state, it could support this operation.
+ * For example, some Bluetooth systems do not allow the device to go into
+ * inquiry mode if a connection is established. This exception would be
+ * thrown if <code>startInquiry()</code> were called.
+ *
+ * @version 1.0 February 11, 2002
+ */
+public class BluetoothStateException extends IOException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new <code>BluetoothStateException</code> without a detail
+ * message.
+ */
+ public BluetoothStateException() {
+ }
+
+ /**
+ * Creates a <code>BluetoothStateException</code> with the specified
+ * detail message.
+ *
+ * @param msg the reason for the exception
+ */
+
+ public BluetoothStateException(String msg) {
+ super(msg);
+ }
+}
\ No newline at end of file
Property changes on: iOSME/src/javax/bluetooth/BluetoothStateException.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: iOSME/src/javax/bluetooth/DataElement.java
===================================================================
--- iOSME/src/javax/bluetooth/DataElement.java (rev 0)
+++ iOSME/src/javax/bluetooth/DataElement.java 2021-06-28 13:56:58 UTC (rev 2486)
@@ -0,0 +1,732 @@
+/**
+ * Java docs licensed under the Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * (c) Copyright 2001, 2002 Motorola, Inc. ALL RIGHTS RESERVED.
+ *
+ *
+ * @version $Id: DataElement.java 1379 2007-10-13 02:00:43Z vlads $
+ */
+
+package javax.bluetooth;
+
+import java.util.Vector;
+
+/**
+ * The <code>DataElement</code> class defines the various data
+ * types that a Bluetooth service attribute value may have.
+ *
+ * The following table describes the data types and valid
+ * values that a <code>DataElement</code> object can store.
+ *
+ * <TABLE BORDER>
+ * <TR><TH>Data Type</TH><TH>Valid Values</TH></TR>
+ * <TR><TD><code>NULL</code></TD><TD>represents a
+ * <code>null</code> value
+ * </TD></TR> <TR><TD><code>U_INT_1</code></TD><TD><code>
+ * long </code> value range [0, 255]</TD></TR>
+ * <TR><TD><code>U_INT_2</code></TD><TD><code>long</code>
+ * value range [0, 2<sup>16</sup>-1]</TD></TR>
+ * <TR><TD><code>U_INT_4</code></TD>
+ * <TD><code>long</code> value range [0, 2<sup>32</sup>-1]</TD></TR>
+ * <TR><TD><code>U_INT_8</code></TD>
+ * <TD><code>byte[]</code> value range [0, 2<sup>64</sup>-1]</TD></TR>
+ * <TR><TD><code>U_INT_16</code></TD>
+ * <TD><code>byte[]</code> value range [0, 2<sup>128</sup>-1]</TD></TR>
+ * <TR><TD><code>INT_1</code></TD><TD><code>long</code>
+ * value range [-128, 127]</TD></TR>
+ * <TR><TD><code>INT_2</code></TD><TD><code>long</code>
+ * value range [-2<sup>15</sup>, 2<sup>15</sup>-1]</TD></TR>
+ * <TR><TD><code>INT_4</code></TD><TD><code>long</code>
+ * value range [-2<sup>31</sup>, 2<sup>31</sup>-1]</TD></TR>
+ * <TR><TD><code>INT_8</code></TD><TD><code>long</code>
+ * value range [-2<sup>63</sup>, 2<sup>63</sup>-1]</TD></TR>
+ * <TR><TD><code>INT_16</code></TD><TD><code>byte[]</code>
+ * value range [-2<sup>127</sup>, 2<sup>127</sup>-1]</TD></TR>
+ * <TR><TD><code>URL</code></TD>
+ * <TD><code>java.lang.String</code></TD></TR>
+ * <TR><TD><code>UUID</code></TD>
+ * <TD><code>javax.bluetooth.UUID</code></TD></TR>
+ * <TR><TD><code>BOOL</code></TD><TD><code>boolean</code></TD></TR>
+ * <TR><TD><code>STRING</code></TD>
+ * <TD><code>java.lang.String</code></TD></TR>
+ * <TR><TD><code>DATSEQ</code></TD>
+ * <TD><code>java.util.Enumeration</code></TD></TR>
+ * <TR><TD><code>DATALT</code></TD>
+ * <TD><code>java.util.Enumeration</code></TD></TR>
+ * </TABLE>
+ *
+ * @version 1.0 February 11, 2002
+ *
+ */
+
+public class DataElement {
+
+
+
+
+ /*
+ * The following section defines public, static and instance
+ * member variables used in the implementation of the methods.
+ */
+
+
+
+ /**
+ * Defines data of type NULL.
+ *
+ * The value for data type <code>DataElement.NULL</code> is
+ * implicit, i.e., there is no representation of it.
+ * Accordingly there is no method to retrieve
+ * it, and attempts to retrieve the value will throw an exception.
+ * <P>
+ * The value of <code>NULL</code> is 0x00 (0).
+ *
+ */
+ public static final int NULL = 0x0000;
+
+ /**
+ * Defines an unsigned integer of size one byte.
+ * <P>
+ * The value of the constant <code>U_INT_1</code>
+ * is 0x08 (8).
+ */
+ public static final int U_INT_1 = 0x0008;
+
+ /**
+ * Defines an unsigned integer of size two bytes.
+ * <P>
+ * The value of the constant <code>U_INT_2</code> is 0x09 (9).
+ */
+ public static final int U_INT_2 = 0x0009;
+
+ /**
+ * Defines an unsigned integer of size four bytes.
+ * <P>
+ * The value of the constant <code>U_INT_4</code> is 0x0A (10).
+ */
+ public static final int U_INT_4 = 0x000A;
+
+ /**
+ * Defines an unsigned integer of size eight bytes.
+ * <P>
+ * The value of the constant <code>U_INT_8</code> is 0x0B (11).
+ */
+ public static final int U_INT_8 = 0x000B;
+
+ /**
+ * Defines an unsigned integer of size sixteen bytes.
+ * <P>
+ * The value of the constant <code>U_INT_16</code> is 0x0C (12).
+ */
+ public static final int U_INT_16 = 0x000C;
+
+ /**
+ * Defines a signed integer of size one byte.
+ * <P>
+ * The value of the constant <code>INT_1</code> is 0x10 (16).
+ */
+ public static final int INT_1 = 0x0010;
+
+ /**
+ * Defines a signed integer of size two bytes.
+ * <P>
+ * The value of the constant <code>INT_2</code> is 0x11 (17).
+ */
+ public static final int INT_2 = 0x0011;
+
+ /**
+ * Defines a signed integer of size four bytes.
+ * <P>
+ * The value of the constant <code>INT_4</code> is 0x12 (18).
+ */
+ public static final int INT_4 = 0x0012;
+
+ /**
+ * Defines a signed integer of size eight bytes.
+ * <P>
+ * The value of the constant <code>INT_8</code> is 0x13 (19).
+ */
+ public static final int INT_8 = 0x0013;
+
+ /**
+ * Defines a signed integer of size sixteen bytes.
+ * <P>
+ * The value of the constant <code>INT_16</code> is 0x14 (20).
+ */
+ public static final int INT_16 = 0x0014;
+
+ /**
+ * Defines data of type URL.
+ * <P>
+ * The value of the constant <code>URL</code> is 0x40 (64).
+ */
+ public static final int URL = 0x0040;
+
+ /**
+ * Defines data of type UUID.
+ * <P>
+ * The value of the constant <code>UUID</code> is 0x18 (24).
+ */
+ public static final int UUID = 0x0018;
+
+ /**
+ * Defines data of type BOOL.
+ * <P>
+ * The value of the constant <code>BOOL</code> is 0x28 (40).
+ */
+ public static final int BOOL = 0x0028;
+
+ /**
+ * Defines data of type STRING.
+ * <P>
+ * The value of the constant <code>STRING</code> is 0x20 (32).
+ */
+ public static final int STRING = 0x0020;
+
+ /**
+ * Defines data of type DATSEQ. The service attribute value whose
+ * data has this type must consider all the elements of the list,
+ * i.e. the value is the whole set and not a subset. The elements
+ * of the set can be of any type defined in this class, including
+ * DATSEQ.
+ * <P>
+ * The value of the constant <code>DATSEQ</code> is 0x30 (48).
+ */
+ public static final int DATSEQ = 0x0030;
+
+ /**
+ * Defines data of type DATALT. The service attribute value whose
+ * data has this type must consider only one of the elements of the
+ * set, i.e., the value is the not the whole set but only one
+ * element of the set. The user is free to choose any one element.
+ * The elements of the set can be of any type defined in this class,
+ * including DATALT.
+ * <P>
+ * The value of the constant <code>DATALT</code> is 0x38 (56).
+ */
+ public static final int DATALT = 0x0038;
+
+ private Object value;
+
+ private int valueType;
+
+ /**
+ * Creates a <code>DataElement</code> of type <code>NULL</code>,
+ * <code>DATALT</code>, or <code>DATSEQ</code>.
+ *
+ * @see #NULL
+ * @see #DATALT
+ * @see #DATSEQ
+ *
+ * @param valueType the type of DataElement to create:
+ * <code>NULL</code>, <code>DATALT</code>, or <code>DATSEQ</code>
+ *
+ * @exception IllegalArgumentException if <code>valueType</code>
+ * is not <code>NULL</code>, <code>DATALT</code>, or
+ * <code>DATSEQ</code>
+ */
+
+ public DataElement(int valueType) {
+ switch (valueType) {
+ case NULL:
+ value = null;
+ break;
+ case DATALT:
+ case DATSEQ:
+ value = new Vector();
+ break;
+ default:
+ throw new IllegalArgumentException();
+ }
+
+ this.valueType = valueType;
+ }
+
+ /**
+ * Creates a <code>DataElement</code> whose data type is
+ * <code>BOOL</code> and whose value is equal to <code>bool</code>
+ *
+ * @see #BOOL
+ *
+ * @param bool the value of the <code>DataElement</code> of type
+ * BOOL.
+ */
+
+ public DataElement(boolean bool) {
+ value = bool?Boolean.TRUE:Boolean.FALSE;
+ valueType = BOOL;
+ }
+
+ /**
+ * Creates a <code>DataElement</code> that encapsulates an integer
+ * value of size <code>U_INT_1</code>, <code>U_INT_2</code>,
+ * <code>U_INT_4</code>, <code>INT_1</code>, <code>INT_2</code>,
+ * <code>INT_4</code>, and <code>INT_8</code>.
+ * The legal values for the <code>valueType</code> and the corresponding
+ * attribute values are:
+ * <TABLE>
+ * <TR><TH>Value Type</TH><TH>Value Range</TH></TR>
+ * <TR><TD><code>U_INT_1</code></TD>
+ * <TD>[0, 2<sup>8</sup>-1]</TD></TR>
+ * <TR><TD><code>U_INT_2</code></TD>
+ * <TD>[0, 2<sup>16</sup>-1]</TD></TR>
+ * <TR><TD><code>U_INT_4</code></TD>
+ * <TD>[0, 2<sup>32</sup>-1]</TD></TR>
+ * <TR><TD><code>INT_1</code></TD>
+ * <TD>[-2<sup>7</sup>, 2<sup>7</sup>-1]</TD></TR>
+ * <TR><TD><code>INT_2</code></TD>
+ * <TD>[-2<sup>15</sup>, 2<sup>15</sup>-1]</TD></TR>
+ * <TR><TD><code>INT_4</code></TD>
+ * <TD>[-2<sup>31</sup>, 2<sup>31</sup>-1]</TD></TR>
+ * <TR><TD><code>INT_8</code></TD>
+ * <TD>[-2<sup>63</sup>, 2<sup>63</sup>-1]</TD></TR>
+ * </TABLE>
+ * All other pairings are illegal and will cause an
+ * <code>IllegalArgumentException</code> to be thrown.
+ *
+ * @see #U_INT_1
+ * @see #U_INT_2
+ * @see #U_INT_4
+ * @see #INT_1
+ * @see #INT_2
+ * @see #INT_4
+ * @see #INT_8
+ *
+ * @param valueType the data type of the object that is being
+ * created; must be one of the following:
+ * <code>U_INT_1</code>,
+ * <code>U_INT_2</code>,
+ * <code>U_INT_4</code>,
+ * <code>INT_1</code>,
+ * <code>INT_2</code>,
+ * <code>INT_4</code>, or
+ * <code>INT_8</code>
+ *
+ * @param value the value of the object being created; must be
+ * in the range specified for the given <code>valueType</code>
+ *
+ * @exception IllegalArgumentException if the <code>valueType</code>
+ * is not valid or the <code>value</code> for the given legal
+ * <code>valueType</code> is outside the valid range
+ *
+ */
+
+ public DataElement(int valueType, long value) {
+ switch (valueType) {
+ case U_INT_1:
+ if (value < 0 || value > 0xff)
+ throw new IllegalArgumentException(value + " not U_INT_1");
+ break;
+ case U_INT_2:
+ if (value < 0 || value > 0xffff)
+ throw new IllegalArgumentException(value + " not U_INT_2");
+ break;
+ case U_INT_4:
+ if (value < 0 || value > 0xffffffffl)
+ throw new IllegalArgumentException(value + " not U_INT_4");
+ break;
+ case INT_1:
+ if (value < -0x80 || value > 0x7f)
+ throw new IllegalArgumentException(value + " not INT_1");
+ break;
+ case INT_2:
+ if (value < -0x8000 || value > 0x7fff)
+ throw new IllegalArgumentException(value + " not INT_2");
+ break;
+ case INT_4:
+ if (value < -0x80000000 || value > 0x7fffffff)
+ throw new IllegalArgumentException(value + " not INT_4");
+ break;
+ case INT_8:
+ break;
+ default:
+ throw new IllegalArgumentException();
+ }
+
+ this.value = new Long(value);
+ this.valueType = valueType;
+ }
+
+ /**
+ * Creates a <code>DataElement</code> whose data type is given by
+ * <code>valueType</code> and whose value is specified by the argument
+ * <code>value</code>. The legal values for the <code>valueType</code>
+ * and the corresponding attribute values are:
+ * <TABLE>
+ * <TR><TH>Value Type</TH><TH>Java Type / Value Range</TH></TR>
+ * <TR><TD><code>URL</code></TD><TD><code>java.lang.String</code>
+ * </TD></TR>
+ * <TR><TD><code>UUID</code></TD>
+ * <TD><code>javax.bluetooth.UUID</code></TD></TR>
+ * <TR><TD><code>STRING</code></TD>
+ * <TD><code>java.lang.String</code></TD></TR>
+ * <TR><TD><code>INT_16</code></TD>
+ * <TD>[-2<sup>127</sup>, 2<sup>127</sup>-1] as a byte array
+ * whose length must be 16</TD></TR>
+ * <TR><TD><code>U_INT_8</code></TD>
+ * <TD>[0, 2<sup>64</sup>-1] as a byte array whose length must
+ * be 8</TD></TR>
+ * <TR><TD><code>U_INT_16</code></TD>
+ * <TD>[0, 2<sup>128</sup>-1] as a byte array whose length must
+ * be 16</TD></TR>
+ * </TABLE>
+ * All other pairings are illegal and would cause an
+ * <code>IllegalArgumentException</code> exception.
+ *
+ * @see #URL
+ * @see #UUID
+ * @see #STRING
+ * @see #U_INT_8
+ * @see #INT_16
+ * @see #U_INT_16
+ *
+ * @param valueType the data type of the object that is being
+ * created; must be one of the following: <code>URL</code>,
+ * <code>UUID</code>,
+ * <code>STRING</code>,
+ * <code>INT_16</code>,
+ * <code>U_INT_8</code>, or
+ * <code>U_INT_16</code>
+ *
+ * @param value the value for the <code>DataElement</code> being created
+ * of type <code>valueType</code>
+ *
+ * @exception IllegalArgumentException if the <code>value</code>
+ * is not of the <code>valueType</code> type or is not in the range
+ * specified or is <code>null</code>
+ *
+ */
+
+ public DataElement(int valueType, Object value) {
+ if (value == null)
+ throw new IllegalArgumentException();
+
+ switch (valueType) {
+ case URL:
+ case STRING:
+ if (!(value instanceof String))
+ throw new IllegalArgumentException();
+ break;
+ case UUID:
+ if (!(value instanceof UUID))
+ throw new IllegalArgumentException();
+ break;
+ case U_INT_8:
+ if (!(value instanceof byte[]) || ((byte[]) value).length != 8)
+ throw new IllegalArgumentException();
+ break;
+ case U_INT_16:
+ case INT_16:
+ if (!(value instanceof byte[]) || ((byte[]) value).length != 16)
+ throw new IllegalArgumentException();
+ break;
+ default:
+ throw new IllegalArgumentException();
+ }
+
+ this.value = value;
+ this.valueType = valueType;
+ }
+
+ /**
+ * Adds a <code>DataElement</code> to this <code>DATALT</code>
+ * or <code>DATSEQ</code> <code>DataElement</code> object.
+ * The <code>elem</code> will be added at the end of the list.
+ * The <code>elem</code> can be of any
+ * <code>DataElement</code> type, i.e., <code>URL</code>,
+ * <code>NULL</code>, <code>BOOL</code>, <code>UUID</code>,
+ * <code>STRING</code>, <code>DATSEQ</code>, <code>DATALT</code>,
+ * and the various signed and unsigned integer types.
+ * The same object may be added twice. If the object is
+ * successfully added the size of the <code>DataElement</code> is
+ * increased by one.
+ *
+ * @param elem the <code>DataElement</code> object to add
+ *
+ * @exception ClassCastException if the method is invoked on a
+ * <code>DataElement</code> whose type is not <code>DATALT</code>
+ * or <code>DATSEQ</code>
+ *
+ * @exception NullPointerException if <code>elem</code> is
+ * <code>null</code>
+ *
+ */
+
+ public void addElement(DataElement elem) {
+ if (elem == null)
+ throw new NullPointerException();
+
+ switch (valueType) {
+ case DATALT:
+ case DATSEQ:
+ ((Vector) value).addElement(elem);
+ break;
+ default:
+ throw new ClassCastException();
+ }
+ }
+
+ /**
+ * Inserts a <code>DataElement</code> at the specified location.
+ * This method can be invoked only on a <code>DATALT</code> or
+ * <code>DATSEQ</code> <code>DataElement</code>.
+ * <code>elem</code> can be of any <code>DataElement</code>
+ * type, i.e., <code>URL</code>, <code>NULL</code>,
+ * <code>BOOL</code>,
+ * <code>UUID</code>, <code>STRING</code>, <code>DATSEQ</code>,
+ * <code>DATALT</code>, and the various signed and unsigned
+ * integers. The same object may be added twice. If the object is
+ * successfully added the size will be increased by one.
+ * Each element with an index greater than or equal to the specified
+ * index is shifted upward to have an index one
+ * greater than the value it had previously.
+ * <P>
+ * The <code>index</code> must be greater than or equal to 0 and
+ * less than or equal to the current size. Therefore,
+ * <code>DATALT</code> and
+ * <code>DATSEQ</code> are zero-based objects.
+ *
+ * @param elem the <code>DataElement</code> object to add
+ *
+ * @param index the location at which to add the
+ * <code>DataElement</code>
+ *
+ * @throws ClassCastException if the method is invoked on an
+ * instance of <code>DataElement</code> whose type is not
+ * <code>DATALT</code> or <code>DATSEQ</code>
+ *
+ * @throws IndexOutOfBoundsException if <code>index</code>
+ * is negative or greater than
+ * the size of the <code>DATALT</code> or <code>DATSEQ</code>
+ *
+ * @throws NullPointerException if <code>elem</code> is
+ * <code>null</code>
+ *
+ */
+
+ public void insertElementAt(DataElement elem, int index) {
+ if (elem == null)
+ throw new NullPointerException();
+
+ switch (valueType) {
+ case DATALT:
+ case DATSEQ:
+ ((Vector) value).insertElementAt(elem, index);
+ break;
+ default:
+ throw new ClassCastException();
+ }
+ }
+
+ /**
+ * Returns the number of <code>DataElements</code> that are present
+ * in this <code>DATALT</code> or <code>DATSEQ</code> object.
+ * It is possible that the number of elements is equal to zero.
+ *
+ * @return the number of elements in this <code>DATALT</code>
+ * or <code>DATSEQ</code>
+ *
+ * @throws ClassCastException if this object is not of type
+ * <code>DATALT</code> or <code>DATSEQ</code>
+ */
+
+ public int getSize() {
+ switch (valueType) {
+ case DATALT:
+ case DATSEQ:
+ return ((Vector) value).size();
+ default:
+ throw new ClassCastException();
+ }
+ }
+
+
+
+ /**
+ * Removes the first occurrence of the <code>DataElement</code>
+ * from this object. <code>elem</code> may be of any type, i.e.,
+ * <code>URL</code>, <code>NULL</code>, <code>BOOL</code>,
+ * <code>UUID</code>, <code>STRING</code>, <code>DATSEQ</code>,
+ * <code>DATALT</code>, or the variously sized signed and unsigned
+ * integers.
+ * Only the first object in the list that is equal to
+ * <code>elem</code> will be removed. Other objects, if present,
+ * are not removed. Since this class doesn't override the
+ * <code>equals()</code> method of the <code>Object</code> class,
+ * the remove method compares only the
+ * references of objects. If <code>elem</code> is
+ * successfully removed the size of this <code>DataElement</code>
+ * is decreased by one. Each <code>DataElement</code> in the
+ * <code>DATALT</code> or <code>DATSEQ</code> with an index greater
+ * than the index of <code>elem</code> is shifted downward to have
+ * an index one smaller than the value it had previously.
+ *
+ * @param elem the <code>DataElement</code> to be removed
+ *
+ * @return <code>true</code> if the input value was found and
+ * removed; else <code>false</code>
+ *
+ * @throws ClassCastException if this object is not of
+ * type <code>DATALT</code> or <code>DATSEQ</code>
+ *
+ * @throws NullPointerException if <code>elem</code> is
+ * <code>null</code>
+ */
+
+ public boolean removeElement(DataElement elem) {
+ if (elem == null)
+ throw new NullPointerException();
+
+ switch (valueType) {
+ case DATALT:
+ case DATSEQ:
+ return ((Vector) value).removeElement(elem);
+ default:
+ throw new ClassCastException();
+ }
+ }
+
+ /**
+ * Returns the data type of the object this <code>DataElement</code>
+ * represents.
+ *
+ * @return the data type of this <code>DataElement<code> object; the legal
+ * return values are:
+ * <code>URL</code>,
+ * <code>NULL</code>,
+ * <code>BOOL</code>,
+ * <code>UUID</code>,
+ * <code>STRING</code>,
+ * <code>DATSEQ</code>,
+ * <code>DATALT</code>,
+ * <code>U_INT_1</code>,
+ * <code>U_INT_2</code>,
+ * <code>U_INT_4</code>,
+ * <code>U_INT_8</code>,
+ * <code>U_INT_16</code>,
+ * <code>INT_1</code>,
+ * <code>INT_2</code>,
+ * <code>INT_4</code>,
+ * <code>INT_8</code>, or
+ * <code>INT_16</code>
+ *
+ */
+
+ public int getDataType() {
+ return valueType;
+ }
+
+
+
+ /**
+ * Returns the value of the <code>DataElement</code> if it can be
+ * represented as a <code>long</code>. The data type of the object must be
+ * <code>U_INT_1</code>,
+ * <code>U_INT_2</code>,
+ * <code>U_INT_4</code>,
+ * <code>INT_1</code>,
+ * <code>INT_2</code>,
+ * <code>INT_4</code>, or
+ * <code>INT_8</code>.
+ *
+ *
+ * @return the value of the <code>DataElement</code> as a <code>long</code>
+ *
+ * @throws ClassCastException if the data type of the object is not
+ * <code>U_INT_1</code>,
+ * <code>U_INT_2</code>,
+ * <code>U_INT_4</code>, <code>INT_1</code>,
+ * <code>INT_2</code>, <code>INT_4</code>,
+ * or <code>INT_8</code>
+ */
+
+ public long getLong() {
+ switch (valueType) {
+ case U_INT_1:
+ case U_INT_2:
+ case U_INT_4:
+ case INT_1:
+ case INT_2:
+ case INT_4:
+ case INT_8:
+ return ((Long) value).longValue();
+ default:
+ throw new ClassCastException();
+ }
+ }
+
+
+
+ /**
+ * Returns the value of the <code>DataElement</code> if it is represented as
+ * a <code>boolean</code>.
+ *
+ *
+ * @return the <code>boolean</code> value of this <code>DataElement</code>
+ * object
+ *
+ * @throws ClassCastException if the data type of this object is
+ * not of type <code>BOOL</code>
+ */
+
+ public boolean getBoolean() {
+ if (valueType == BOOL)
+ return ((Boolean) value).booleanValue();
+ else
+ throw new ClassCastException();
+ }
+
+ /**
+ * Returns the value of this <code>DataElement</code> as an
+ * <code>Object</code>. This method returns the appropriate Java
+ * object for the following data types:
+ * <code>URL</code>,
+ * <code>UUID</code>,
+ * <code>STRING</code>,
+ * <code>DATSEQ</code>,
+ * <code>DATALT</code>,
+ * <code>U_INT_8</code>,
+ * <code>U_INT_16</code>, and
+ * <code>INT_16</code>.
+ * Modifying the returned <code>Object</code> will not change this
+ * <code>DataElement</code>.
+ *
+ * The following are the legal pairs of data type
+ * and Java object type being returned.
+ * <TABLE>
+ * <TR><TH><code>DataElement</code> Data Type</code></TH>
+ * <TH>Java Data Type</TH></TR>
+ * <TR><TD><code>URL</code></TD><TD><code>java.lang.String</code>
+ * </TD></TR>
+ * <TR><TD><code>UUID</code></TD>
+ * <TD><code>javax.bluetooth.UUID</code></TD></TR>
+ * <TR><TD><code>STRING</code></TD><TD><code>java.lang.String
+ * </code></TD></TR>
+ * <TR><TD><code>DATSEQ</code></TD>
+ * <TD><code>java.util.Enumeration</code></TD></TR>
+ * <TR><TD><code>DATALT</code></TD>
+ * <TD><code>java.util.Enumeration</code></TD></TR>
+ * <TR><TD><code>U_INT_8</code></TD>
+ * <TD>byte[] of length 8</TD></TR>
+ * <TR><TD><code>U_INT_16</code></TD>
+ * <TD>byte[] of length 16</TD></TR>
+ * <TR><TD><code>INT_16</code></TD>
+ * <TD>byte[] of length 16</TD></TR>
+ * </TABLE>
+ *
+ * @return the value of this object
+ *
+ * @throws ClassCastException if the object is not a
+ * <code>URL</code>, <code>UUID</code>,
+ * <code>STRING</code>, <code>DATSEQ</code>, <code>DATALT</code>,
+ * <code>U_INT_8</code>,
+ * <code>U_INT_16</code>,
+ * or <code>INT_16</code>
+ *
+ */
+
+ public Object getValue() {
+ return null;
+ }
+
+}
Property changes on: iOSME/src/javax/bluetooth/DataElement.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: iOSME/src/javax/bluetooth/DeviceClass.java
===================================================================
--- iOSME/src/javax/bluetooth/DeviceClass.java (rev 0)
+++ iOSME/src/javax/bluetooth/DeviceClass.java 2021-06-28 13:56:58 UTC (rev 2486)
@@ -0,0 +1,112 @@
+/**
+ * Java docs licensed under the Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * (c) Copyright 2001, 2002 Motorola, Inc. ALL RIGHTS RESERVED.
+ *
+ *
+ * @version $Id: DeviceClass.java 1379 2007-10-13 02:00:43Z vlads $
+ */
+
+package javax.bluetooth;
+
+/**
+ * The <code>DeviceClass</code> class represents the class of device (CoD)
+ * record as defined by the Bluetooth specification. This record is defined in
+ * the Bluetooth Assigned Numbers document
+ * and contains information on the type of the device and the type of services
+ * available on the device.
+ * <P>
+ * The Bluetooth Assigned Numbers document
+ * (<A HREF="http://www.bluetooth.org/assigned-numbers/baseband.htm">
+ * http://www.bluetooth.org/assigned-numbers/baseband.htm</A>)
+ * defines the service class, major device class, and minor device class. The
+ * table below provides some examples of possible return values and their
+ * meaning:
+ * <TABLE>
+ * <TR><TH>Method</TH><TH>Return Value</TH><TH>Class of Device</TH></TR>
+ * <TR><TD><code>getServiceClasses()</code></TD>
+ * <TD>0x22000</TD>
+ * <TD>Networking and Limited Discoverable Major Service Classes</TD></TR>
+ * <TR><TD><code>getServiceClasses()</code></TD>
+ * <TD>0x100000</TD>
+ * <TD>Object Transfer Major Service Class</TD></TR>
+ * <TR><TD><code>getMajorDeviceClass()</code></TD>
+ * <TD>0x00</TD>
+ * <TD>Miscellaneous Major Device Class</TD></TR>
+ * <TR><TD><code>getMajorDeviceClass()</code></TD>
+ * <TD>0x200</TD>
+ * <TD>Phone Major Device Class</TD></TR>
+ * <TR><TD><code>getMinorDeviceClass()</code></TD>
+ * <TD>0x0C</TD><TD>With a Computer Major Device Class,
+ * Laptop Minor Device Class</TD></TR>
+ * <TR><TD><code>getMinorDeviceClass()</code></TD>
+ * <TD>0x04</TD><TD>With a Phone Major Device Class,
+ * Cellular Minor Device Class</TD></TR>
+ * </TABLE>
+ *
+ * @version 1.0 February 11, 2002
+ */
+
+public class DeviceClass {
+
+ private static final int SERVICE_MASK = 0xffe000;
+
+ private static final int MAJOR_MASK = 0x001f00;
+
+ private static final int MINOR_MASK = 0x0000fc;
+
+ private int record;
+
+ /**
+ * Creates a <code>DeviceClass</code> from the class of device record
+ * provided. <code>record</code> must follow the format of the
+ * class of device record in the Bluetooth specification.
+ *
+ * @param record describes the classes of a device
+ *
+ * @exception IllegalArgumentException if <code>record</code> has any bits
+ * between 24 and 31 set
+ */
+
+ public DeviceClass(int record) {
+
+ this.record = record;
+
+ if ((record & 0xff000000) != 0)
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Retrieves the major service classes. A device may have multiple major
+ * service classes. When this occurs, the major service classes are
+ * bitwise OR'ed together.
+ *
+ * @return the major service classes
+ */
+
+ public int getServiceClasses() {
+ return record & SERVICE_MASK;
+ }
+
+ /**
+ * Retrieves the major device class. A device may have only a single major
+ * device class.
+ *
+ * @return the major device class
+ */
+
+ public int getMajorDeviceClass() {
+ return record & MAJOR_MASK;
+ }
+
+ /**
+ * Retrieves the minor device class.
+ *
+ * @return the minor device class
+ */
+
+ public int getMinorDeviceClass() {
+ return record & MINOR_MASK;
+ }
+
+}
\ No newline at end of file
Property changes on: iOSME/src/javax/bluetooth/DeviceClass.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: iOSME/src/javax/bluetooth/DiscoveryAgent.java
===================================================================
--- iOSME/src/javax/bluetooth/DiscoveryAgent.java (rev 0)
+++ iOSME/src/javax/bluetooth/DiscoveryAgent.java 2021-06-28 13:56:58 UTC (rev 2486)
@@ -0,0 +1,356 @@
+/**
+ * Java docs licensed under the Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * (c) Copyright 2001, 2002 Motorola, Inc. ALL RIGHTS RESERVED.
+ *
+ *
+ * @version $Id: DiscoveryAgent.java 1379 2007-10-13 02:00:43Z vlads $
+ */
+
+package javax.bluetooth;
+
+/**
+ * The <code>DiscoveryAgent</code> class provides methods to perform
+ * device and service discovery. A local device must have only one
+ * <code>DiscoveryAgent</code> object. This object must be retrieved
+ * by a call to <code>getDiscoveryAgent()</code> on the
+ * <code>LocalDevice</code> object.
+ *
+ * <H3>Device Discovery</H3>
+ *
+ * There are two ways to discover devices. First, an application may
+ * use <code>startInquiry()</code> to start an inquiry to find devices
+ * in proximity to the local device. Discovered devices are returned
+ * via the <code>deviceDiscovered()</code> method of the interface
+ * <code>DiscoveryListener</code>. The second way to
+ * discover devices is via the <code>retrieveDevices()</code> method.
+ * This method will return devices that have been discovered via a
+ * previous inquiry or devices that are classified as pre-known.
+ * (Pre-known devices are those devices that are defined in the
+ * Bluetooth Control Center as devices this device frequently contacts.)
+ * The <code>retrieveDevices()</code> method does not perform an
+ * inquiry, but provides a quick way to get a list of devices that may
+ * be in the area.
+ *
+ * <H3>Service Discovery</H3>
+ * The <code>DiscoveryAgent</code> class also encapsulates the
+ * functionality provided by the service discovery application profile.
+ * The class provides an interface for an application to search and
+ * retrieve attributes for a particular service. There are two ways to
+ * search for services. To search for a service on a single device,
+ * the <code>searchServices()</code> method should be used. On the
+ * other hand, if you don't care which device a service is on, the
+ * <code>selectService()</code> method does a service search on a
+ * set of remote devices.
+ *
+ *
+ * @version 1.0 February 11, 2002
+ *
+ */
+public class DiscoveryAgent {
+
+ /**
+ * Takes the device out of discoverable mode.
+ * <P>
+ * The value of <code>NOT_DISCOVERABLE</code> is 0x00 (0).
+ */
+ public static final int NOT_DISCOVERABLE = 0;
+
+ /**
+ * The inquiry access code for General/Unlimited Inquiry Access Code
+ * (GIAC). This is used to specify the type of inquiry to complete or
+ * respond to.
+ * <P>
+ * The value of <code>GIAC</code> is 0x9E8B33 (10390323). This value
+ * is defined in the Bluetooth Assigned Numbers document.
+ */
+ public static final int GIAC = 0x9E8B33;
+
+ /**
+ * The inquiry access code for Limited Dedicated Inquiry Access Code
+ * (LIAC). This is used to specify the type of inquiry to complete or
+ * respond to.
+ * <P>
+ * The value of <code>LIAC</code> is 0x9E8B00 (10390272). This value
+ * is defined in the Bluetooth Assigned Numbers document.
+ */
+ public static final int LIAC = 0x9E8B00;
+
+ /**
+ * Used with the <code>retrieveDevices()</code> method to return
+ * those devices that were found via a previous inquiry. If no
+ * inquiries have been started, this will cause the method to return
+ * <code>null</code>.
+ * <P>
+ * The value of <code>CACHED</code> is 0x00 (0).
+ *
+ * @see #retrieveDevices
+ */
+ public static final int CACHED = 0x00;
+
+ /**
+ * Used with the <code>retrieveDevices()</code> method to return
+ * those devices that are defined to be pre-known devices. Pre-known
+ * devices are specified in the BCC. These are devices that are
+ * specified by the user as devices with which the local device will
+ * frequently communicate.
+ * <P>
+ * The value of <code>PREKNOWN</code> is 0x01 (1).
+ *
+ * @see #retrieveDevices
+ */
+ public static final int PREKNOWN = 0x01;
+
+ /**
+ * Creates a <code>DiscoveryAgent</code> object.
+ */
+ DiscoveryAgent() {
+ }
+
+ /**
+ * Returns an array of Bluetooth devices that have either been found
+ * by the local device during previous inquiry requests or been
+ * specified as a pre-known device depending on the argument. The list
+ * of previously found devices is maintained by the implementation of
+ * this API. (In other words, maintenance of the list of previously
+ * found devices is an implementation detail.) A device can be set as
+ * a pre-known device in the Bluetooth Control Center.
+ *
+ * @param option <code>CACHED</code> if previously found devices
+ * should be returned; <code>PREKNOWN</code> if pre-known devices
+ * should be returned
+ *
+ * @return an array containing the Bluetooth devices that were
+ * previously found if <code>option</code> is <code>CACHED</code>;
+ * an array of devices that are pre-known devices if
+ * <code>option</code> is <code>PREKNOWN</code>; <code>null</code>
+ * if no devices meet the criteria
+ *
+ * @exception IllegalArgumentException if <code>option</code> is
+ * not <code>CACHED</code> or <code>PREKNOWN</code>
+ */
+ public RemoteDevice[] retrieveDevices(int option) {
+ return null;
+ }
+
+ /**
+ * Places the device into inquiry mode. The length of the inquiry is
+ * implementation dependent. This method will search for devices with the
+ * specified inquiry access code. Devices that responded to the inquiry
+ * are returned to the application via the method
+ * <code>deviceDiscovered()</code> of the interface
+ * <code>DiscoveryListener</code>. The <code>cancelInquiry()</code>
+ * method is called to stop the inquiry.
+ *
+ * @see #cancelInquiry
+ * @see #GIAC
+ * @see #LIAC
+ *
+ * @param accessCode the type of inquiry to complete
+ *
+ * @param listener the event listener that will receive device
+ * discovery events
+ *
+ * @return <code>true</code> if the inquiry was started;
+ * <code>false</code> if the inquiry was not started because the
+ * <code>accessCode</code> is not supported
+ *
+ * @exception IllegalArgumentException if the access code provided
+ * is not <code>LIAC</code>, <code>GIAC</code>, or in the range
+ * 0x9E8B00 to 0x9E8B3F
+ *
+ * @exception NullPointerException if <code>listener</code> is
+ * <code>null</code>
+ *
+ * @exception BluetoothStateException if the Bluetooth device does
+ * not allow an inquiry to be started due to other operations that are being
+ * performed by the device
+ */
+ public boolean startInquiry(int accessCode, DiscoveryListener listener) throws BluetoothStateException {
+ if (listener == null) {
+ throw new NullPointerException("DiscoveryListener is null");
+ }
+ if ((accessCode != LIAC) && (accessCode != GIAC) && ((accessCode < 0x9E8B00) || (accessCode > 0x9E8B3F))) {
+ throw new IllegalArgumentException("Invalid accessCode " + accessCode);
+ }
+
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Removes the device from inquiry mode.
+ * <P>
+ * An <code>inquiryCompleted()</code> event will occur with a type of
+ * <code>INQUIRY_TERMINATED</code> as a result of calling this
+ * method. After receiving this
+ * event, no further <code>deviceDiscovered()</code> events will occur
+ * as a result of this inquiry.
+ *
+ * <P>
+ *
+ * This method will only cancel the inquiry if the
+ * <code>listener</code> provided is the listener that started
+ * the inquiry.
+ *
+ * @param listener the listener that is receiving inquiry events
+ *
+ * @return <code>true</code> if the inquiry was canceled; otherwise
+ * <code>false</code> if the inquiry was not canceled or if the inquiry
+ * was not started using <code>listener</code>
+ *
+ * @exception NullPointerException if <code>listener</code> is
+ * <code>null</code>
+ */
+ public boolean cancelInquiry(DiscoveryListener listener) {
+ if (listener == null) {
+ throw new NullPointerException("DiscoveryListener is null");
+ }
+ return false;
+ }
+
+ /**
+ * Searches for services on a remote Bluetooth device that have all the
+ * UUIDs specified in <code>uuidSet</code>. Once the service is found,
+ * the attributes specified in <code>attrSet</code> and the default
+ * attributes are retrieved. The default attributes are
+ * ServiceRecordHandle (0x0000), ServiceClassIDList
+ * (0x0001), ServiceRecordState (0x0002), ServiceID (0x0003), and
+ * ProtocolDescriptorList (0x0004).If <code>attrSet</code> is
+ * <code>null</code> then only the default attributes will be retrieved.
+ * <code>attrSet</code> does not have to be sorted in increasing order,
+ * but must only contain values in the range [0 - (2<sup>16</sup>-1)].
+ *
+ * @see DiscoveryListener
+ *
+ * @param attrSet indicates the attributes whose values will be
+ * retrieved on services which have the UUIDs specified in
+ * <code>uuidSet</code>
+ *
+ * @param uuidSet the set of UUIDs that are being searched for; all
+ * services returned will contain all the UUIDs specified here
+ *
+ * @param btDev the remote Bluetooth device to search for services on
+ *
+ * @param discListener the object that will receive events when
+ * services are discovered
+ *
+ * @return the transaction ID of the service search; this number
+ * must be positive
+ *
+ * @exception BluetoothStateException if the number of concurrent
+ * service search transactions exceeds the limit specified by the
+ * <code>bluetooth.sd.trans.max</code> property obtained from the
+ * class <code>LocalDevice</code> or the system is unable to start
+ * one due to current conditions
+ *
+ * @exception IllegalArgumentException if <code>attrSet</code> has
+ * an illegal service attribute ID or exceeds the property
+ * <code>bluetooth.sd.attr.retrievable.max</code>
+ * defined in the class <code>LocalDevice</code>; if
+ * <code>attrSet</code>
+ * or <code>uuidSet</code> is of length 0; if <code>attrSet</code>
+ * or <code>uuidSet</code> contains duplicates
+ *
+ * @exception NullPointerException if <code>uuidSet</code>,
+ * <code>btDev</code>, or <code>discListener</code> is
+ * <code>null</code>; if an element in <code>uuidSet</code> array is
+ * <code>null</code>
+ *
+ */
+ public int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev, DiscoveryListener discListener)
+ throws BluetoothStateException {
+ if (uuidSet == null) {
+ throw new NullPointerException("uuidSet is null");
+ }
+ if (uuidSet.length == 0) {
+ // The same as on Motorola, Nokia and SE Phones
+ throw new IllegalArgumentException("uuidSet is empty");
+ }
+ for (int u1 = 0; u1 < uuidSet.length; u1++) {
+ for (int u2 = u1 + 1; u2 < uuidSet.length; u2++) {
+ if (uuidSet[u1].equals(uuidSet[u2])) {
+ throw new IllegalArgumentException("uuidSet has duplicate values " + uuidSet[u1].toString());
+ }
+ }
+ }
+ if (btDev == null) {
+ throw new NullPointerException("RemoteDevice is null");
+ }
+ if (discListener == null) {
+ throw new NullPointerException("DiscoveryListener is null");
+ }
+ for (int i = 0; attrSet != null && i < attrSet.length; i++) {
+ if (attrSet[i] < 0x0000 || attrSet[i] > 0xffff) {
+ throw new IllegalArgumentException("attrSet[" + i + "] not in range");
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Cancels the service search transaction that has the specified
+ * transaction ID. The ID was assigned to the transaction by the
+ * method <code>searchServices()</code>. A
+ * <code>serviceSearchCompleted()</code> event with a discovery type
+ * of <code>SERVICE_SEARCH_TERMINATED</code> will occur when
+ * this method is called. After receiving this event, no further
+ * <code>servicesDiscovered()</code> events will occur as a result
+ * of this search.
+ *
+ * @param transID the ID of the service search transaction to
+ * cancel; returned by <code>searchServices()</code>
+ *
+ * @return <code>true</code> if the service search transaction is
+ * terminated, else <code>false</code> if the <code>transID</code>
+ * does not represent an active service search transaction
+ */
+ public boolean cancelServiceSearch(int transID) {
+ return false;
+ }
+
+ /**
+ * Attempts to locate a service that contains <code>uuid</code> in
+ * the ServiceClassIDList of its service record. This
+ * method will return a string that may be used in
+ * <code>Connector.open()</code> to establish a connection to the
+ * service. How the service is selected if there are multiple services
+ * with <code>uuid</code> and which devices to
+ * search is implementation dependent.
+ *
+ * @see ServiceRecord#NOAUTHENTICATE_NOENCRYPT
+ * @see ServiceRecord#AUTHENTICATE_NOENCRYPT
+ * @see ServiceRecord#AUTHENTICATE_ENCRYPT
+ *
+ * @param uuid the UUID to search for in the ServiceClassIDList
+ *
+ * @param security specifies the security requirements for a connection
+ * to this service; must be one of
+ * <code>ServiceRecord.NOAUTHENTICATE_NOENCRYPT</code>,
+ * <code>ServiceRecord.AUTHENTICATE_NOENCRYPT</code>, or
+ * <code>ServiceRecord.AUTHENTICATE_ENCRYPT</code>
+ *
+ * @param master determines if this client must be the master of the
+ * connection; <code>true</code> if the client must be the master;
+ * <code>false</code> if the client can be the master or the slave
+ *
+ * @return the connection string used to connect to the service
+ * with a UUID of <code>uuid</code>; or <code>null</code> if no
+ * service could be found with a UUID of <code>uuid</code> in the
+ * ServiceClassIDList
+ *
+ * @exception BluetoothStateException if the Bluetooth system cannot
+ * start the request due to the current state of the Bluetooth system
+ *
+ * @exception NullPointerException if <code>uuid</code> is
+ * <code>null</code>
+ *
+ * @exception IllegalArgumentException if <code>security</code> is
+ * not <code>ServiceRecord.NOAUTHENTICATE_NOENCRYPT</code>,
+ * <code>ServiceRecord.AUTHENTICATE_NOENCRYPT</code>, or
+ * <code>ServiceRecord.AUTHENTICATE_ENCRYPT</code>
+ */
+ public String selectService(UUID uuid, int security, boolean master) throws BluetoothStateException {
+ return null;
+ }
+
+}
\ No newline at end of file
Property changes on: iOSME/src/javax/bluetooth/DiscoveryAgent.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: iOSME/src/javax/bluetooth/DiscoveryListener.java
===================================================================
--- iOSME/src/javax/bluetooth/DiscoveryListener.java (rev 0)
+++ iOSME/src/javax/bluetooth/DiscoveryListener.java 2021-06-28 13:56:58 UTC (rev 2486)
@@ -0,0 +1,203 @@
+/**
+ * Java docs licensed under the Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * (c) Copyright 2001, 2002 Motorola, Inc. ALL RIGHTS RESERVED.
+ *
+ *
+ * @version $Id: DiscoveryListener.java 1379 2007-10-13 02:00:43Z vlads $
+ */
+
+package javax.bluetooth;
+
+/**
+ * The <code>DiscoveryListener</code> interface allows an application to
+ * receive device discovery and service discovery events. This interface
+ * provides four methods, two for discovering devices and two for discovering
+ * services.
+ *
+ * @version 1.0 February 11, 2002
+ *
+ * @since 1.1 The JSR 82 specification does not require that implementations
+ * create individual threads for event delivery. Thus, if a
+ * DiscoveryListener method does not return or the return is delayed, the
+ * system may be blocked. So the following note is given for application
+ * developers :
+ * <p>
+ *
+ * The following DiscoveryListener methods SHOULD return immediately :
+ * <ul>
+ * <li>DiscoveryListener.deviceDiscovered</li>
+ * <li>DiscoveryListener.inquiryCompleted</li>
+ * <li>DiscoveryListener.servicesDiscovered</li>
+ * <li>DiscoveryListener.serviceSearchCompleted</li>
+ * </ul>
+ *
+ */
+public interface DiscoveryListener {
+
+ /**
+ * Indicates the normal completion of device discovery. Used with the
+ * {@link #inquiryCompleted(int)} method.
+ * <p>
+ * The value of INQUIRY_COMPLETED is 0x00 (0).
+ *
+ * @see #inquiryCompleted(int)
+ * @see DiscoveryAgent#startInquiry(int, javax.bluetooth.DiscoveryListener)
+ */
+ public static final int INQUIRY_COMPLETED = 0x00;
+
+ /**
+ * Indicates device discovery has been canceled by the application and did
+ * not complete. Used with the {@link #inquiryCompleted(int)} method.
+ * <p>
+ * The value of INQUIRY_TERMINATED is 0x05 (5).
+ *
+ * @see #inquiryCompleted(int)
+ * @see DiscoveryAgent#startInquiry(int, javax.bluetooth.DiscoveryListener)
+ * @see DiscoveryAgent#cancelInquiry(javax.bluetooth.DiscoveryListener)
+ */
+ public static final int INQUIRY_TERMINATED = 0x05;
+
+ /**
+ * Indicates that the inquiry request failed to complete normally, but was
+ * not cancelled.
+ * <p>
+ * The value of INQUIRY_ERROR is 0x07 (7).
+ *
+ * @see #inquiryCompleted(int)
+ * @see DiscoveryAgent#startInquiry(int, javax.bluetooth.DiscoveryListener)
+ */
+ public static final int INQUIRY_ERROR = 0x07;
+
+ /**
+ * Indicates the normal completion of service discovery. Used with the
+ * {@link #serviceSearchCompleted(int, int)} method.
+ * <p>
+ * The value of SERVICE_SEARCH_COMPLETED is 0x01 (1).
+ *
+ * @see #serviceSearchCompleted(int, int)
+ * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[],
+ * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener)
+ */
+ public static final int SERVICE_SEARCH_COMPLETED = 0x01;
+
+ /**
+ * Indicates the service search has been canceled by the application and did
+ * not complete. Used with the {@link #serviceSearchCompleted(int, int)} method.
+ * <p>
+ * The value of SERVICE_SEARCH_TERMINATED is 0x02 (2).
+ *
+ * @see #serviceSearchCompleted(int, int)
+ * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[],
+ * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener)
+ * @see DiscoveryAgent#cancelServiceSearch(int)
+ */
+ public static final int SERVICE_SEARCH_TERMINATED = 0x02;
+
+ /**
+ * Indicates the service search terminated with an error. Used with the
+ * {@link #serviceSearchCompleted(int, int)} method.
+ * <p>
+ * The value of SERVICE_SEARCH_ERROR is 0x03 (3).
+ *
+ * @see #serviceSearchCompleted(int, int)
+ * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[],
+ * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener)
+ */
+ public static final int SERVICE_SEARCH_ERROR = 0x03;
+
+ /**
+ * Indicates the service search has completed with no service records found
+ * on the device. Used with the {@link #serviceSearchCompleted(int, int)} method.
+ * <p>
+ * The value of SERVICE_SEARCH_NO_RECORDS is 0x04 (4).
+ *
+ * @see #serviceSearchCompleted(int, int)
+ * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[],
+ * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener)
+ */
+ public static final int SERVICE_SEARCH_NO_RECORDS = 0x04;
+
+ /**
+ * Indicates the service search could not be completed because the remote
+ * device provided to {@link DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[],
+ * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener)
+ * DiscoveryAgent.searchServices()} could not be reached.
+ * Used with the {@link #serviceSearchCompleted(int, int)} method.
+ * <P>
+ * The value of SERVICE_SEARCH_DEVICE_NOT_REACHABLE is 0x06 (6).
+ *
+ * @see #serviceSearchCompleted(int, int)
+ * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[],
+ * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener)
+ */
+ public static final int SERVICE_SEARCH_DEVICE_NOT_REACHABLE = 0x06;
+
+ /**
+ * Called when a device is found during an inquiry. An inquiry searches for
+ * devices that are discoverable. The same device may be returned multiple
+ * times.
+ *
+ * @param btDevice the device that was found during the inquiry
+ * @param cod - the service classes, major device class, and minor device
+ * class of the remote device
+ * @see DiscoveryAgent#startInquiry(int, javax.bluetooth.DiscoveryListener)
+ */
+ public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod);
+
+ /**
+ * Called when service(s) are found during a service search.
+ *
+ * @param transID the transaction ID of the service search that is posting the
+ * result
+ * @param servRecord a list of services found during the search request
+ * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[],
+ * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener)
+ */
+ public void servicesDiscovered(int transID, ServiceRecord[] servRecord);
+
+ /**
+ * Called when a service search is completed or was terminated because of an
+ * error. Legal status values in the {@code respCode} argument include
+ * {@link #SERVICE_SEARCH_COMPLETED}, {@link #SERVICE_SEARCH_TERMINATED},
+ * {@link #SERVICE_SEARCH_ERROR}, {@link #SERVICE_SEARCH_NO_RECORDS} and
+ * {@link #SERVICE_SEARCH_DEVICE_NOT_REACHABLE}. The following table describes when
+ * each {@code respCode} will be used:
+ * <table><tr><th>respCode</th><th>Reason</th></tr>
+ * <tr><td>{@link #SERVICE_SEARCH_COMPLETED}</td>
+ * <td>if the service search completed normally</td></tr>
+ * <tr><td>{@link #SERVICE_SEARCH_TERMINATED}</td>
+ * <td>if the service search request was cancelled by a call to
+ * {@link DiscoveryAgent#cancelServiceSearch(int)}</td></tr>
+ * <tr><td>{@link #SERVICE_SEARCH_ERROR}</td>
+ * <td>if an error occurred while processing the request</td></tr>
+ * <tr><td>{@link #SERVICE_SEARCH_NO_RECORDS}</td>
+ * <td>if no records were found during the service search</td></tr>
+ * <tr><td>{@link #SERVICE_SEARCH_DEVICE_NOT_REACHABLE}</td>
+ * <td>if the device specified in the search request could not be reached or
+ * the local device could not establish a connection to the remote device
+ * </td></tr></table>
+ *
+ * @param transID the transaction ID identifying the request which
+ * initiated the service search
+ * @param respCode the response code that indicates the status of the transaction
+ */
+ public void serviceSearchCompleted(int transID, int respCode);
+
+ /**
+ * Called when an inquiry is completed. The {@code discType} will be
+ * {@link #INQUIRY_COMPLETED} if the inquiry ended normally or {@link #INQUIRY_TERMINATED}
+ * if the inquiry was canceled by a call to
+ * {@link DiscoveryAgent#cancelInquiry(DiscoveryListener)}. The {@code discType} will be
+ * {@link #INQUIRY_ERROR} if an error occurred while processing the inquiry causing the
+ * inquiry to end abnormally.
+ *
+ * @param discType the type of request that was completed; either
+ * {@link #INQUIRY_COMPLETED}, {@link #INQUIRY_TERMINATED},
+ * or {@link #INQUIRY_ERROR}
+ * @see #INQUIRY_COMPLETED
+ * @see #INQUIRY_TERMINATED
+ * @see #INQUIRY_ERROR
+ */
+ public void inquiryCompleted(int discType);
+}
Property changes on: iOSME/src/javax/bluetooth/DiscoveryListener.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: iOSME/src/javax/bluetooth/L2CAPConnection.java
===================================================================
--- iOSME/src/javax/bluetooth/L2CAPConnection.java (rev 0)
+++ iOSME/src/javax/bluetooth/L2CAPConnection.java 2021-06-28 13:56:58 UTC (rev 2486)
@@ -0,0 +1,149 @@
+/**
+ * Java docs licensed under the Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * (c) Copyright 2001, 2002 Motorola, Inc. ALL RIGHTS RESERVED.
+ *
+ *
+ * @version $Id: L2CAPConnection.java 1379 2007-10-13 02:00:43Z vlads $
+ */
+
+package javax.bluetooth;
+
+import java.io.IOException;
+
+import javax.microedition.io.Connection;
+
+/**
+ * The <code>L2CAPConnection</code> interface represents a
+ * connection-oriented L2CAP channel. This interface is to be
+ * used as part of the CLDC Generic Connection Framework.
+ * <P>
+ * To create a client connection, the protocol is <code>btl2cap</code>.
+ * The target is the combination of the address
+ * of the Bluetooth device to connect to and the Protocol
+ * Service Multiplexor (PSM) of the service.
+ * The PSM value is used by the
+ * L2CAP to determine which higher level ...
[truncated message content] |