private static final Method _createRfcommSocket = getMethod(BluetoothDevice.class, "createRfcommSocket", new Class[] { int.class }); private static final Method _createInsecureRfcommSocket = getMethod(BluetoothDevice.class, "createInsecureRfcommSocket", new Class[] { int.class }); private static final Method _setPin = getMethod(BluetoothDevice.class, "setPin", new Class[] { byte[].class }); private static final Method _setPasskey = getMethod(BluetoothDevice.class, "setPasskey", new Class[] { int.class }); private static final Constructor<?> _socketConstructor = getConstructor(BluetoothSocket.class, new Class[] {int.class, int.class, boolean.class, boolean.class, BluetoothDevice.class, int.class, ParcelUuid.class});
public ImprovedBluetoothDevice(BluetoothDevice base) { if (base == null) throw new NullPointerException();
mDevice = base; }毕业论文
public BluetoothSocket createRfcommSocketToServiceRecord(UUID uuid) throws IOException { return mDevice.createRfcommSocketToServiceRecord(uuid); }
public int describeContents() { return mDevice.describeContents(); }
public String getAddress() { return mDevice.getAddress(); }
public BluetoothClass getBluetoothClass() { return mDevice.getBluetoothClass(); }
public int getBondState() { return mDevice.getBondState(); }
public String getName() { return mDevice.getName(); }
public String toString() { return mDevice.toString(); }
public void writeToParcel(Parcel out, int flags) { mDevice.writeToParcel(out, flags); }
public BluetoothSocket createRfcommSocket(int channel) throws Exception { if (_createRfcommSocket == null) throw new NoSuchMethodException("createRfcommSocket"); try { return (BluetoothSocket)_createRfcommSocket.invoke(mDevice, channel); } catch (InvocationTargetException tex) { if (tex.getCause() instanceof Exception) throw (Exception)tex.getCause(); else throw tex; } }
public BluetoothSocket createInsecureRfcommSocket(int channel) throws Exception { if (_createInsecureRfcommSocket == null) throw new NoSuchMethodException("createInsecureRfcommSocket");
try { return (BluetoothSocket)_createInsecureRfcommSocket.invoke(mDevice, channel); } catch (InvocationTargetException tex) { if (tex.getCause() instanceof Exception) throw (Exception)tex.getCause(); else throw tex; } }
public BluetoothSocket createLCAPSocket(int channel) throws Exception { if (_socketConstructor == null) throw new NoSuchMethodException("new BluetoothSocket");
try { return (BluetoothSocket)_socketConstructor.newInstance(TYPE_L2CAP, -1, true, true, mDevice, channel, null); } catch (InvocationTargetException tex) { if (tex.getCause() instanceof Exception) throw (Exception)tex.getCause(); else thro 上一页 [1] [2] [3] [4] [5] [6] 下一页
|