Bluetooth Changes 
=================
Due to introduction of new architecture there are changes in bluetooth
api which will impact new application development.The major changes
that are required from developer perspective are listed below.

Stack/Hardware Settings 
=======================
Publish and subscribe method is provided for setting the stack
settings.The bluetooth stack publishes the values of its various
settings in the category KPropertyUidBluetoothCategory and applications
can request that settings be changed by setting the value of
the equivalent property in the KPropertyUidBluetoothControlCategory.

Therefore a typical pattern for an application wishing to set the
device discoverable would be:
1. Subscribe to the key of interest in the Bluetooth category.
2. Call the RProperty::Set(...) method on the matching key in the
   Bluetooth Control category.
3. When the stack has serviced the request, it will re-publish
   the new value of the key (whether changed or unchanged)
   on the Bluetooth category, calling the RunL of any subscribers
  
The Available property keys are 
Key:		KpropertyKeyBluetoothLocalDeviceAddress	
Type: 		ByteArray
Description:	The Local Device Address as a 
		descriptor (BluetoothCategory only)

Key:		KpropertyKeyBluetoothPHYCount
Type:		Integer
Description:	The number of currently connected Bluetooth Physical Links

Key:		KpropertyKeyBluetoothConnecting
Type:		Integer	
Description:	1 - if actively paging another device (I.e. connecting)
		0 - if not paging another device

Key:		KpropertyKeyBluetoothScanning
Type:		Integer
Description:	The current scanning mode

Key:		KpropertyKeyBluetoothLimitedDiscoverable
Type:		Integer	
Description:	Value from the enum THCIScanEnable:
		ENoScansEnabled,EInquiryScanOnly,
		EPageScanOnly or EinquiryAndPageScan

Key:		KpropertyKeyBluetoothDeviceClass
Type:		Integer
Description:	The full integer value of the current Class of Device

Key:		KpropertyKeyBluetoothRegistryTableChange
Type:		Integer
Description:	The index of the table which was changed

NOTE:It should be noted that the keys in the Bluetooth control
category will not be defined by the bluetooth stack: 
they should be defined by any application which might set them
(KerrAlreadyExists error condition can be ignored).

NOTE: There is an Exception for the above method for setting
i.e The control of local bluetooth device name uses the same
API as older version.

Bluetooth Sockets 
=================
Auto Bind not SetLocalPort : RSocket::SetLocalPort(port number)
API to specify the  channel to listen on is deprecated.
Applications should instead call the RSocket::Bind(sockAddr) method
specifying a sockAddr with the port set to either KRFCOMMPassiveAutoBind 
or KL2CAPPassiveAutoBind as appropriate.And RSocket::LocalPort
should be used to get the port used.
 

Typedef Name Change
===================
TBTDevAddrPckg -> TBTDevAddrPckgBuf
The name of this typedef has changed to reflect more 
accurately what it is a typedef of and a new typedef 
added with the old name (care required when porting).  

The definitions are now:
typedef TPckgC<TBTDevAddr>		TBTDevAddrPckg;
typedef TPckgBuf<TBTDevAddr>		TBTDevAddrPckgBuf;

Security
========
Service Security : The Methods RBTSecuritySettings::RegisterService
and RBTSecuritySettings::UnregisterService used for configuring
security for incoming connections are now replaced by
TBTSockAddr::SetSecurity which sets security when listening socket
is opened.This is also true for outgoing connection sockets which
replaces the Ioctls KHCIEncryptIoctl and KHCIAuthRequestIoctl
which now return KerrNotSupported

Per Service Security OverRides:Service security overrides are set on
the particular listening socket to which they apply, by calling
RSocket::SetOption [level: KSolBtL2CAP, name KBTSecurityDeviceOverride]
on the socket in question. This replaces the methods
 CBTDevice::SetServiceSecurityL, DeleteServiceSecurityL 
and SetIndividualSecurityArrayL and class TBTDeviceSecurityPerService
has been replaced by TBTServiceSecurityPerDevice. 

