epoc32/include/btdefcommport.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/btdefcommport.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,134 @@
     1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef BTDEFCOMMPORT_H__
    1.20 +#define BTDEFCOMMPORT_H__
    1.21 +
    1.22 +#include <e32std.h>
    1.23 +#include <e32base.h>
    1.24 +#include <bttypes.h>
    1.25 +#include <s32mem.h>
    1.26 +#include <btmanclient.h>
    1.27 +
    1.28 +/**
    1.29 +KBTDefaultServiceSecurityNone
    1.30 +Security setting for virtual serial port - in this case no security
    1.31 +@publishedAll
    1.32 +@released
    1.33 +*/
    1.34 +static const TUint8 KBTDefaultServiceSecurityNone                   = 0;
    1.35 +
    1.36 +/**
    1.37 +KBTDefaultServiceSecurityAuthenticateOnly
    1.38 +Security setting for virtual serial port
    1.39 +The virtual serial connection will apply Bluetooth authentication
    1.40 +@publishedAll
    1.41 +@released
    1.42 +*/
    1.43 +static const TUint8 KBTDefaultServiceSecurityAuthenticateOnly       = 1;
    1.44 +
    1.45 +/**
    1.46 +KBTDefaultServiceSecurityAuthenticateAndEncrypt
    1.47 +Security setting for virtual serial port
    1.48 +The virtual serial connection will apply Bluetooth authentication and encryption
    1.49 +@publishedAll
    1.50 +@released
    1.51 +*/
    1.52 +static const TUint8 KBTDefaultServiceSecurityAuthenticateAndEncrypt = 2;
    1.53 +
    1.54 +/**
    1.55 +KCommHighUnit
    1.56 +The maximum virtual serial port number supported
    1.57 +ie. BTCOMM::KCommHighUnit is the maximum Bluetooth serial port that can be opened
    1.58 +@publishedAll
    1.59 +@released
    1.60 +*/
    1.61 +static const TUint8 KCommHighUnit=63;
    1.62 +
    1.63 +NONSHARABLE_CLASS(TBTCommPortSettings)
    1.64 +/**
    1.65 +Used to configure a virtual serial port.  The very least that is needed to configure a virtual serial port
    1.66 +is the Bluetooth device address of the remote, and the SDP UUID to use on that device.
    1.67 +
    1.68 +This info can then be saved by the registry and retrieved when needed.
    1.69 +@publishedAll
    1.70 +@released
    1.71 +*/
    1.72 +	{
    1.73 +public:
    1.74 +	IMPORT_C TBTCommPortSettings(const TDesC& aName, TUUID aUUID,TUint32 aBTCommPort, TUint8 aSecurityLevel, TBTDevAddr aBDAddr);
    1.75 +	IMPORT_C TBTCommPortSettings();
    1.76 +	IMPORT_C const TDesC& Name() const;	///< Returns the name of the service.
    1.77 +	IMPORT_C TUUID UUID() const;			///< Returns the unique id of the service.
    1.78 +	IMPORT_C TBTDevAddr BDAddr() const;		///< Returns the address of the default device associated with the service.
    1.79 +	IMPORT_C TUint32 Port() const;
    1.80 +	IMPORT_C TBool IsSecuritySet() const;
    1.81 +	IMPORT_C TBool IsEncryptionSet() const;
    1.82 +	IMPORT_C TBool IsAuthenticationOnlySet() const;
    1.83 +	IMPORT_C void SetName(const TDesC& aName);	///< Sets the name of the service.
    1.84 +	IMPORT_C void SetUUID(TUUID aUUID);			///< Sets the unique id of the service.
    1.85 +	IMPORT_C void SetPort(TUint32 aBTCommPort);
    1.86 +	IMPORT_C void SetAuthentication();
    1.87 +	IMPORT_C void SetAuthenticationAndEncryption(); // enforces authentication as well
    1.88 +	IMPORT_C void SetNoSecurity(); // resets the above two
    1.89 +	IMPORT_C void SetBTAddr(TBTDevAddr aBDAddr);	///< Sets the address of the default device associated with the service.
    1.90 +
    1.91 +	IMPORT_C TUint8 SecurityLevel() const;
    1.92 +	IMPORT_C void SetSecurityLevel(TUint8 aLevel);
    1.93 +private:
    1.94 +	TBuf<32>	iName;		    // The name of the service 
    1.95 +	TUUID		iUUID;			// The UUID of the service
    1.96 +	TUint32		iPort;          // The port no of the virtual serial port opened by the legacy app
    1.97 +	TUint8		iSecurityLevel; // for that default service (i.e 0,1,2 = none,auth,encrypt+auth)
    1.98 +	TBTDevAddr	iBDAddr;	    // The address of the default device
    1.99 +	
   1.100 +    // This data padding has been added to help prevent future binary compatibility breaks	
   1.101 +    // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
   1.102 +	TUint32     iPadding1;
   1.103 +	TUint32     iPadding2;
   1.104 +	};
   1.105 +
   1.106 +
   1.107 +typedef TPckgBuf<TBTCommPortSettings> TBTCommPortSettingsPckg; /*!< Handy package to send TBTCommPortSettings over IPC*/
   1.108 +
   1.109 +
   1.110 +
   1.111 +/**
   1.112 +A subsession on the Bluetooth Registry server
   1.113 +This subsession allows the virtual serial ports to be updated, modified, examined etc.
   1.114 +
   1.115 +@publishedAll
   1.116 +@released
   1.117 +*/
   1.118 +NONSHARABLE_CLASS(RBTCommPortSettings) : public RBTManSubSession
   1.119 +	{
   1.120 +public:
   1.121 +	IMPORT_C RBTCommPortSettings();
   1.122 +	IMPORT_C TInt Open(RBTRegServ& aSession);	// creates the subsession server side
   1.123 +	IMPORT_C TInt Get(TBTCommPortSettings& aSettings);	//synchronous
   1.124 +	IMPORT_C void Modify(const TBTCommPortSettings& aSettings, TRequestStatus& aStatus); // may add if not present
   1.125 +	IMPORT_C void Delete(const TBTCommPortSettings& aSettings, TRequestStatus& aStatus);
   1.126 +	IMPORT_C void Close();
   1.127 +private:
   1.128 +	TPckgBuf<TBTCommPortSettings>	iPortPckg;
   1.129 +	
   1.130 +	// This data padding has been added to help prevent future binary compatibility breaks	
   1.131 +	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
   1.132 +	TUint32     iPadding1; 
   1.133 +	TUint32     iPadding2; 
   1.134 +	};
   1.135 +
   1.136 +
   1.137 +#endif