services/terminalmodeservice/src/upnptmserverdeviceinfo.cpp
branchRCL_3
changeset 9 5c72fd91570d
equal deleted inserted replaced
5:8116cc943311 9:5c72fd91570d
       
     1 /**
       
     2 * Copyright (c) 2010 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: CUpnpTmServerDeviceInfo class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 //  Include Files  
       
    19 #include "upnptmserverdeviceinfo.h"
       
    20 #include "OstTraceDefinitions.h"
       
    21 #ifdef OST_TRACE_COMPILER_IN_USE
       
    22 #include "upnptmserverdeviceinfoTraces.h"
       
    23 #endif
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===================================
       
    26 
       
    27 // ---------------------------------------------------------------------------------
       
    28 // CUpnpTmServerDeviceInfo::NewL
       
    29 // Two-phased constructor.
       
    30 // @param aIapId    IAP ID.
       
    31 // ---------------------------------------------------------------------------------
       
    32 //
       
    33 EXPORT_C CUpnpTmServerDeviceInfo* CUpnpTmServerDeviceInfo::NewL( TUint32 aIapId )
       
    34     {
       
    35     OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_NEWL_ENTRY );
       
    36     CUpnpTmServerDeviceInfo* self = new (ELeave) CUpnpTmServerDeviceInfo(  );  
       
    37     CleanupStack::PushL(self);
       
    38     self->ConstructL( aIapId );
       
    39     CleanupStack::Pop(self);
       
    40     OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_NEWL_EXIT );
       
    41     return self;
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------------
       
    45 // CUpnpTmServerDeviceInfo::CUpnpTmServerDeviceInfo
       
    46 // C++ default constructor can NOT contain any code, that
       
    47 // might leave.
       
    48 // ---------------------------------------------------------------------------------
       
    49 //
       
    50 CUpnpTmServerDeviceInfo::CUpnpTmServerDeviceInfo( ):iDeviceInfo(NULL),
       
    51     iBtAddr(NULL),iStartConnValue(EFalse)
       
    52     {
       
    53 
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------------
       
    57 // CUpnpTmServerDeviceInfo::ConstructL
       
    58 // Symbian 2nd phase constructor can leave.
       
    59 // @param aIapId    IAP ID. Leaves if the proper IAP ID is not set.
       
    60 // ---------------------------------------------------------------------------------
       
    61 //
       
    62 void CUpnpTmServerDeviceInfo::ConstructL( TUint32 aIapId )
       
    63     {
       
    64     OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_CONSTRUCTL_ENTRY );
       
    65     OstTrace1( TRACE_NORMAL, CUPNPTMSERVERDEVICEINFO_CONSTRUCTL, "CUpnpTmServerDeviceInfo::ConstructL;aIapId=%d", aIapId );
       
    66     
       
    67     if ( aIapId <= KErrNone )
       
    68         {
       
    69         User::Leave( KErrArgument );  // Leaves in case of invalid IAP ID
       
    70         }
       
    71     iIapId = aIapId;   
       
    72     OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_CONSTRUCTL_EXIT );
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------------
       
    76 // CUpnpTmServerDeviceInfo::~CUpnpTmServerDeviceInfo
       
    77 // Destructor
       
    78 // ---------------------------------------------------------------------------------
       
    79 //
       
    80 CUpnpTmServerDeviceInfo::~CUpnpTmServerDeviceInfo()
       
    81     {
       
    82     OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_CUPNPTMSERVERDEVICEINFO_ENTRY );
       
    83     delete iDeviceInfo;
       
    84     delete iBtAddr;
       
    85     iDeviceIconList.ResetAndDestroy();
       
    86     iDeviceIconList.Close();
       
    87     OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_CUPNPTMSERVERDEVICEINFO_EXIT );
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------------
       
    91 // CUpnpTmServerDeviceInfo::SetDeviceInfoL
       
    92 // Method is used to provide Nokia specific additional info about the device
       
    93 // @param aDeviceInfo    XML formatted buffer containg deviceInfo element.
       
    94 // -------------------------------------------------------------------------------------
       
    95 //
       
    96 EXPORT_C void CUpnpTmServerDeviceInfo::SetDeviceInfoL( const TDesC8& aDeviceInfo )
       
    97     {
       
    98     OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_SETDEVICEINFOL_ENTRY );
       
    99     delete iDeviceInfo;
       
   100     iDeviceInfo = NULL;
       
   101     iDeviceInfo = aDeviceInfo.AllocL();   
       
   102     OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_SETDEVICEINFOL_EXIT );
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------------------------------
       
   106 // CUpnpTmServerDeviceInfo::SetBtAddressL
       
   107 // Method is used to set bluetooth MAC address of the device
       
   108 // @param aBtAddress   BT MAC address
       
   109 // ---------------------------------------------------------------------------------
       
   110 //
       
   111 EXPORT_C void CUpnpTmServerDeviceInfo::SetBtAddressL( const TDesC8& aBtAddress )
       
   112     {
       
   113     OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_SETBTADDRESSL_ENTRY );
       
   114     delete iBtAddr;
       
   115     iBtAddr = NULL;
       
   116     iBtAddr = aBtAddress.AllocL();
       
   117     OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_SETBTADDRESSL_EXIT );
       
   118     }
       
   119 
       
   120 // ---------------------------------------------------------------------------------
       
   121 // CUpnpTmServerDeviceInfo::AddDeviceIconL
       
   122 // Method is used to provide device icon information.
       
   123 // @param aDeviceIcon   Pointer to the Terminal Mode Icon object.
       
   124 //                      Ownership of the object is passed.
       
   125 // ---------------------------------------------------------------------------------
       
   126 //
       
   127 EXPORT_C void CUpnpTmServerDeviceInfo::AddDeviceIconL( CUpnpTerminalModeIcon* aDeviceIcon )
       
   128     {
       
   129     OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_ADDDEVICEICONL_ENTRY );
       
   130     iDeviceIconList.AppendL(aDeviceIcon);
       
   131     OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_ADDDEVICEICONL_EXIT );
       
   132     }
       
   133 
       
   134 // End of File