williamr@2: // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef BTDEFCOMMPORT_H__ williamr@2: #define BTDEFCOMMPORT_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: /** williamr@2: KBTDefaultServiceSecurityNone williamr@2: Security setting for virtual serial port - in this case no security williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: static const TUint8 KBTDefaultServiceSecurityNone = 0; williamr@2: williamr@2: /** williamr@2: KBTDefaultServiceSecurityAuthenticateOnly williamr@2: Security setting for virtual serial port williamr@2: The virtual serial connection will apply Bluetooth authentication williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: static const TUint8 KBTDefaultServiceSecurityAuthenticateOnly = 1; williamr@2: williamr@2: /** williamr@2: KBTDefaultServiceSecurityAuthenticateAndEncrypt williamr@2: Security setting for virtual serial port williamr@2: The virtual serial connection will apply Bluetooth authentication and encryption williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: static const TUint8 KBTDefaultServiceSecurityAuthenticateAndEncrypt = 2; williamr@2: williamr@2: /** williamr@2: KCommHighUnit williamr@2: The maximum virtual serial port number supported williamr@2: ie. BTCOMM::KCommHighUnit is the maximum Bluetooth serial port that can be opened williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: static const TUint8 KCommHighUnit=63; williamr@2: williamr@2: NONSHARABLE_CLASS(TBTCommPortSettings) williamr@2: /** williamr@2: Used to configure a virtual serial port. The very least that is needed to configure a virtual serial port williamr@2: is the Bluetooth device address of the remote, and the SDP UUID to use on that device. williamr@2: williamr@2: This info can then be saved by the registry and retrieved when needed. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TBTCommPortSettings(const TDesC& aName, TUUID aUUID,TUint32 aBTCommPort, TUint8 aSecurityLevel, TBTDevAddr aBDAddr); williamr@2: IMPORT_C TBTCommPortSettings(); williamr@4: IMPORT_C const TDesC& Name() const; //< Returns the name of the service. williamr@4: IMPORT_C TUUID UUID() const; //< Returns the unique id of the service. williamr@4: IMPORT_C TBTDevAddr BDAddr() const; //< Returns the address of the default device associated with the service. williamr@2: IMPORT_C TUint32 Port() const; williamr@2: IMPORT_C TBool IsSecuritySet() const; williamr@2: IMPORT_C TBool IsEncryptionSet() const; williamr@2: IMPORT_C TBool IsAuthenticationOnlySet() const; williamr@4: IMPORT_C void SetName(const TDesC& aName); //< Sets the name of the service. williamr@4: IMPORT_C void SetUUID(TUUID aUUID); //< Sets the unique id of the service. williamr@2: IMPORT_C void SetPort(TUint32 aBTCommPort); williamr@2: IMPORT_C void SetAuthentication(); williamr@2: IMPORT_C void SetAuthenticationAndEncryption(); // enforces authentication as well williamr@2: IMPORT_C void SetNoSecurity(); // resets the above two williamr@4: IMPORT_C void SetBTAddr(TBTDevAddr aBDAddr); //< Sets the address of the default device associated with the service. williamr@2: williamr@2: IMPORT_C TUint8 SecurityLevel() const; williamr@2: IMPORT_C void SetSecurityLevel(TUint8 aLevel); williamr@2: private: williamr@2: TBuf<32> iName; // The name of the service williamr@2: TUUID iUUID; // The UUID of the service williamr@2: TUint32 iPort; // The port no of the virtual serial port opened by the legacy app williamr@2: TUint8 iSecurityLevel; // for that default service (i.e 0,1,2 = none,auth,encrypt+auth) williamr@2: TBTDevAddr iBDAddr; // The address of the default device williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: williamr@2: typedef TPckgBuf TBTCommPortSettingsPckg; /*!< Handy package to send TBTCommPortSettings over IPC*/ williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: A subsession on the Bluetooth Registry server williamr@2: This subsession allows the virtual serial ports to be updated, modified, examined etc. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: NONSHARABLE_CLASS(RBTCommPortSettings) : public RBTManSubSession williamr@2: { williamr@2: public: williamr@2: IMPORT_C RBTCommPortSettings(); williamr@2: IMPORT_C TInt Open(RBTRegServ& aSession); // creates the subsession server side williamr@2: IMPORT_C TInt Get(TBTCommPortSettings& aSettings); //synchronous williamr@2: IMPORT_C void Modify(const TBTCommPortSettings& aSettings, TRequestStatus& aStatus); // may add if not present williamr@2: IMPORT_C void Delete(const TBTCommPortSettings& aSettings, TRequestStatus& aStatus); williamr@2: IMPORT_C void Close(); williamr@2: private: williamr@2: TPckgBuf iPortPckg; williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif