public void l2CloseClientConnection(long handle) throws IOException { assertClosed(); EmulatorL2CAPClient c = ((EmulatorL2CAPClient) localDevice.getConnection(handle)); try { c.close(); } finally { localDevice.removeConnection(c); } }
public void l2ServerClose(long handle, ServiceRecordImpl serviceRecord) throws IOException { assertClosed(); EmulatorL2CAPService s = ((EmulatorL2CAPService) localDevice.getConnection(handle)); try { s.close(serviceRecord); } finally { localDevice.removeConnection(s); } }
public void connectionRfCloseClientConnection(long handle) throws IOException { assertClosed(); if (localDevice == null) { return; } EmulatorRFCOMMClient c = ((EmulatorRFCOMMClient) localDevice.getConnection(handle)); try { c.close(); } finally { if (localDevice != null) { localDevice.removeConnection(c); } } }
public long l2ServerAcceptAndOpenServerConnection(long handle) throws IOException { EmulatorL2CAPService s = ((EmulatorL2CAPService) activeLocalDevice().getConnection(handle)); if (!localDevice.isConnectable()) { throw new BluetoothStateException("Local device is not connectable"); } long clientHandle = 0; boolean success = false; while (!success) { long connectionHandle = s.accept(); try { long remoteAddress = localDevice .getDeviceManagerService() .getRemoteAddress(localDevice.getAddress(), connectionHandle); EmulatorL2CAPClient c = localDevice.createL2CAPClient(remoteAddress); c.connect(remoteAddress, connectionHandle, s.getReceiveMTU(), s.getTransmitMTU()); localDevice .getDeviceManagerService() .connectionAccepted(localDevice.getAddress(), connectionHandle); success = true; clientHandle = c.getHandle(); } catch (IOException e) { DebugLog.debug("fail to accept connection", e); continue; } finally { if (!success) { localDevice .getDeviceManagerService() .closeConnection(localDevice.getAddress(), connectionHandle); } } } return clientHandle; }
public void rfServerClose(long handle, ServiceRecordImpl serviceRecord) throws IOException { assertClosed(); if (localDevice == null) { return; } EmulatorRFCOMMService s = ((EmulatorRFCOMMService) localDevice.getConnection(handle)); try { s.close(serviceRecord); } finally { if (localDevice != null) { localDevice.removeConnection(s); } } }
private EmulatorLocalDevice activeLocalDevice() throws BluetoothStateException { assertClosed(); if (!localDevice.isActive()) { throw new BluetoothStateException("Bluetooth system is off"); } return localDevice; }
public String toString() { if (localDevice != null) { return getStackID() + ":" + RemoteDeviceHelper.getBluetoothAddress(localDevice.getAddress()); } else { return getStackID(); } }
public boolean populateServicesRecordAttributeValues( ServiceRecordImpl serviceRecord, int[] attrIDs) throws IOException { if (attrIDs.length > localDevice.getBluetooth_sd_attr_retrievable_max()) { throw new IllegalArgumentException(); } return EmulatorSearchServices.populateServicesRecordAttributeValues( activeLocalDevice(), serviceRecord, attrIDs, RemoteDeviceHelper.getAddress(serviceRecord.getHostDevice()), serviceRecord.getHandle()); }
public long connectionRfOpenClientConnection(BluetoothConnectionParams params) throws IOException { EmulatorRFCOMMClient c = activeLocalDevice().createRFCOMMClient(params.address); boolean success = false; try { c.connect(params); success = true; } finally { if (!success) { localDevice.removeConnection(c); } } return c.getHandle(); }
public long l2OpenClientConnection( BluetoothConnectionParams params, int receiveMTU, int transmitMTU) throws IOException { validateMTU(receiveMTU, transmitMTU); EmulatorL2CAPClient c = activeLocalDevice().createL2CAPClient(params.address); boolean success = false; try { c.connect(params, receiveMTU, transmitMTU); success = true; } finally { if (!success) { localDevice.removeConnection(c); } } return c.getHandle(); }
public long rfServerOpen( BluetoothConnectionNotifierParams params, ServiceRecordImpl serviceRecord) throws IOException { EmulatorRFCOMMService s = activeLocalDevice().createRFCOMMService(); boolean success = false; try { s.open(params); serviceRecord.setHandle(s.getHandle()); serviceRecord.populateRFCOMMAttributes( s.getHandle(), s.getChannel(), params.uuid, params.name, params.obex); s.updateServiceRecord(serviceRecord); success = true; } finally { if (!success) { localDevice.removeConnection(s); } } return s.getHandle(); }
public long l2ServerOpen( BluetoothConnectionNotifierParams params, int receiveMTU, int transmitMTU, ServiceRecordImpl serviceRecord) throws IOException { validateMTU(receiveMTU, transmitMTU); EmulatorL2CAPService s = activeLocalDevice().createL2CAPService(params.bluecove_ext_psm); boolean success = false; try { s.open(params, receiveMTU, transmitMTU); serviceRecord.setHandle(s.getHandle()); serviceRecord.populateL2CAPAttributes( (int) s.getHandle(), s.getPcm(), params.uuid, params.name); s.updateServiceRecord(serviceRecord); success = true; } finally { if (!success) { localDevice.removeConnection(s); } } return s.getHandle(); }
public boolean isLocalDevicePowerOn() { assertClosed(); return localDevice.isLocalDevicePowerOn(); }
public int getLocalDeviceDiscoverable() { assertClosed(); return localDevice.getLocalDeviceDiscoverable(); }
public boolean setLocalDeviceDiscoverable(int mode) throws BluetoothStateException { assertClosed(); return localDevice.setLocalDeviceDiscoverable(mode); }
public String getLocalDeviceName() { assertClosed(); return localDevice.getName(); }
/* * (non-Javadoc) * * @see com.intel.bluetooth.BluetoothStack#setLocalDeviceServiceClasses(int) */ public void setLocalDeviceServiceClasses(int classOfDevice) { assertClosed(); localDevice.setLocalDeviceServiceClasses(classOfDevice); }
private void validateMTU(int receiveMTU, int transmitMTU) { if (receiveMTU > localDevice.getBluetooth_l2cap_receiveMTU_max()) { throw new IllegalArgumentException("invalid ReceiveMTU value " + receiveMTU); } }
public int l2GetSecurityOpt(long handle, int expected) throws IOException { assertClosed(); return ((EmulatorLinkedConnection) localDevice.getConnection(handle)).getSecurityOpt(expected); }
public String getLocalDeviceProperty(String property) { assertClosed(); return localDevice.getLocalDeviceProperty(property); }
public DeviceClass getLocalDeviceClass() { assertClosed(); return new DeviceClass(localDevice.getDeviceClass()); }
/* * (non-Javadoc) * * @see com.intel.bluetooth.BluetoothStack#l2Encrypt(long,long,boolean) */ public boolean l2Encrypt(long address, long handle, boolean on) throws IOException { assertClosed(); return ((EmulatorLinkedConnection) localDevice.getConnection(handle)).encrypt(address, on); }
public String getLocalDeviceBluetoothAddress() throws BluetoothStateException { assertClosed(); return RemoteDeviceHelper.getBluetoothAddress(localDevice.getAddress()); }