Get the RFCOMM channel number of the established connection or the registered service.


#include <btapi/btspp.h>
int bt_spp_get_service_port(int fd, char *service_uuid, int *service_port)


BlackBerry 10.3.0



The mount point file descriptor returned by bt_spp_open(), or through a callback registered with bt_spp_open_server(), or through an asynchronous call of bt_spp_open_ex(). If you wish to retrieve the RFCOMM channel number for a registered server when a connection is not yet established, pass in -1. The service_uuid parameter is ignored if a valid fd is passed in.


The UUID of the service registered on the server side. When the service is registered but a connection is not established yet, the RFCOMM channel number is already known on the server side and can be retrieved. To use this option, you have to pass in -1 for fd and a valid service_uuid.


The pointer to a user-allocated integer for RFCOMM channel number that the function returns.


libbtapi (For the qcc command, use the -l btapi option to link against this library)


This function returns the RFCOMM channel number either of the established connection identified by the file descriptor or of the registered service identified by the service UUID.


0 if the RFCOMM channel number is returned, -1 otherwise, with errno set to one of the following values:
  • EINVAL: service_port is NULL.
  • EPERM: The bt_spp_init() function has not been called or has failed.
  • EBADF: The file descriptor is invalid.
  • ENODEV: No service with this UUID is found.

Last modified: 2014-06-24

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus