webservices/wsnotifierplugins/inc/sennotplugindlg.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:        This is common interface for notifier plug-in, which supports
       
    15 *                UI dialogs for WSF. This interface is used by clients 
       
    16 *                and plug-in implementation.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 #ifndef __SENNOTIFIERPLUGINDIALOG_H__
       
    28 #define __SENNOTIFIERPLUGINDIALOG_H__
       
    29 
       
    30 // INCLUDES
       
    31 #include <e32std.h>
       
    32 
       
    33 // CONSTANTS
       
    34 #ifndef RD_SEN_COMPILE_SIS_PACKAGE_FILES
       
    35 const TUid KSenNotifierPluginUID     = { 0x101F9764 };
       
    36 #else
       
    37 const TUid KSenNotifierPluginUID     = { 0x101F9743 };
       
    38 #endif
       
    39 
       
    40 const TInt KSenMaxUsernameLength = 32;
       
    41 const TInt KSenMaxPasswordLength = 16;
       
    42 const TInt KSenPluginMsgDataMaxSize = 1024;
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 /**
       
    47 * Class TSenNotPluginMessage
       
    48 * Base class for fixed sized messages transferred between client and plug-in
       
    49 * notifier implementation.
       
    50 * This owns container buffer, which holds simple object types
       
    51 * This is used internally.
       
    52 */
       
    53 class TSenNotPluginMessage
       
    54     {
       
    55     protected:
       
    56 
       
    57         /**
       
    58         * Types of objects, which this container can hold
       
    59         */
       
    60         enum TObjectType
       
    61         {
       
    62         E8BitDescriptor = 0, // Not currently supported
       
    63         E16BitDescriptor,
       
    64         EInt32
       
    65         };
       
    66         
       
    67         // New functions
       
    68         
       
    69         /**
       
    70         *  Serialize 16-bit buffer in the format <E16BitDescriptor><length><data>
       
    71         *  The data is appended to iData.
       
    72         *  Caller is responsible for making sure iData has enough space.
       
    73         */
       
    74         void AppendBuf16(const TDesC& aBuf);
       
    75 
       
    76         /**
       
    77         *  Serialize 32 bit integer in the format <EInt32><value>
       
    78         *  The data is appended to iData;
       
    79         *  Caller is responsible for making sure iData has enough space.
       
    80         */
       
    81         void AppendInt32(TInt32 aInt32);
       
    82 
       
    83         /**
       
    84         *  Get 16-bit descriptor from known index. It is callers responsibility to
       
    85         *  know that given index contains 16-bit buffer object.
       
    86         */
       
    87         TPtrC16 GetBuf16(TInt aIndex) const;
       
    88 
       
    89         /**
       
    90         *  Get 32-bit integer object from known index. It is callers
       
    91         *  responsibility to know that given index contains 32-bit integer object.
       
    92         */
       
    93         TInt32 GetInt32(TInt aIndex) const;
       
    94 
       
    95     private: // New functions
       
    96 
       
    97         /**
       
    98         *  Calculate byte size of 32-bit integer object in this container.
       
    99         */
       
   100         TInt Int32ObjectSize() const;
       
   101 
       
   102         /**
       
   103         *  Calculate byte size of 16-bit descriptor object in this container.
       
   104         *  The aObjectStart must point to valid area within iData.
       
   105         */
       
   106         TInt Buf16ObjectSize(TUint8 *aObjectStart) const;
       
   107 
       
   108         /**
       
   109         *  Find pointer to next object within iData. The aObjectStart must point
       
   110         *  to a valid object within iData.
       
   111         */
       
   112         TUint8* NavigatePointerToNextObjext(TUint8* aObjectStart) const;
       
   113 
       
   114     protected: // Data
       
   115         TBuf8<KSenPluginMsgDataMaxSize> iData;
       
   116     };
       
   117 
       
   118 /**
       
   119 * Class TSenNotPluginRequest
       
   120 * Base class for fixed sized requests transferred between client and plug-in
       
   121 * notifier implementation.
       
   122 * This is used internally. This should not be instantiated by the clients.
       
   123 */
       
   124 class TSenNotPluginRequest : public TSenNotPluginMessage
       
   125     {
       
   126     public:
       
   127 
       
   128         /**
       
   129         *  List of supported functionalities in plug-in implementation
       
   130         */
       
   131         enum TSenNotPluginMethod
       
   132         {
       
   133         ENoMethod,
       
   134         EAuthenticationDlg,
       
   135         EAllowRegisterDlg,
       
   136         EAllowUnRegisterDlg,
       
   137         EAskSaveDlg
       
   138         };
       
   139             
       
   140         // New functions
       
   141 
       
   142         IMPORT_C TSenNotPluginRequest();
       
   143 
       
   144         /**
       
   145         *  Request method (TSenPluginMethod)
       
   146         */
       
   147         IMPORT_C TInt Method();
       
   148 
       
   149         /**
       
   150         *  Default constructor.
       
   151         */
       
   152         IMPORT_C TSenNotPluginRequest(TInt aMethod);
       
   153 
       
   154     protected: // Data
       
   155         TInt iMethod; // see TSenPluginMethod
       
   156     };
       
   157 
       
   158 /**
       
   159 * Class TSenNotPluginResponse
       
   160 * Base class for fixed sized responses transferred between client and plug-in
       
   161 * notifier implementation.
       
   162 * This is used internally. This should not be instantiated by the clients.
       
   163 */
       
   164 class TSenNotPluginResponse : public TSenNotPluginMessage
       
   165     {
       
   166     };
       
   167 
       
   168 /**
       
   169 * Class TAuthenticationDlgRequest
       
   170 * Concrete public class for sending authentication dialog request to notifier
       
   171 * plug-in.
       
   172 * Notifier will show username/password dialog supporting also Save password
       
   173 * check box.
       
   174 * This is typically packaged to TPckgBuf and used as follows:
       
   175 *      RNotifier iNotifier;
       
   176 *      TPckgBuf<TAuthenticationDlgRequest> iRequest;
       
   177 *      TPckgBuf<TAuthenticationDlgResponse> iResponse;
       
   178 *      ...
       
   179 *      iNotifier.Connect();
       
   180 *      ...
       
   181 *      TRequestStatus status; // typically iStatus of CActive
       
   182 *      iNotifier.StartNotifierAndGetResponse(status, KSenNotifierPluginUID,
       
   183 *          request, response);
       
   184 *      User::WaitForRequest(status);
       
   185 *      if(status == KErrNone && iResponse().OkButtonPressed())
       
   186 *          ...
       
   187 *      ...
       
   188 *      iNotifier.Close();
       
   189 *
       
   190 * See also TAuthenticationDlgResponse
       
   191 */
       
   192 class TAuthenticationDlgRequest : public TSenNotPluginRequest
       
   193     {
       
   194     public: // New functions
       
   195 
       
   196         /**
       
   197         *  Default constructor.
       
   198         *  Username and password fields will be empty and Save password checkbox
       
   199         *  will be unchecked.
       
   200         */
       
   201         IMPORT_C TAuthenticationDlgRequest();
       
   202 
       
   203         /**
       
   204         *  Set request data.
       
   205         *  Username and password must not exceed KSenMaxUsernameLength and
       
   206         *  KSenMaxPasswordLength respectively.
       
   207         *  This will fill the iData in base class.
       
   208         */
       
   209         IMPORT_C TInt SetData(const TDesC& aUsername, const TDesC& aPassword);
       
   210 
       
   211         /**
       
   212         *  Get view to username value.
       
   213         */
       
   214         IMPORT_C TPtrC16 Username() const;
       
   215 
       
   216         /**
       
   217         *  Get view to password value
       
   218         */
       
   219         IMPORT_C TPtrC16 Password() const;
       
   220     };
       
   221 
       
   222 /**
       
   223 * Class TAuthenticationDlgResponse
       
   224 * Concrete public class for receiving authentication dialog response from
       
   225 * notifier plug-in.
       
   226 * See also usage in documentation of TAuthenticationDlgRequest
       
   227 */
       
   228 class TAuthenticationDlgResponse : public TSenNotPluginResponse
       
   229     {
       
   230     public: // New functions
       
   231 
       
   232         /**
       
   233         *  Default constructor.
       
   234         *  Username and password fields will be empty and Save password checkbox
       
   235         *  will be unchecked.
       
   236         */
       
   237         IMPORT_C TAuthenticationDlgResponse();
       
   238 
       
   239         /**
       
   240         *  Set response data. This is typically used by plug-in implemetation.
       
   241         *  Username and password must not exceed KSenMaxUsernameLength and
       
   242         *  KSenMaxPasswordLength respectively.
       
   243         *  This will fill the iData in base class.
       
   244         */
       
   245         IMPORT_C TInt SetData(const TDesC& aUsername, const TDesC& aPassword,
       
   246                               TBool aOkButtonPressed);
       
   247 
       
   248         /**
       
   249         *  Get view to username value.
       
   250         */
       
   251         IMPORT_C TPtrC16 Username() const;
       
   252 
       
   253         /**
       
   254         *  Get view to password value.
       
   255         */
       
   256         IMPORT_C TPtrC16 Password() const;
       
   257 
       
   258         /**
       
   259         *  Get info whether user pressed Ok or Cancel command button in the
       
   260         *  dialog.
       
   261         */
       
   262         IMPORT_C TBool OkButtonPressed() const;
       
   263     };
       
   264 
       
   265 
       
   266 /**
       
   267 * Class TAllowRegisterDlgRequest
       
   268 * Concrete public class for sending Yes/No query request to notifier
       
   269 * plug-in. Implementation will query user, if he/she will allow an application
       
   270 * to register as a web service.
       
   271 * This is typically packaged to TPckgBuf and used as follows:
       
   272 *      RNotifier iNotifier;
       
   273 *      TPckgBuf<TAllowRegisterDlgRequest> iRequest;
       
   274 *      TPckgBuf<TAllowRegisterDlgResponse> iResponse;
       
   275 *      ...
       
   276 *      iNotifier.Connect();
       
   277 *      ...
       
   278 *      TRequestStatus status; // typically iStatus of CActive
       
   279 *      iNotifier.StartNotifierAndGetResponse(status, KSenNotifierPluginUID,
       
   280 *          request, response);
       
   281 *      User::WaitForRequest(status);
       
   282 *      if(status == KErrNone && iResponse().OkButtonPressed())
       
   283 *          ...
       
   284 *      ...
       
   285 *      iNotifier.Close();
       
   286 */
       
   287 class TAllowRegisterDlgRequest: public TSenNotPluginRequest
       
   288     {
       
   289     public:
       
   290 
       
   291         /**
       
   292         *  Default constructor.
       
   293         */
       
   294         IMPORT_C TAllowRegisterDlgRequest();
       
   295     };
       
   296 
       
   297 /**
       
   298 * Class TAllowRegisterDlgResponse
       
   299 * Concrete public class for receiving Yes/No query result.
       
   300 * See also usage in documentation of TAllowRegisterDlgRequest
       
   301 */
       
   302 class TAllowRegisterDlgResponse : public TSenNotPluginResponse
       
   303     {
       
   304     public:
       
   305 
       
   306         /**
       
   307         *  Default constructor.
       
   308         */
       
   309         IMPORT_C TAllowRegisterDlgResponse();
       
   310 
       
   311         // New functions
       
   312         
       
   313         /**
       
   314         *  Set response data. This is typically used by plug-in implemetation.
       
   315         *  This will fill the iData in base class.
       
   316         */
       
   317         IMPORT_C void SetOkButton(TBool aValue);
       
   318 
       
   319         /**
       
   320         *  Get info whether user pressed Ok or Cancel command button in the
       
   321         *  dialog.
       
   322         */
       
   323         IMPORT_C TBool OkButtonPressed() const;
       
   324     };
       
   325 
       
   326 /**
       
   327 * Class TAllowUnRegisterDlgRequest
       
   328 * Concrete public class for sending Yes/No query request to notifier
       
   329 * plug-in. Implementation will query user, if he/she will allow an application
       
   330 * to unregister as a web service.
       
   331 * This is typically packaged to TPckgBuf and used as follows:
       
   332 *      RNotifier iNotifier;
       
   333 *      TPckgBuf<TAllowUnRegisterDlgRequest> iRequest;
       
   334 *      TPckgBuf<TAllowUnRegisterDlgResponse> iResponse;
       
   335 *      ...
       
   336 *      iNotifier.Connect();
       
   337 *      ...
       
   338 *      TRequestStatus status; // typically iStatus of CActive
       
   339 *      iNotifier.StartNotifierAndGetResponse(status, KSenNotifierPluginUID,
       
   340 *          request, response);
       
   341 *      User::WaitForRequest(status);
       
   342 *      if(status == KErrNone && iResponse().OkButtonPressed())
       
   343 *          ...
       
   344 *      ...
       
   345 *      iNotifier.Close();
       
   346 */
       
   347 class TAllowUnRegisterDlgRequest: public TSenNotPluginRequest
       
   348     {
       
   349     public:
       
   350 
       
   351         /**
       
   352         *  Default constructor.
       
   353         */
       
   354         IMPORT_C TAllowUnRegisterDlgRequest();
       
   355     };
       
   356 
       
   357 /**
       
   358 * Class TAllowUnRegisterDlgResponse
       
   359 * Concrete public class for receiving Yes/No query result.
       
   360 * See also usage in documentation of TAllowUnRegisterDlgRequest
       
   361 */
       
   362 class TAllowUnRegisterDlgResponse : public TSenNotPluginResponse
       
   363     {
       
   364     public:
       
   365 
       
   366         /**
       
   367         *  Default constructor.
       
   368         */
       
   369         IMPORT_C TAllowUnRegisterDlgResponse();
       
   370 
       
   371         // New functions
       
   372     
       
   373         /**
       
   374         *  Set response data. This is typically used by plug-in implemetation.
       
   375         *  This will fill the iData in base class.
       
   376         */
       
   377         IMPORT_C void SetOkButton(TBool aValue);
       
   378 
       
   379         /**
       
   380         *  Get info whether user pressed Ok or Cancel command button in the
       
   381         *  dialog.
       
   382         */
       
   383         IMPORT_C TBool OkButtonPressed() const;
       
   384     };
       
   385 
       
   386 /**
       
   387 * Class TAskSaveDlgRequest
       
   388 * Concrete public class for sending Yes/No query request to notifier
       
   389 * plug-in. Implementation will query user, if he/she will allow an application
       
   390 * to save username and password.
       
   391 * This is typically packaged to TPckgBuf and used as follows:
       
   392 *      RNotifier iNotifier;
       
   393 *      TPckgBuf<TAskSaveDlgRequest> iRequest;
       
   394 *      TPckgBuf<TAskSaveDlgResponse> iResponse;
       
   395 *      ...
       
   396 *      iNotifier.Connect();
       
   397 *      ...
       
   398 *      TRequestStatus status; // typically iStatus of CActive
       
   399 *      iNotifier.StartNotifierAndGetResponse(status, KSenNotifierPluginUID,
       
   400 *          request, response);
       
   401 *      User::WaitForRequest(status);
       
   402 *      if(status == KErrNone && iResponse().OkButtonPressed())
       
   403 *          ...
       
   404 *      ...
       
   405 *      iNotifier.Close();
       
   406 */
       
   407 class TAskSaveDlgRequest: public TSenNotPluginRequest
       
   408     {
       
   409     public:
       
   410 
       
   411         /**
       
   412         *  Default constructor.
       
   413         */
       
   414         IMPORT_C TAskSaveDlgRequest();
       
   415     };
       
   416 
       
   417 /**
       
   418 * Class TAskSaveDlgResponse
       
   419 * Concrete public class for receiving Yes/No query result.
       
   420 * See also usage in documentation of TAskSaveDlgRequest
       
   421 */
       
   422 class TAskSaveDlgResponse : public TSenNotPluginResponse
       
   423     {
       
   424     public:
       
   425 
       
   426         /**
       
   427         *  Default constructor.
       
   428         */
       
   429         IMPORT_C TAskSaveDlgResponse();
       
   430 
       
   431         // New functions
       
   432 
       
   433         /**
       
   434         *  Set response data. This is typically used by plug-in implemetation.
       
   435         *  This will fill the iData in base class.
       
   436         */
       
   437         IMPORT_C void SetOkButton(TBool aValue);
       
   438 
       
   439         /**
       
   440         *  Get info whether user pressed Ok or Cancel command button in the
       
   441         *  dialog.
       
   442         */
       
   443         IMPORT_C TBool OkButtonPressed() const;
       
   444     };
       
   445 
       
   446 #endif // __SENNOTIFIERPLUGINDIALOG_H__
       
   447 
       
   448 // End of File