hotspotfw/hsclient/inc/hsssrvnotifications.h
changeset 0 56b72877c1cb
child 61 e1d68407ed06
equal deleted inserted replaced
-1:000000000000 0:56b72877c1cb
       
     1 /*
       
     2 * Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Notifications from HotSpot Server to HSS management.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HSSSRVNOTIFICATIONS_H
       
    20 #define HSSSRVNOTIFICATIONS_H
       
    21 
       
    22 #include "hssinterface.h"
       
    23 #include <wlanmgmtcommon.h>
       
    24 #include <wlanmgmtinterface.h>
       
    25 
       
    26 class RHssInterface;
       
    27 
       
    28 
       
    29 /**
       
    30 * MHssSrvNotifications specifies a callback interface for notification services.
       
    31 * These virtual methods should be implemented by HSS management if it
       
    32 * needs any notifications.
       
    33 */
       
    34 class MHssSrvNotifications
       
    35 {
       
    36    public:
       
    37 
       
    38         /**
       
    39         * New networks have been detected during scan.
       
    40         *
       
    41         * @param aIapId ID of the IAP.
       
    42         */
       
    43         virtual void NewNetworksDetected( TUint /*aIapId*/ ) {};
       
    44 
       
    45         /**
       
    46         * One or more networks have been lost since the last scan.
       
    47         *
       
    48         * @param aIapId ID of the IAP.
       
    49         */
       
    50         virtual void OldNetworksLost( TUint /*aIapId*/ ) {};
       
    51         
       
    52         virtual void WlanConnModeNotConnected() {};
       
    53 };
       
    54     
       
    55 /**
       
    56 * Notifications' data.
       
    57 */
       
    58 const TUint KHssMaxNotificationLength  = 128;   // Max data length for notification data.
       
    59 
       
    60 /**
       
    61 * HSS package data for notifications.
       
    62 */
       
    63 struct THssPckgData
       
    64     {
       
    65     TBuf8<KHssMaxNotificationLength> data;
       
    66     };
       
    67 
       
    68 /**
       
    69 * CHssSrvNotifications offers the notification service.
       
    70 * Active object that waits notifications from server.
       
    71 */
       
    72 NONSHARABLE_CLASS( CHssSrvNotifications ) : public CActive
       
    73     {
       
    74     public: // Methods
       
    75 
       
    76         // Constructors and destructor
       
    77         
       
    78         /**
       
    79         * Destructor.
       
    80         */
       
    81         virtual ~CHssSrvNotifications();
       
    82         
       
    83         /**
       
    84         * Create and activate notification service.
       
    85         * @note The notification service is activated in this call.
       
    86         * @param aCallback Callback interface to forward notifications to
       
    87         *                  user process.
       
    88         * @param aServer   Interface to send requests to server.
       
    89         * @return Pointer to a new constructed CHssSrvNotifications object.
       
    90         */
       
    91         static CHssSrvNotifications* NewL( MHssSrvNotifications& aCallback, RHssInterface& aServer );
       
    92 
       
    93         /**
       
    94         * Change the callback interface
       
    95         * and activate notifications
       
    96         * @param aCallback New callback interface.
       
    97         */
       
    98         void Activate( MHssSrvNotifications& aCallback );
       
    99         
       
   100         /**
       
   101          * Sets the requests cancelled flag so that no new notification requests
       
   102          * are done once current notification is complete.
       
   103          */
       
   104         void SetCancelled();
       
   105 
       
   106     protected: // from CActive
       
   107         /**
       
   108         * (From CActive) Receive notification.
       
   109         */
       
   110         void RunL();
       
   111         
       
   112         /**
       
   113         * (From CActive) This is called by Cancel() of CActive framework.
       
   114         */
       
   115         void DoCancel();
       
   116 
       
   117     private:
       
   118         /** 
       
   119         * Constructor.
       
   120         * @param aCallback Callback interface to forward notifications to
       
   121         *                  application.
       
   122         * @param aServer   Interface to send requests to server.
       
   123         */
       
   124         CHssSrvNotifications(MHssSrvNotifications& aCallback, RHssInterface& aServer);
       
   125 
       
   126         /**
       
   127         * Second phase construction.
       
   128         */
       
   129         void ConstructL();
       
   130         
       
   131         /**
       
   132         * Notification query loop.
       
   133         */
       
   134         void WaitForNotifications();
       
   135 
       
   136     private:    // Members.
       
   137         /**
       
   138          * Callback interface to the client
       
   139          */
       
   140         MHssSrvNotifications* iCallback;
       
   141         /**
       
   142          * Interface to send messages to the server
       
   143          */
       
   144         RHssInterface& iServer;
       
   145         /**
       
   146          * Return data value from server for the asynchronous messages
       
   147          */
       
   148         THssPckgData iReturnData;
       
   149         /**
       
   150          * Data package for return data
       
   151          */
       
   152         TPckg<THssPckgData> iDataPckg;
       
   153         /**
       
   154          * Cancel has been requested
       
   155          */
       
   156         TBool iCancelRequested;
       
   157         
       
   158         /**
       
   159          * IapId for notifications
       
   160          */
       
   161         TUint iIapId;
       
   162    };    
       
   163 #endif // HSSSRVNOTIFICATIONS_H