bluetoothengine/btnotif/btnotifsrv/inc/btnotifoutgoingpairinghandler.h
changeset 47 9e2a905b887f
parent 42 b72428996822
child 57 5ebadcda06cb
equal deleted inserted replaced
45:b0aebde9b1fb 47:9e2a905b887f
    21 #include <bttypes.h>
    21 #include <bttypes.h>
    22 #include <bluetooth/pairing.h>
    22 #include <bluetooth/pairing.h>
    23 #include <e32property.h>
    23 #include <e32property.h>
    24 #include "btnotifclientserver.h"
    24 #include "btnotifclientserver.h"
    25 #include "btnotifBasePairingHandler.h"
    25 #include "btnotifBasePairingHandler.h"
    26 
    26 #include <hb/hbcore/hbsymbianvariant.h>
       
    27 #include "btnotificationresult.h"
       
    28 #include "bluetoothdevicedialogs.h"
       
    29 
       
    30 class CBluetoothNotification;
    27 
    31 
    28 enum TBTOutgoingPairMode
    32 enum TBTOutgoingPairMode
    29     {
    33     {
    30     /**
    34     /**
    31      * not outgoing pairing operation
    35      * not outgoing pairing operation
    51 /**
    55 /**
    52  *  Perform a outgoing pair with a BT device.
    56  *  Perform a outgoing pair with a BT device.
    53  *
    57  *
    54  *  @since Symbian^4
    58  *  @since Symbian^4
    55  */
    59  */
    56 NONSHARABLE_CLASS( CBTNotifOutgoingPairingHandler ) : public CBTNotifBasePairingHandler
    60 NONSHARABLE_CLASS( CBTNotifOutgoingPairingHandler ) : public CBTNotifBasePairingHandler,
       
    61                                                       public MBTNotificationResult
    57     {
    62     {
    58 
    63 
    59 public:
    64 public:
    60 
    65 
    61     /**
    66     /**
    68 
    73 
    69     /**
    74     /**
    70      * Destructor
    75      * Destructor
    71      */
    76      */
    72     ~CBTNotifOutgoingPairingHandler();
    77     ~CBTNotifOutgoingPairingHandler();
    73     
    78 
    74 private: // From CBTEngPairBase
    79     
       
    80     // from base class MBTNotificationResult
       
    81 
       
    82     /**
       
    83      * From MBTNotificationResult.
       
    84      * Handle an intermediate result from a user query.
       
    85      * This function is called if the user query passes information
       
    86      * back before it has finished i.e. is dismissed. The final acceptance/
       
    87      * denial of a query is passed back in MBRNotificationClosed.
       
    88      *
       
    89      * @since Symbian^4
       
    90      * @param aData the returned data. The actual format 
       
    91      *              is dependent on the actual notifier.
       
    92      */
       
    93     virtual void MBRDataReceived( CHbSymbianVariantMap& aData );
       
    94 
       
    95     /**
       
    96      * From MBTNotificationResult.
       
    97      * The notification is finished. The resulting data (e.g. user input or
       
    98      * acceptance/denial of the query) is passed back here.
       
    99      *
       
   100      * @since Symbian^4
       
   101      * @param aErr KErrNone or one of the system-wide error codes.
       
   102      * @param aData the returned data. The actual format 
       
   103      *              is dependent on the actual notifier.
       
   104      */
       
   105     virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData );
       
   106     
       
   107 private:
    75     
   108     
    76     /**
   109     /**
    77      * Start observing the result of pairing which was originated from
   110      * Start observing the result of pairing which was originated from
    78      * the remote device.
   111      * the remote device.
    79      * @param the address of the remote device to be paired
   112      * @param the address of the remote device to be paired
   151      * @param aStatus The status of the completed request.
   184      * @param aStatus The status of the completed request.
   152      */
   185      */
   153     void HandleError( CBtSimpleActive* aActive, TInt aError );
   186     void HandleError( CBtSimpleActive* aActive, TInt aError );
   154 
   187 
   155 private:
   188 private:
       
   189     /**
       
   190      * Get a notification and configure it according to the current operation.
       
   191      *
       
   192      * @since Symbian^4
       
   193      * @param aType The notification type.
       
   194      * @param aResourceId Identifier for the resource to display.
       
   195      */
       
   196     void PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType,
       
   197                 TBTDialogResourceId aResourceId );
       
   198 
       
   199     /**
       
   200      * Handle the result from a notification that is finished.
       
   201      *
       
   202      * @since Symbian^4
       
   203      * @param aErr KErrNone or one of the system-wide error codes.
       
   204      * @param aData The returned data. The actual format 
       
   205      *              is dependent on the actual notifier.
       
   206      */
       
   207     void NotificationClosedL( TInt aError, const TDesC8& aData );
       
   208 
       
   209 private:
   156 
   210 
   157     /**
   211     /**
   158      * C++ default constructor
   212      * C++ default constructor
   159      */
   213      */
   160     CBTNotifOutgoingPairingHandler( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr );
   214     CBTNotifOutgoingPairingHandler( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr );
   166     
   220     
   167     /**
   221     /**
   168      * Starts an actual pair operation.
   222      * Starts an actual pair operation.
   169      */
   223      */
   170     void DoPairingL();
   224     void DoPairingL();
       
   225     
       
   226     /**
       
   227      * Ask the user to retry pairing.
       
   228      */    
       
   229     void ShowPairingRetryDialog();
       
   230     
       
   231     /**
       
   232      * Tell the user the pairing failed.
       
   233      */    
       
   234     void ShowPairingFailureDialog();
   171     
   235     
   172 private: // data
   236 private: // data
   173 	
   237 	
   174     /**
   238     /**
   175      * Socket address of the remote device to pair with.
   239      * Socket address of the remote device to pair with.
   198     
   262     
   199     /**
   263     /**
   200      * the current pairing mode this class is in
   264      * the current pairing mode this class is in
   201      */
   265      */
   202     TBTOutgoingPairMode iPairMode;
   266     TBTOutgoingPairMode iPairMode;
       
   267 
       
   268     /**
       
   269      * Pointer to an outstanding user interaction.
       
   270      * Not own.
       
   271      */
       
   272     CBluetoothNotification* iNotification;
       
   273 
       
   274     /**
       
   275      * Number of pairing attempt
       
   276      */
       
   277     TInt iPairingAttempt;
   203     
   278     
   204     };
   279     };
   205 
   280 
   206 
   281 
   207 #endif /* BTNOTIFOUTGOINGPAIRINGHANDLER_H_ */
   282 #endif /* BTNOTIFOUTGOINGPAIRINGHANDLER_H_ */