bluetoothmgmt/btmgr/Inc/BTDefCommPort.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef BTDEFCOMMPORT_H__
       
    17 #define BTDEFCOMMPORT_H__
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <e32base.h>
       
    21 #include <bttypes.h>
       
    22 #include <s32mem.h>
       
    23 #include <btmanclient.h>
       
    24 
       
    25 /**
       
    26 KBTDefaultServiceSecurityNone
       
    27 Security setting for virtual serial port - in this case no security
       
    28 @publishedAll
       
    29 @released
       
    30 */
       
    31 static const TUint8 KBTDefaultServiceSecurityNone                   = 0;
       
    32 
       
    33 /**
       
    34 KBTDefaultServiceSecurityAuthenticateOnly
       
    35 Security setting for virtual serial port
       
    36 The virtual serial connection will apply Bluetooth authentication
       
    37 @publishedAll
       
    38 @released
       
    39 */
       
    40 static const TUint8 KBTDefaultServiceSecurityAuthenticateOnly       = 1;
       
    41 
       
    42 /**
       
    43 KBTDefaultServiceSecurityAuthenticateAndEncrypt
       
    44 Security setting for virtual serial port
       
    45 The virtual serial connection will apply Bluetooth authentication and encryption
       
    46 @publishedAll
       
    47 @released
       
    48 */
       
    49 static const TUint8 KBTDefaultServiceSecurityAuthenticateAndEncrypt = 2;
       
    50 
       
    51 /**
       
    52 KCommHighUnit
       
    53 The maximum virtual serial port number supported
       
    54 ie. BTCOMM::KCommHighUnit is the maximum Bluetooth serial port that can be opened
       
    55 @publishedAll
       
    56 @released
       
    57 */
       
    58 static const TUint8 KCommHighUnit=63;
       
    59 
       
    60 NONSHARABLE_CLASS(TBTCommPortSettings)
       
    61 /**
       
    62 Used to configure a virtual serial port.  The very least that is needed to configure a virtual serial port
       
    63 is the Bluetooth device address of the remote, and the SDP UUID to use on that device.
       
    64 
       
    65 This info can then be saved by the registry and retrieved when needed.
       
    66 @publishedAll
       
    67 @released
       
    68 */
       
    69 	{
       
    70 public:
       
    71 	IMPORT_C TBTCommPortSettings(const TDesC& aName, TUUID aUUID,TUint32 aBTCommPort, TUint8 aSecurityLevel, TBTDevAddr aBDAddr);
       
    72 	IMPORT_C TBTCommPortSettings();
       
    73 	IMPORT_C const TDesC& Name() const;	//< Returns the name of the service.
       
    74 	IMPORT_C TUUID UUID() const;			//< Returns the unique id of the service.
       
    75 	IMPORT_C TBTDevAddr BDAddr() const;		//< Returns the address of the default device associated with the service.
       
    76 	IMPORT_C TUint32 Port() const;
       
    77 	IMPORT_C TBool IsSecuritySet() const;
       
    78 	IMPORT_C TBool IsEncryptionSet() const;
       
    79 	IMPORT_C TBool IsAuthenticationOnlySet() const;
       
    80 	IMPORT_C void SetName(const TDesC& aName);	//< Sets the name of the service.
       
    81 	IMPORT_C void SetUUID(TUUID aUUID);			//< Sets the unique id of the service.
       
    82 	IMPORT_C void SetPort(TUint32 aBTCommPort);
       
    83 	IMPORT_C void SetAuthentication();
       
    84 	IMPORT_C void SetAuthenticationAndEncryption(); // enforces authentication as well
       
    85 	IMPORT_C void SetNoSecurity(); // resets the above two
       
    86 	IMPORT_C void SetBTAddr(TBTDevAddr aBDAddr);	//< Sets the address of the default device associated with the service.
       
    87 
       
    88 	IMPORT_C TUint8 SecurityLevel() const;
       
    89 	IMPORT_C void SetSecurityLevel(TUint8 aLevel);
       
    90 private:
       
    91 	TBuf<32>	iName;		    // The name of the service 
       
    92 	TUUID		iUUID;			// The UUID of the service
       
    93 	TUint32		iPort;          // The port no of the virtual serial port opened by the legacy app
       
    94 	TUint8		iSecurityLevel; // for that default service (i.e 0,1,2 = none,auth,encrypt+auth)
       
    95 	TBTDevAddr	iBDAddr;	    // The address of the default device
       
    96 	
       
    97     // This data padding has been added to help prevent future binary compatibility breaks	
       
    98     // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
       
    99 	TUint32     iPadding1;
       
   100 	TUint32     iPadding2;
       
   101 	};
       
   102 
       
   103 
       
   104 typedef TPckgBuf<TBTCommPortSettings> TBTCommPortSettingsPckg; /*!< Handy package to send TBTCommPortSettings over IPC*/
       
   105 
       
   106 
       
   107 
       
   108 /**
       
   109 A subsession on the Bluetooth Registry server
       
   110 This subsession allows the virtual serial ports to be updated, modified, examined etc.
       
   111 
       
   112 @publishedAll
       
   113 @released
       
   114 */
       
   115 NONSHARABLE_CLASS(RBTCommPortSettings) : public RBTManSubSession
       
   116 	{
       
   117 public:
       
   118 	IMPORT_C RBTCommPortSettings();
       
   119 	IMPORT_C TInt Open(RBTRegServ& aSession);	// creates the subsession server side
       
   120 	IMPORT_C TInt Get(TBTCommPortSettings& aSettings);	//synchronous
       
   121 	IMPORT_C void Modify(const TBTCommPortSettings& aSettings, TRequestStatus& aStatus); // may add if not present
       
   122 	IMPORT_C void Delete(const TBTCommPortSettings& aSettings, TRequestStatus& aStatus);
       
   123 	IMPORT_C void Close();
       
   124 private:
       
   125 	TPckgBuf<TBTCommPortSettings>	iPortPckg;
       
   126 	
       
   127 	// This data padding has been added to help prevent future binary compatibility breaks	
       
   128 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
       
   129 	TUint32     iPadding1; 
       
   130 	TUint32     iPadding2; 
       
   131 	};
       
   132 
       
   133 
       
   134 #endif