BT Device API 
=============
Name Length Change : BlueTooth Device Name will be stored as
an 8 bit (UTF-8 encoded) descriptor instead of Unicode descriptor
in CBTDevice Class. A new helper Class BTDeviceNameConverter
 is provided for ease of conversion between the Formats.


BT Registry
=========== 
There are major changes in BT device registry API. The new APIs
have been designed to remove much of the repetition 
that was required in UI code when performing typical UI tasks
(such as finding all bonded devices).  This is therefore an area 
are one may  consider re-architecture of existing client code
rather than a straight porting.

Most operations on Device Registry are asynchronous and hence active objects should be used for request and updates to registry. The Following 
Classes defined in btmancliemt.h provides method for registry API.
	- RBTRegServ
	- RBTRegistry 
	- TBTRegistrySearch  
	- CBTRegistryResponse

Common usage of registry and relevant API is shown below 

Adding a Device
--------------- 
All registry operations first need a session with the registry server:
RBTRegServ regServ;
User::LeaveIfError(regServ.Connect());
And a subsession for the particular operation in question:
RBTRegistry view;
User::LeaveIfError(view.Open(regServ));

Now a CBTDevice object can be added (shown as a synchronous operation for clarity, should use an Active Object)
TRequestStatus stat;
view.AddDeviceL(aDevice,stat);
User::WaitForRequest(stat);
User::LeaveIfError(stat.Int());

The sub-session (and the session if no longer required) should now be closed
view.Close();
regServ.Close();

Creating View 
-------------
Most registry operations, other than adding a device, will operate
on a set (a view) of found devices.  

Views can be created by searching the registry based on some criteria
using the method RBTRegistry::CreateView.  These criteria are defined
in a TBTRegistrySearch object e.g.

//Assuming regServ & view setup as above & in Cactive object
// [with iStatus etc]
TBTRegistrySearch searchPat;
searchPat.FindAll();  //will find all devices in the table
view.CreateView(searchPat,iStatus);
SetActive();

Retrieving Results 
------------------
The set of devices resulting from a registry search 
(i.e. in the current view) can be retrieved by using the utility
class CBTRegistryResponse, to acquire an RBTDeviceArray of CBTDevice
objects. Note that RBTDeviceArray is a typedef for 
RPointerArray<CBTDevice> and that clients take ownership of the
CBTDevice* s returned in this array.  

Deleting/Unpairing Devices 
--------------------------
Deletion of the devices in a view is accomplished as shown below

//view is an RBTRegistry which has had CreateView called 
view.DeleteAllInView(iStatus);
and likewise unpairing:
//view is an RBTRegistry which has had CreateView called 
view.UnpairAllInView(iStatus);

Modifying Devices 
-----------------
The API for modifying device entries in the Registry is in two parts:
operations which UIs may wish to perform and those which the
bluetooth stack might wish to perform 
[RBTRegistry::ModifyDevice(TBTNamelessDevice), ModifyBluetoothDeviceNameL].

Comm Port Settings 
------------------
A new RBTCommPortSettings Class is provided which is another
sub-session to the registry for this purpose.
 
SCO Connections
---------------
A generic API for dealing with SCO connections has been introduced.
Instead of the previous way manipulating via Ioctls on connected 
on connected RFCOMM Sockets.

Creating an outgoing SCO Connection
----------------------------------- 
Instantiate a CbluetoothSynchronousLink.
A CBluetoothSynchronousLink object is instantiated
by passing an MbluetoothSynchronousLinkNotifier implementation

Setup the Connection
--------------------
CBluetoothSynchronousLink::SetupConnection called with remote device
address. Upon completion, aNotifiers
HandleSetupConnectionCompleteL(TInt aErr) will be called.

Disconnecting a SCO Connection 
------------------------------
//socket is a connected CBluetoothSynchronousLink*
socket->Disconnect();

and on completion aNotifiers HandleDisconnectionCompleteL(TInt aErr) will be called.

