mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropvalue.cpp
changeset 0 d0791faffa3f
child 15 f85613f12947
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-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 #include <mtp/cmtptypestring.h>
       
    17 #include <mtp/mmtpdataproviderframework.h>
       
    18 #include <mtp/mtpprotocolconstants.h>
       
    19 #include <mtp/tmtptyperequest.h>
       
    20 #include <mtp/tmtptypeuint8.h>
       
    21 #include <mtp/mmtpframeworkconfig.h>
       
    22 #include "cmtpdevicedatastore.h"
       
    23 #include "cmtpgetdevicepropvalue.h"
       
    24 #include "mtpdevicedpconst.h"
       
    25 #include "mtpdevdppanic.h"
       
    26 
       
    27 // Class constants.
       
    28 __FLOG_STMT(_LIT8(KComponent,"GetDevicePropValue");)
       
    29 
       
    30 /**
       
    31 Two-phase constructor.
       
    32 @param aPlugin  The data provider plugin
       
    33 @param aFramework The data provider framework
       
    34 @param aConnection The connection from which the request comes
       
    35 @return a pointer to the created request processor object.
       
    36 */  
       
    37 MMTPRequestProcessor* CMTPGetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection)
       
    38     {
       
    39     CMTPGetDevicePropValue* self = new (ELeave) CMTPGetDevicePropValue(aFramework, aConnection);
       
    40     CleanupStack::PushL(self);
       
    41     self->ConstructL();
       
    42     CleanupStack::Pop(self);
       
    43     return self;
       
    44     }
       
    45 
       
    46 /**
       
    47 Destructor.
       
    48 should not delete iMtpArray(ownership is belong to devicedatastore)
       
    49 */    
       
    50 CMTPGetDevicePropValue::~CMTPGetDevicePropValue()
       
    51     {
       
    52     __FLOG(_L8("~CMTPGetDevicePropValue - Entry"));
       
    53     delete iString;    
       
    54     delete iData;
       
    55     //ownership of the iMtpArray pointer is belongs to devicedatastore so it should not 
       
    56     //deleted.    
       
    57     __FLOG(_L8("~CMTPGetDevicePropValue - Exit"));
       
    58     __FLOG_CLOSE;
       
    59     }
       
    60 
       
    61 /**
       
    62 Constructor.
       
    63 */    
       
    64 CMTPGetDevicePropValue::CMTPGetDevicePropValue(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
       
    65     CMTPGetDevicePropDesc(aFramework, aConnection)
       
    66     {
       
    67     
       
    68     }
       
    69 
       
    70 /**
       
    71 Second-phase constructor.
       
    72 */
       
    73 void CMTPGetDevicePropValue::ConstructL()
       
    74     {
       
    75     __FLOG_OPEN(KMTPSubsystem, KComponent);
       
    76     __FLOG(_L8("ConstructL - Entry")); 
       
    77     CMTPGetDevicePropDesc::ConstructL();
       
    78     iString = CMTPTypeString::NewL();
       
    79     __FLOG(_L8("ConstructL - Exit")); 
       
    80     }
       
    81 
       
    82 /**
       
    83 Services the battery level property.
       
    84 */    
       
    85 void CMTPGetDevicePropValue::ServiceBatteryLevelL()
       
    86     {
       
    87     __FLOG(_L8("ServiceBatteryLevelL - Entry"));
       
    88     iBatteryLevel.Set(iBatteryLevelValue);
       
    89     SendDataL(iBatteryLevel);
       
    90     __FLOG(_L8("ServiceBatteryLevelL - Exit"));
       
    91     }
       
    92 
       
    93 /**
       
    94 Services the device friendly name property.
       
    95 */   
       
    96 void CMTPGetDevicePropValue::ServiceDeviceFriendlyNameL()
       
    97     {
       
    98     __FLOG(_L8("ServiceDeviceFriendlyNameL - Entry")); 
       
    99     iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyName());
       
   100     SendDataL(*iString);  
       
   101     __FLOG(_L8("ServiceDeviceFriendlyNameL - Exit"));   
       
   102     }
       
   103         
       
   104 /**
       
   105 Services the synchronisation partner property.
       
   106 */ 
       
   107 void CMTPGetDevicePropValue::ServiceSynchronisationPartnerL()
       
   108     {
       
   109     __FLOG(_L8("ServiceSynchronisationPartnerL - Entry")); 
       
   110     iString->SetL(iDpSingletons.DeviceDataStore().SynchronisationPartner());
       
   111     SendDataL(*iString);
       
   112     __FLOG(_L8("ServiceSynchronisationPartnerL - Exit"));
       
   113     }
       
   114 
       
   115 /**
       
   116 Services the ServiceSessionInitiatorVersionInfo property. 
       
   117 */ 
       
   118 void CMTPGetDevicePropValue::ServiceSessionInitiatorVersionInfoL()
       
   119    {
       
   120    __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Entry")); 
       
   121    iString->SetL(iDpSingletons.DeviceDataStore().SessionInitiatorVersionInfo());
       
   122    SendDataL(*iString);
       
   123    __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Exit"));
       
   124    }
       
   125 
       
   126 /**
       
   127 Services the ServicePerceivedDeviceType property. 
       
   128 */ 
       
   129 void CMTPGetDevicePropValue::ServicePerceivedDeviceTypeL()
       
   130    {
       
   131    __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Entry")); 
       
   132    iUint32.Set(iDpSingletons.DeviceDataStore().PerceivedDeviceType());
       
   133    SendDataL(iUint32);
       
   134    __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Exit"));
       
   135    }
       
   136 
       
   137 /**
       
   138 Services the Date time device property. 
       
   139 */ 
       
   140 void CMTPGetDevicePropValue::ServiceDateTimeL()
       
   141   {
       
   142   __FLOG(_L8("ServiceDateTime - Entry")); 
       
   143   iString->SetL(iDpSingletons.DeviceDataStore().DateTimeL());
       
   144   SendDataL(*iString);
       
   145   __FLOG(_L8("ServiceDateTime - Exit"));
       
   146   }
       
   147 
       
   148 /**
       
   149 Services the DiviceIcon property. 
       
   150 */ 
       
   151 void CMTPGetDevicePropValue::ServiceDeviceIconL()
       
   152     {
       
   153     __FLOG(_L8("DeviceIcon - Entry")); 
       
   154     //iMtpArray is not owned by this class DO NOT DELET IT.
       
   155     iMtpArray = &(iDpSingletons.DeviceDataStore().DeviceIcon());
       
   156     SendDataL(*iMtpArray);
       
   157     __FLOG(_L8("DeviceIcon - Exit"));
       
   158     }
       
   159 
       
   160 /**
       
   161 Services the ServicePerceivedDeviceType property. 
       
   162 */ 
       
   163 void CMTPGetDevicePropValue::ServiceSupportedFormatsOrderedL()
       
   164     {
       
   165     __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Entry"));    
       
   166     iUint8.Set(GetFormatOrdered());
       
   167     SendDataL(iUint8);
       
   168     __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Exit"));
       
   169     }
       
   170 
       
   171  void CMTPGetDevicePropValue::HandleExtnServiceL(TInt aPropCode, MExtnDevicePropDp* aExtnDevplugin)
       
   172     {
       
   173     MMTPType* mtptype = NULL;
       
   174     aExtnDevplugin->GetDevPropertyL((TMTPDevicePropertyCode)aPropCode, &mtptype);
       
   175 
       
   176     if(NULL != mtptype)
       
   177         {
       
   178         SendDataL(*mtptype);	
       
   179         }
       
   180     else
       
   181         {
       
   182         SendResponseL(EMTPRespCodeDevicePropNotSupported); 	
       
   183         }
       
   184     }
       
   185  
       
   186  /*
       
   187  *Service Supported FuntionalID.
       
   188  */
       
   189  void CMTPGetDevicePropValue::ServiceFunctionalIDL()
       
   190      {
       
   191      __FLOG(_L8("ServiceFuntionalIDL - Entry")); 
       
   192 
       
   193     delete iData;
       
   194     iData = GetGUIDL(MMTPFrameworkConfig::EDeviceCurrentFuncationalID); 
       
   195     
       
   196      SendDataL(*iData); 
       
   197      __FLOG(_L8("ServiceFuntionalIDL - Exit")); 
       
   198      }
       
   199 
       
   200  /*
       
   201  *Service Supported ModelID.
       
   202  */
       
   203  void CMTPGetDevicePropValue::ServiceModelIDL()
       
   204      {
       
   205      __FLOG(_L8("ServiceModelIDL - Entry")); 
       
   206      
       
   207      delete iData;
       
   208      iData = GetGUIDL(MMTPFrameworkConfig::EDeviceCurrentModelID); 
       
   209  	
       
   210      SendDataL(*iData); 
       
   211      __FLOG(_L8("ServiceModelIDL - Exit")); 
       
   212      }
       
   213 
       
   214  /*
       
   215  *Service Supported UseDeviceStage.
       
   216  */
       
   217  void CMTPGetDevicePropValue::ServiceUseDeviceStageL()
       
   218      {
       
   219      __FLOG(_L8("ServiceUseDeviceStageL - Entry")); 
       
   220  	iUint8.Set(1);
       
   221  	SendDataL(iUint8); 
       
   222      __FLOG(_L8("ServiceUseDeviceStageL - Exit")); 
       
   223      }
       
   224 
       
   225   
       
   226 
       
   227 
       
   228 
       
   229 
       
   230 
       
   231 
       
   232 
       
   233 
       
   234 
       
   235 
       
   236 
       
   237 
       
   238 
       
   239 
       
   240     
       
   241 
       
   242     
       
   243 
       
   244 
       
   245        
       
   246 
       
   247     
       
   248 
       
   249 
       
   250 
       
   251 
       
   252 
       
   253