datacommsserver/esockserver/ssock/ss_mobility_apiext.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 1997-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 
       
    20 #include "ss_mobility_apiext.h"
       
    21 #include <comms-infras/mobilitymessagesecom.h>
       
    22 #include <elements/responsemsg.h>
       
    23 
       
    24 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    25 #include <comms-infras/ss_mobility_apiext_internal.h>
       
    26 #endif
       
    27 
       
    28 #ifdef _DEBUG
       
    29 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
       
    30 // (if it could happen through user error then you should give it an explicit, documented, category + code)
       
    31 _LIT(KSpecAssert_ESockSSocksmblty, "ESockSSocksmblty");
       
    32 #endif
       
    33 
       
    34 using namespace ESock;
       
    35 using namespace Elements;
       
    36 
       
    37 CCommsMobilitySrvResp::~CCommsMobilitySrvResp()
       
    38 	{
       
    39 	}
       
    40 
       
    41 CCommsMobilitySrvResp::CCommsMobilitySrvResp()
       
    42 :	CCommsApiExtResponder()
       
    43 	{
       
    44 	}
       
    45 
       
    46 EXPORT_C void CCommsMobilitySrvResp::PreferredCarrierAvailable(CCommsMobilitySrvResp*& aThis, TAccessPointInfo aOldAP, TAccessPointInfo aNewAP, TBool aIsUpgrade, TBool aIsSeamless)
       
    47 	{
       
    48 	if (aThis == NULL)
       
    49 	    return;
       
    50 
       
    51 	aThis->DoPreferredCarrierAvailable(aOldAP, aNewAP, aIsUpgrade, aIsSeamless);
       
    52 
       
    53 	delete aThis;
       
    54 	aThis = NULL;
       
    55 	}
       
    56 
       
    57 EXPORT_C void CCommsMobilitySrvResp::NewCarrierActive(CCommsMobilitySrvResp*& aThis, TAccessPointInfo aNewAP, TBool aIsSeamless)
       
    58 	{
       
    59 	if (aThis == NULL)
       
    60 	    return;
       
    61 
       
    62 	aThis->DoNewCarrierActive(aNewAP, aIsSeamless);
       
    63 
       
    64 	delete aThis;
       
    65 	aThis = NULL;
       
    66 	}
       
    67 
       
    68 EXPORT_C void CCommsMobilitySrvResp::Error(CCommsMobilitySrvResp*& aThis, TInt aError)
       
    69 	{
       
    70 	CCommsApiExtResponder* responder = aThis;
       
    71     CCommsApiExtResponder::Complete(responder, aError);
       
    72 	aThis = NULL;
       
    73 	}
       
    74 
       
    75 EXPORT_C CCommsMobilitySrvIpcResponder* CCommsMobilitySrvIpcResponder::NewL(Elements::RResponseMsg& aResponseMsg)
       
    76 	{
       
    77 	return new (ELeave) CCommsMobilitySrvIpcResponder(aResponseMsg);
       
    78 	}
       
    79 
       
    80 CCommsMobilitySrvIpcResponder::CCommsMobilitySrvIpcResponder(Elements::RResponseMsg& aResponseMsg)
       
    81 :	CCommsMobilitySrvResp(),
       
    82 	iResponseMsg(aResponseMsg)
       
    83 	{
       
    84 	}
       
    85 
       
    86 CCommsMobilitySrvIpcResponder::~CCommsMobilitySrvIpcResponder()
       
    87 	{
       
    88 	delete iMsg;
       
    89 	}
       
    90 
       
    91 EXPORT_C void CCommsMobilitySrvIpcResponder::DoPreferredCarrierAvailable(TAccessPointInfo aOldAP, TAccessPointInfo aNewAP, TBool aIsUpgrade, TBool aIsSeamless)
       
    92 	{
       
    93 	__ASSERT_DEBUG(iMsg == NULL, User::Panic(KSpecAssert_ESockSSocksmblty, 1));
       
    94 	TRAP_IGNORE(iMsg = CPreferredCarrierAvailable::NewL()); //we could make it in place, no TRAP
       
    95 
       
    96     if (iMsg == NULL)
       
    97     	{
       
    98     	iResponseMsg.Complete(KErrNoMemory);
       
    99     	return;
       
   100     	}
       
   101 
       
   102 	CPreferredCarrierAvailable& msg = reinterpret_cast<CPreferredCarrierAvailable&>(*iMsg);
       
   103 	
       
   104 	msg.SetOldAPInfo(aOldAP);
       
   105 	msg.SetNewAPInfo(aNewAP);
       
   106 	msg.SetIsUpgrade(aIsUpgrade);
       
   107 	msg.SetIsSeamless(aIsSeamless);
       
   108 
       
   109 	iResponseMsg.Complete(msg);
       
   110 	}
       
   111 
       
   112 EXPORT_C void CCommsMobilitySrvIpcResponder::DoNewCarrierActive(TAccessPointInfo aNewAP, TBool aIsSeamless)
       
   113 	{
       
   114 	__ASSERT_DEBUG(iMsg == NULL, User::Panic(KSpecAssert_ESockSSocksmblty, 2));
       
   115 	TRAP_IGNORE(iMsg = CNewCarrierActive::NewL()); //we could make it in place, no TRAP
       
   116 
       
   117     if (iMsg == NULL)
       
   118     	{
       
   119     	iResponseMsg.Complete(KErrNoMemory);
       
   120     	return;
       
   121     	}
       
   122 
       
   123 	CNewCarrierActive& msg = reinterpret_cast<CNewCarrierActive&>(*iMsg);
       
   124 
       
   125 	msg.SetNewAPInfo(aNewAP);
       
   126 	msg.SetIsSeamless(aIsSeamless);
       
   127 
       
   128 	iResponseMsg.Complete(msg);
       
   129 	}
       
   130 
       
   131 void CCommsMobilitySrvIpcResponder::DoComplete(TInt aError)
       
   132 	{
       
   133 	iResponseMsg.Complete(aError);
       
   134 	}
       
   135