Waits for a client to connect to this L2CAP service. Upon connection returns an
L2CAPConnection
that can be used to communicate with this client.
A service record associated with this connection will be added to the SDDB associated with this L2CAPConnectionNotifier
object if one does not exist in the SDDB. This method will put the local device in connectable mode so that it may respond to connection attempts by clients.
The following checks are done to verify that any modifications made by the application to the service record after it was created by Connector.open()
have not created an invalid service record. If any of these checks fail, then a ServiceRegistrationException
is thrown.
- ServiceClassIDList and ProtocolDescriptorList, the mandatory service attributes for a
btl2cap
service record, must be present in the service record. - L2CAP must be in the ProtocolDescriptorList.
- The PSM value must not have changed in the service record.
This method will not ensure that the service record created is a completely valid service record. It is the responsibility of the application to ensure that the service record follows all of the applicable syntactic and semantic rules for service record correctness.
@return a connection to communicate with the client
@exception IOException if the notifier is closed before acceptAndOpen()
is called
@exception ServiceRegistrationException if the structure of theassociated service record is invalid or if the service record could not be added successfully to the local SDDB. The structure of service record is invalid if the service record is missing any mandatory service attributes, or has changed any of the values described above which are fixed and cannot be changed. Failures to add the record to the SDDB could be due to insufficient disk space, database locks, etc.
@exception BluetoothStateException if the server device couldnot be placed in connectable mode because the device user has configured the device to be non-connectable.