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 BTMANCLIENT_H williamr@2: #define BTMANCLIENT_H williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: static const TInt KErrBluetoothRegistryCorrupt = -6501; williamr@2: williamr@2: /** The type of device class search to perform. williamr@2: williamr@2: The enumeration is of masks. Valid combinations are: williamr@2: williamr@2: EMajorDevice only williamr@2: EMajorDevice & EMinorDevice williamr@2: williamr@2: Note: EMinorDevice may not be used on its own. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: enum TBTDeviceClassSearch williamr@2: { williamr@2: EMajorDevice = 0x01,/*!< Indicates the major device class search criteria. */ williamr@2: EMinorDevice = 0x02,/*!< Indicates the minor device class search criteria. */ williamr@2: }; williamr@2: williamr@2: williamr@2: NONSHARABLE_CLASS(TBTRegistrySearch) williamr@2: /** Set search criteria on the Bluetooth Registry. williamr@2: williamr@2: The search logic is "AND", so if device bonded is set, and code set to williamr@2: headsets the search results contain all the bonded headsets in the registry. williamr@2: williamr@2: Other things can be added to the search criteria e.g. recently used headsets williamr@2: can easil be found by adding in the LastUsed criterion. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: friend class RBTDbQuery; williamr@2: public: williamr@2: IMPORT_C TBTRegistrySearch(); williamr@2: IMPORT_C TBTRegistrySearch(const TBTRegistrySearch& aSearch); williamr@2: IMPORT_C void Reset(); williamr@2: IMPORT_C void FindAll(); williamr@2: IMPORT_C void FindAddress(const TBTDevAddr& aAddress); williamr@2: IMPORT_C void FindBonded(); williamr@2: IMPORT_C void FindTrusted(); williamr@2: IMPORT_C void FindCoD(const TBTDeviceClass& aClass); williamr@2: IMPORT_C void FindCoD(const TBTDeviceClass& aClass, TBTDeviceClassSearch aPref); williamr@2: IMPORT_C void FindSinceSeen(const TTime& aLastSeen); williamr@2: IMPORT_C void FindSinceUsed(const TTime& aLastUsed); williamr@2: IMPORT_C void FindBluetoothName(const TDesC8& aName); williamr@2: IMPORT_C void FindFriendlyName(const TDesC& aName); williamr@2: IMPORT_C void FindCurrentProcessOwned(); williamr@2: IMPORT_C void FindUiCookie(TUint32 aUiCookie); williamr@2: IMPORT_C void FindUiCookie(TUint32 aUiCookie, TUint32 aUiCookieMask); williamr@2: IMPORT_C TBTRegistrySearch& operator=(const TBTRegistrySearch& aSearch); williamr@2: private: williamr@2: enum TSearchMask williamr@2: { williamr@2: EAddress = 0x0001, williamr@2: EBonded = 0x0002, williamr@2: ETrusted = 0x0004, williamr@2: ECoD = 0x0008, williamr@2: ECoDMajorDev = 0x0010, williamr@2: ECoDMinorDev = 0x0020, williamr@2: ECoDService = 0x0040, // not used at present williamr@2: ELastSeen = 0x0080, williamr@2: ELastUsed = 0x0100, williamr@2: EBTName = 0x0200, williamr@2: EFriendlyName = 0x0400, williamr@2: EUiCookie = 0x2000, williamr@2: EProcess = 0x4000, williamr@2: EAll = 0x8000, williamr@2: // Top bit reserved for if the class needs to be extended. williamr@2: EExtension = 0x80000000 williamr@2: }; williamr@2: private: williamr@2: TUint iSearchMask; // what we actually have set to search on williamr@2: TBTDevAddr iDeviceAddress; williamr@2: TBTDeviceClass iDeviceClass; williamr@2: TTime iLastSeen; williamr@2: TTime iLastUsed; williamr@2: TPtrC8 iBluetoothName; williamr@2: TPtrC iFriendlyName; williamr@2: TUid iCurrentProcessSID; williamr@2: TUint32 iUiCookie; williamr@2: TUint32 iUiCookieMask; williamr@2: williamr@2: //TUint32 iPadding1; // used for UI Cookie williamr@2: //TUint32 iPadding2; // used for UI Cookie mask. williamr@2: }; williamr@2: williamr@2: williamr@2: NONSHARABLE_CLASS(RBTMan) : public RSessionBase williamr@2: /** Creates a sessions over which the Bluetooth security manager is accessible. williamr@2: williamr@2: A session must be used in order to access a subsession, RBTManSubSession, williamr@2: that allows access to the Security Manager. The following example creates and williamr@2: connects to the security manager session. williamr@2: williamr@2: @code williamr@2: RBTMan secMan; williamr@2: User::LeaveIfError(secMan.Connect()); williamr@2: @endcode williamr@2: williamr@2: Sessions available thus far are Registry-like williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C RBTMan(); williamr@2: IMPORT_C TInt Connect(); williamr@2: IMPORT_C TVersion Version() const; williamr@2: williamr@2: private: 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: struct TBTManClientServerMessage williamr@2: /** williamr@4: This is to only be used by phone manufacturers, not by application developers. williamr@4: @publishedAll williamr@2: */ williamr@2: { williamr@2: public: williamr@2: TRequestStatus* iClientStatusToCancel; williamr@2: TBool iClientBusy; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(RBTManSubSession) : public RSubSessionBase williamr@2: /** A subsession for the RBTMan session. williamr@2: williamr@2: RBTManSubSession provides the actual access to the security manager. williamr@2: williamr@2: Contains basic subssession functionality. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** Used to close the subsession. */ williamr@2: virtual void Close() = 0; // All subsessions must provide Close overrides williamr@2: IMPORT_C void CancelRequest(TRequestStatus& aStatus); williamr@2: void LocalComplete(TRequestStatus& aStatus, TInt aErr); williamr@2: williamr@2: protected: williamr@2: IMPORT_C RBTManSubSession(); williamr@2: TBool IsBusy() const; williamr@2: void SetBusy(TRequestStatus& aStatus); williamr@2: williamr@2: protected: williamr@2: TPckgBuf iClientServerMsg; 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: NONSHARABLE_CLASS(RBTRegServ) : protected RBTMan williamr@2: /** Registry access session. williamr@2: williamr@2: It has a RBTMan session as implementation. williamr@2: @released williamr@2: @publishedAll williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C RBTRegServ(); williamr@2: IMPORT_C TInt Connect(); williamr@2: IMPORT_C void Close(); williamr@2: IMPORT_C RBTMan& Session(); williamr@2: IMPORT_C TInt SetHeapFailure(TInt aType,TInt aRate); williamr@2: IMPORT_C TInt ResourceCount(); williamr@2: williamr@2: private: 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: // other functional sessions can derive from RBTMan williamr@2: williamr@2: typedef RPointerArray RBTDeviceArray; /*! TBTNamelessDevicePckgBuf; /*! TBTDevAddrPckg; /*! TBTDevAddrPckgBuf; /*! TBTRegistrySearchPckgBuf; /*! iDevicePckg; williamr@2: TPckgBuf iAddrBuf; 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: NONSHARABLE_CLASS(RBTLocalDevice) : public RBTManSubSession williamr@2: /** Creates and opens a subsession on BT Registry Server for local devices. williamr@2: williamr@2: This subsession allows the local device to be updated, modified, examined etc. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C RBTLocalDevice(); williamr@2: IMPORT_C TInt Open(RBTRegServ& aSession); williamr@2: IMPORT_C TInt Get(TBTLocalDevice& aLocalDevice); williamr@2: IMPORT_C TInt Modify(const TBTLocalDevice& aLocalDevice); williamr@2: IMPORT_C void Modify(const TBTLocalDevice& aLocalDevice, TRequestStatus& aStatus); williamr@2: IMPORT_C void Close(); williamr@2: private: williamr@2: TPckg iLocalDevicePckg; 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: /** williamr@2: UID of the PIN entry RNotifier plugin williamr@4: This is only to be used with notifiers. williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: const TUid KBTManPinNotifierUid={0x100069c9}; williamr@2: williamr@2: /** williamr@2: UID of the authorisation RNotifier plugin williamr@4: This is only to be used with notifiers. williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: const TUid KBTManAuthNotifierUid={0x100069cf}; williamr@2: williamr@2: williamr@4: williamr@2: NONSHARABLE_CLASS(TBTNotifierUpdateParams) williamr@2: /** Sends parameter updates to the notifier. williamr@2: williamr@2: Struct to allow us to send a device name to the Passkey Entry and Authorisation RNotifier plugins. williamr@4: This is only to be used with notifiers. williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** The device name that has been retrieved since security procedures started. */ williamr@2: TBTDeviceName iName; williamr@2: /** The result. */ williamr@2: TInt iResult; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(TBTNotifierParams) williamr@2: /** The device name parameter for the security notifier. williamr@4: This is only to be used with notifiers. williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** Device address of remote device requiring authorisation. */ williamr@2: TBTDevAddr iBDAddr; williamr@2: /** The device name that has been retrieved since security procedures started. */ williamr@2: TBTDeviceName iName; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(TBTAuthorisationParams) : public TBTNotifierParams williamr@2: /** Bluetooth authorisation parameters. williamr@4: This is only to be used with notifiers. williamr@2: Struct to allow us to send params from the security manager to the Authorisation RNotifier plugin. williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** UID of the service requesting authorisation. */ williamr@2: TUid iUid; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(TBTPasskeyNotifierParams) : public TBTNotifierParams williamr@2: /** The passkey parameter for the security notifier. williamr@4: This is only to be used with notifiers. williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** A min passkey length required. 0 means, no length requirement */ williamr@2: TUint iPasskeyMinLength; williamr@2: /** true - locally initiated connection, false - remote side initiated */ williamr@2: TBool iLocallyInitiated; williamr@2: }; williamr@2: williamr@4: // These are only to be used with notifiers. williamr@2: typedef TPckgBuf TBTNotifierUpdateParamsPckg; /*!< packagebuf of TBTNotifierUpdateParams*/ williamr@2: typedef TPckgBuf TBTNotifierParamsPckg; /*!< packagebuf of TBTNotifierParams*/ williamr@2: typedef TPckgBuf TBTAuthorisationParamsPckg; /*!< packagebuf of TBTAuthorisationParams*/ williamr@2: typedef TPckgBuf TBTPasskeyNotifierParamsPckg; /*!< packagebuf of TBTPasskeyNotifierParams*/ williamr@2: williamr@2: #endif