Create a Serial Port Profile (SPP) connection to a service on a remote Bluetooth device (server) - an extended version of bt_spp_open.
#include <btapi/btspp.h>
int bt_spp_open_ex(char *addr, char *service_name, char *service_uuid, int service_port, bool nonblock, void(*callback)(long, int), long param)
BlackBerry 10.3.0
The remote Bluetooth device (server) address. The address is in the following format: 2:2:2:2:2:2, where each digit indicates the number of hexadecimal digits. For example: 00:11:22:33:AA:BB.
The name of the service that might appear in the service's Service Discovery Protocol (SDP) record. The maximal length is 50, including the terminating '\0' character. If this argument is set to an empty string or NULL, it will be excluded from the querying criteria of the remote side SDP database.
The Universally Unique Identifier (UUID) of the service to connect to. This parameter must be the service ID defined by the developer, not the Service Class ID assigned by the Bluetooth organization. For example, the SPP profile has a 4-digit Service Class ID of 0x1101. A developer can create multiple services for this service class, and must define a unique service ID for each of the services. This function searches for the intended service using the input UUID when the input matches a supported service ID format. If this argument is set to NULL, it will be considered as being set to UUID 00001101-0000-1000-8000-00805f9b34fb, which is reserved by the Bluetooth organization as the Service Class ID for the SPP service.
The RFCOMM channel ID that is needed to create an SPP link to the server. Any registered service on a server has this number. Normally a client-side system retrieves it for the user by querying the server's SDP database using the service UUID, the service name, or generic SPP features, or some combination of the three. However, there are situations when the user wants to connect to a known RFCOMM channel ID. In that case a non-zero service_port must be passed in. If it is left as zero, the search in the remote SDP database is done by a combination of service_name, service_uuid and generic SPP features.
A flag that specifies whether to open a mount point of the connection in non-blocking mode. A value of true means opening the connection in non-blocking mode.
A pointer to a valid callback function that provides the mount point file descriptor if you are using the function in asynchronous mode. For the synchronous mode, pass in a NULL value. The mount point file descriptor is provided when the connection to the SPP server is established. In case of a failure, the file descriptor returns with a value of -1 and errno is set with the reason.
The user's parameter as the first argument of the returned callback.
The function allows a user to create a connection to the SPP service on a remote device that can be found in the SDP by a combination of the following parameters: service name, service UUID, and RFCOMM channel ID. The combination may use any or all of the three parameters. If you don't want to use service_name or service_uuid for the retrieval of an SDP record, pass in NULL for either or both parameters; if you don't want to use service_port, pass in zero.
You can open the connection in non-blocking or blocking mode. After you successfully call this function, and when your application is finished with the file descriptor that is returned from this function, call bt_spp_close() to clean up resources.