telephonyserverplugins/multimodetsy/Multimode/gprs/GprsNotify.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Gprs Notifications
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "GprsNotify.h"
       
    19 #include "mSLOGGER.H"
       
    20 #include "Matstd.h"
       
    21 #include "gprs.h"
       
    22 #include "Gprscontext.h"
       
    23 #include "gprsqos.h"
       
    24 
       
    25 /**
       
    26  * @file
       
    27  * This file implements all CGprs and CGprsContext notifications
       
    28  */
       
    29 
       
    30 CGprsContextAddedNotify* CGprsContextAddedNotify::NewL(TTsyReqHandle aReqHandle,CTelObject* aTelObject,TDes* aContextId)
       
    31 /**
       
    32  * Leavable constructor.
       
    33  * @param aReqHandle Handle to client.
       
    34  * @param aTelObject Owner object.
       
    35  * @param aContextId Client pointer to notification information.
       
    36  */
       
    37 	{
       
    38 	return new(ELeave) CGprsContextAddedNotify(aReqHandle,aTelObject,aContextId);
       
    39 	}
       
    40 
       
    41 CGprsContextAddedNotify::CGprsContextAddedNotify(TTsyReqHandle aReqHandle,CTelObject* aTelObject,TDes* aContextId)
       
    42 : CNotifyBase(aReqHandle,aTelObject), iContextId(aContextId)
       
    43 /**
       
    44  * Constructor.
       
    45  * @param aReqHandle Handle to client.
       
    46  * @param aTelObject Owner object.
       
    47  * @param aContextId Client pointer to notification information.
       
    48  */
       
    49 	{}
       
    50 
       
    51 
       
    52 CGprsContextAddedNotify::~CGprsContextAddedNotify()
       
    53 /**
       
    54  * Destructor.
       
    55  */
       
    56 	{}
       
    57 
       
    58 
       
    59 TBool CGprsContextAddedNotify::CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent /*aLastEvent*/)
       
    60 /**
       
    61  * This function completes a context added Notification.
       
    62  * @param aTelObject Owner pointer.
       
    63  * @param aEvent The notification event.
       
    64  * @param aLastEvent previous event.
       
    65  */
       
    66 	{
       
    67 	if (aEvent==EPacketContextAddedChanged && aTelObject == iTelObject)
       
    68 		{
       
    69 		LOGTEXT2(_L8("CGprsContextAddedNotify Notification completed"),aEvent);
       
    70 		iContextId->Copy(*((CGprs*)iTelObject)->NameOfLastAddedContext());
       
    71 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
    72 		return ETrue;
       
    73 		}
       
    74 	return EFalse;
       
    75 	}
       
    76 
       
    77 
       
    78 // class  CGprsStatusNotify definitions
       
    79 
       
    80 CGprsStatusNotify* CGprsStatusNotify::NewL(TTsyReqHandle aReqHandle,CTelObject* aTelObject,RPacketService::TStatus* aGprsStatus)
       
    81 /**
       
    82  * Leavable constructor.
       
    83  * @param aReqHandle Handle to client.
       
    84  * @param aTelObject Owner object.
       
    85  * @param aContextId Client pointer to notification information.
       
    86  */
       
    87 	{
       
    88 	return new(ELeave) CGprsStatusNotify(aReqHandle,aTelObject,aGprsStatus);
       
    89 	}
       
    90 
       
    91 
       
    92 CGprsStatusNotify::CGprsStatusNotify(TTsyReqHandle aReqHandle,CTelObject* aTelObject,RPacketService::TStatus* aGprsStatus)
       
    93 : CNotifyBase(aReqHandle,aTelObject), iGprsStatus(aGprsStatus)
       
    94 /**
       
    95  * Constructor.
       
    96  * @param aReqHandle Handle to client.
       
    97  * @param aTelObject Owner object.
       
    98  * @param aContextId Client pointer to notification information.
       
    99  */
       
   100 	{}
       
   101 
       
   102 
       
   103 CGprsStatusNotify::~CGprsStatusNotify()
       
   104 /**
       
   105  * Destructor.
       
   106  */
       
   107 	{}
       
   108 
       
   109 
       
   110 TBool CGprsStatusNotify::CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent /*aLastEvent*/)
       
   111 /**
       
   112  * This function completes a GPRS status changed Notification.
       
   113  * @param aTelObject Owner pointer.
       
   114  * @param aEvent The notification event.
       
   115  * @param aLastEvent previous event.
       
   116  */
       
   117 	{
       
   118 	if (aEvent==EPacketStatusChanged && aTelObject == iTelObject)
       
   119 		{
       
   120 		LOGTEXT2(_L8("CGprsStatusNotify Notification completed"),aEvent);
       
   121 		*iGprsStatus = ((CGprs*)iTelObject)->Status();
       
   122 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   123 		return ETrue;
       
   124 		}
       
   125 	return EFalse;
       
   126 	}
       
   127 
       
   128 
       
   129 
       
   130 CGprsContextConfigNotify* CGprsContextConfigNotify::NewL(TTsyReqHandle aReqHandle,CTelObject* aTelObject,TDes8* aConfig)
       
   131 /**
       
   132  * Leavable constructor.
       
   133  * @param aReqHandle Handle to client.
       
   134  * @param aTelObject Owner object.
       
   135  * @param aContextId Client pointer to notification information.
       
   136  */
       
   137 	{
       
   138 	return new(ELeave) CGprsContextConfigNotify(aReqHandle,aTelObject,aConfig);
       
   139 	}
       
   140 
       
   141 
       
   142 CGprsContextConfigNotify::CGprsContextConfigNotify(TTsyReqHandle aReqHandle,CTelObject* aTelObject,TDes8* aConfig)
       
   143 : CNotifyBase(aReqHandle,aTelObject), iConfig(aConfig)
       
   144 /**
       
   145  * Constructor.
       
   146  * @param aReqHandle Handle to client.
       
   147  * @param aTelObject Owner object.
       
   148  * @param aContextId Client pointer to notification information.
       
   149  */
       
   150 	{}
       
   151 
       
   152 
       
   153 CGprsContextConfigNotify::~CGprsContextConfigNotify()
       
   154 /**
       
   155  * Destructor.
       
   156  */
       
   157 	{}
       
   158 
       
   159 
       
   160 TBool CGprsContextConfigNotify::CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent /*aLastEvent*/)
       
   161 /**
       
   162  * This function completes a context configuration changed Notification.
       
   163  * @param aTelObject Owner pointer.
       
   164  * @param aEvent The notification event.
       
   165  * @param aLastEvent previous event.
       
   166  */
       
   167 	{
       
   168 	if (aEvent==EPacketContextConfigChanged && aTelObject == iTelObject)
       
   169 		{
       
   170 		LOGTEXT2(_L8("CGprsContextConfigNotify Notification completed"),aEvent);
       
   171 		TPckg<RPacketContext::TContextConfigGPRS>* contextConfigV1Pckg = (TPckg<RPacketContext::TContextConfigGPRS>*)iConfig;
       
   172 		RPacketContext::TContextConfigGPRS& iContextConfigGPRS = (*contextConfigV1Pckg)();
       
   173 		iContextConfigGPRS =  *((CGprsContext*)iTelObject)->Config();
       
   174 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   175 		return ETrue;
       
   176 		}
       
   177 	return EFalse;
       
   178 	}
       
   179 
       
   180 
       
   181 
       
   182 // class  CGprsContextStatusNotify definitions
       
   183 
       
   184 CGprsContextStatusNotify* CGprsContextStatusNotify::NewL(TTsyReqHandle aReqHandle,CTelObject* aTelObject,RPacketContext::TContextStatus* aContextStatus)
       
   185 /**
       
   186  * Leavable constructor.
       
   187  * @param aReqHandle Handle to client.
       
   188  * @param aTelObject Owner object.
       
   189  * @param aContextId Client pointer to notification information.
       
   190  */
       
   191 	{
       
   192 	return new(ELeave) CGprsContextStatusNotify(aReqHandle,aTelObject,aContextStatus);
       
   193 	}
       
   194 
       
   195 
       
   196 CGprsContextStatusNotify::CGprsContextStatusNotify(TTsyReqHandle aReqHandle,CTelObject* aTelObject,RPacketContext::TContextStatus* aContextStatus)
       
   197 : CNotifyBase(aReqHandle,aTelObject), iContextStatus(aContextStatus)
       
   198 /**
       
   199  * Constructor.
       
   200  * @param aReqHandle Handle to client.
       
   201  * @param aTelObject Owner object.
       
   202  * @param aContextId Client pointer to notification information.
       
   203 
       
   204  */
       
   205 	{}
       
   206 
       
   207 
       
   208 CGprsContextStatusNotify::~CGprsContextStatusNotify()
       
   209 /**
       
   210  * Destructor.
       
   211  */
       
   212 
       
   213 	{}
       
   214 
       
   215 
       
   216 TBool CGprsContextStatusNotify::CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent /*aLastEvent*/)
       
   217 /**
       
   218  * This function completes a context status changed Notification.
       
   219  * @param aTelObject Owner pointer.
       
   220  * @param aEvent The notification event.
       
   221  * @param aLastEvent previous event.
       
   222  */
       
   223 	{
       
   224 	if (aEvent==EPacketContextStatusChanged  && aTelObject == iTelObject)
       
   225 		{
       
   226 		LOGTEXT2(_L8("CGprsContextStatusNotify Notification completed"),aEvent);
       
   227 		*iContextStatus = ((CGprsContext*)iTelObject)->ContextInfo()->iStatus;
       
   228 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   229 		return ETrue;
       
   230 		}
       
   231 	return EFalse;
       
   232 	}
       
   233 
       
   234 
       
   235 CGprsQoSProfileNotify* CGprsQoSProfileNotify::NewL(TTsyReqHandle aReqHandle,CTelObject* aTelObject,TDes8* aProfile)
       
   236 /**
       
   237  * Leavable constructor.
       
   238  * @param aReqHandle Handle to client.
       
   239  * @param aTelObject Owner object.
       
   240  * @param aProfile Client pointer to notification information.
       
   241  */
       
   242 	{
       
   243 	return new(ELeave) CGprsQoSProfileNotify(aReqHandle,aTelObject,aProfile);
       
   244 	}
       
   245 
       
   246 
       
   247 CGprsQoSProfileNotify::CGprsQoSProfileNotify(TTsyReqHandle aReqHandle,CTelObject* aTelObject,TDes8* aProfile)
       
   248 : CNotifyBase(aReqHandle,aTelObject), iProfile(aProfile)
       
   249 /**
       
   250  * Constructor.
       
   251  * @param aReqHandle Handle to client.
       
   252  * @param aTelObject Owner object.
       
   253  * @param aProfile Client pointer to notification information.
       
   254  */
       
   255 	{}
       
   256 
       
   257 
       
   258 CGprsQoSProfileNotify::~CGprsQoSProfileNotify()
       
   259 /**
       
   260  * Destructor.
       
   261  */
       
   262 	{}
       
   263 
       
   264 
       
   265 TBool CGprsQoSProfileNotify::CheckAndCompleteNotification(CTelObject* aTelObject,TEvent aEvent,TEvent /*aLastEvent*/)
       
   266 /**
       
   267  * This function completes a context configuration changed Notification.
       
   268  * @param aTelObject Owner pointer.
       
   269  * @param aEvent The notification event.
       
   270  * @param aLastEvent previous event.
       
   271  */
       
   272 	{
       
   273 	if (aEvent==EPacketQoSProfileChanged && aTelObject == iTelObject)
       
   274 		{
       
   275 		LOGTEXT2(_L8("CGprsQoSProfileNotify Notification completed"),aEvent);
       
   276 
       
   277 		TPckg<RPacketQoS::TQoSGPRSRequested>* qosProfilePckg = (TPckg<RPacketQoS::TQoSGPRSRequested>*) iProfile;
       
   278 		RPacketQoS::TQoSGPRSRequested& iQoSProfileGPRS = (*qosProfilePckg)();
       
   279 		iQoSProfileGPRS =	*((CGprsQoS*)iTelObject)->GetReqQoSProfile();
       
   280 
       
   281 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   282 		return ETrue;
       
   283 		}
       
   284 	return EFalse;
       
   285 	}
       
   286 
       
   287 
       
   288 //
       
   289 // Implementation of CGprsNtwkRegStatusChangeNotify is below
       
   290 //
       
   291 
       
   292 CGprsNtwkRegStatusChangeNotify* CGprsNtwkRegStatusChangeNotify::NewL(TTsyReqHandle aReqHandle,CTelObject* aTelObject,RPacketService::TRegistrationStatus* aRegStatus)
       
   293 /** Factory function */
       
   294  	{
       
   295 	return new(ELeave) CGprsNtwkRegStatusChangeNotify(aReqHandle,aTelObject,aRegStatus);
       
   296 	}
       
   297 
       
   298 CGprsNtwkRegStatusChangeNotify::CGprsNtwkRegStatusChangeNotify(TTsyReqHandle aReqHandle,CTelObject* aTelObject,RPacketService::TRegistrationStatus* aRegStatus)	
       
   299 	: CNotifyBase(aReqHandle,aTelObject),
       
   300 	  iRegStatus(aRegStatus)
       
   301 /** C++ constructor */
       
   302  	{}
       
   303 
       
   304 TBool CGprsNtwkRegStatusChangeNotify::CheckAndCompleteNotification(CTelObject* aTelObject, TNotifications aNotification)
       
   305 /**
       
   306  * This function completes a context configuration changed Notification.
       
   307  */
       
   308  	{
       
   309 	if (aNotification==EPacketNtwkRegStatusChange && aTelObject==iTelObject)
       
   310 		{
       
   311 		LOGTEXT2(_L8("CGprsNtwkRegStatusChangeNotify Notification completed"),aNotification);
       
   312 		*iRegStatus = ((CGprs*)iTelObject)->RegistrationStatus();
       
   313 		iTelObject->ReqCompleted(iReqHandle,KErrNone);
       
   314 		return ETrue;
       
   315 		}
       
   316 	return EFalse;
       
   317 	}
       
   318 
       
   319 
       
   320 
       
   321 
       
   322 
       
   323