×
Namespaces

Variants
Actions

How to connect to a particular Bluetooth address

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: mahbub_s60 (10 May 2008)
Last edited: hamishwillee (26 Jul 2012)

Overview

This code snippet shows how we can connect to a Bluetooth device over RFCOMM when we know the address. If we know the address and channel number of interested service then it can be connected directly. If we don't know the channel number then we need to find it as usual way and then we can connect.

   TBTDevAddr devAddr(MAKE_TINT64(0x0019, 0x79fa2193));
// 001979fa2193 is target BT address divided into two parts
 
TBTSockAddr asocket;
asocket.SetBTAddr(devAddr);
asocket.SetPort(5);
//Assuming the expected service is advertised on channel 5

When Channel number is not known

   TBTDevAddr devAddr(MAKE_TINT64(0x0019, 0x79fa2193));				
iState = EGettingService;
iStatus = KRequestPending;
iServiceSearcher->FindServiceL(iStatus, devAddr);
SetActive();
This page was last modified on 26 July 2012, at 05:39.
34 page views in the last 30 days.