usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h
branchRCL_3
changeset 60 25c602fd1f26
parent 43 012cc2ee6408
equal deleted inserted replaced
52:3d9964be03bc 60:25c602fd1f26
     1 /**
     1 /**
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    32 #include <ecom/ecom.h>
    32 #include <ecom/ecom.h>
    33 #include <d32usbc.h>
    33 #include <d32usbc.h>
    34 #include <e32std.h>
    34 #include <e32std.h>
    35 #include <usb/usblogger.h>
    35 #include <usb/usblogger.h>
    36 #include <musbmanextensionpluginobserver.h>
    36 #include <musbmanextensionpluginobserver.h>
       
    37 #include <musbthermalnotify.h>
    37 
    38 
    38 class CUsbDeviceStateWatcher;
    39 class CUsbDeviceStateWatcher;
    39 class CUsbClassControllerBase;
    40 class CUsbClassControllerBase;
    40 class CUsbServer;
    41 class CUsbServer;
    41 class MUsbDeviceNotify;
    42 class MUsbDeviceNotifyInternal;
    42 class CPersonality;
    43 class CPersonality;
    43 class CUsbmanExtensionPlugin;
    44 class CUsbmanExtensionPlugin;
    44 
    45 
    45 const TUid KUidUsbPlugIns = {0x101fbf21};
    46 const TUid KUidUsbPlugIns = {0x101fbf21};
    46 
    47 
    58  *
    59  *
    59  * CUsbDevice is an active object which starts and stops Usb Class Controllers
    60  * CUsbDevice is an active object which starts and stops Usb Class Controllers
    60  * asynchronously, one by one. Its RunL function will be called after each
    61  * asynchronously, one by one. Its RunL function will be called after each
    61  * start/stop.
    62  * start/stop.
    62  */
    63  */
    63 NONSHARABLE_CLASS(CUsbDevice) : public CActive, public MUsbClassControllerNotify, public MUsbmanExtensionPluginObserver
    64 NONSHARABLE_CLASS(CUsbDevice) : public CActive, public MUsbClassControllerNotify, public MUsbmanExtensionPluginObserver, public MUsbThermalNotify
    64 	{
    65 	{
    65 public:
    66 public:
    66 	class TUsbDeviceDescriptor
    67 	class TUsbDeviceDescriptor
    67 		{
    68 		{
    68 	public:
    69 	public:
    87 	virtual ~CUsbDevice();
    88 	virtual ~CUsbDevice();
    88 
    89 
    89  	void EnumerateClassControllersL();
    90  	void EnumerateClassControllersL();
    90 	void AddClassControllerL(CUsbClassControllerBase* aClassController, TLinearOrder<CUsbClassControllerBase> order);
    91 	void AddClassControllerL(CUsbClassControllerBase* aClassController, TLinearOrder<CUsbClassControllerBase> order);
    91 
    92 
    92 	void RegisterObserverL(MUsbDeviceNotify& aObserver);
    93 	void RegisterObserverL(MUsbDeviceNotifyInternal& aObserver);
    93 	void DeRegisterObserver(MUsbDeviceNotify& aObserver);
    94 	void DeRegisterObserver(MUsbDeviceNotifyInternal& aObserver);
    94 
    95 
    95 	void StartL();
    96 	void StartL();
    96 	void Stop();
    97 	void Stop();
    97 
    98 
    98 	inline TInt LastError() const;
    99 	inline TInt LastError() const;
   110 	void TryStartL(TInt aPersonalityId);
   111 	void TryStartL(TInt aPersonalityId);
   111 	TInt CurrentPersonalityId() const;
   112 	TInt CurrentPersonalityId() const;
   112 	const RPointerArray<CPersonality>& Personalities() const;
   113 	const RPointerArray<CPersonality>& Personalities() const;
   113 	const CPersonality* GetPersonality(TInt aPersonalityId) const;
   114 	const CPersonality* GetPersonality(TInt aPersonalityId) const;
   114 	void ValidatePersonalitiesL();
   115 	void ValidatePersonalitiesL();
       
   116 	void StartThermalMonitoring();
   115 	void ReadPersonalitiesL();
   117 	void ReadPersonalitiesL();
   116 	void SetDefaultPersonalityL();
   118 	void SetDefaultPersonalityL();
   117 	void LoadFallbackClassControllersL();
   119 	void LoadFallbackClassControllersL();
   118 	
   120 	
   119 public: // From CActive
   121 public: // From CActive
   126 	void UccnError(TInt aError);
   128 	void UccnError(TInt aError);
   127 
   129 
   128 public: // from MUsbmanExtensionPluginObserver
   130 public: // from MUsbmanExtensionPluginObserver
   129 	RDevUsbcClient& MuepoDoDevUsbcClient();
   131 	RDevUsbcClient& MuepoDoDevUsbcClient();
   130 	void MuepoDoRegisterStateObserverL(MUsbDeviceNotify& aObserver);
   132 	void MuepoDoRegisterStateObserverL(MUsbDeviceNotify& aObserver);
   131 
   133 	
       
   134 public: // from  MUsbThermalNotify
       
   135 	void UsbThermalStateChange(TInt aLastError, TInt aValue);
       
   136 	
   132 protected:
   137 protected:
   133 	CUsbDevice(CUsbServer& aUsbServer);
   138 	CUsbDevice(CUsbServer& aUsbServer);
   134 	void ConstructL();
   139 	void ConstructL();
   135 	void StartCurrentClassController();
   140 	void StartCurrentClassController();
   136 	void StopCurrentClassController();
   141 	void StopCurrentClassController();
   151 #endif
   156 #endif
   152 	void InstantiateExtensionPluginsL();
   157 	void InstantiateExtensionPluginsL();
   153 private:
   158 private:
   154 	RPointerArray<CUsbClassControllerBase> iSupportedClasses;
   159 	RPointerArray<CUsbClassControllerBase> iSupportedClasses;
   155 	RPointerArray<MUsbDeviceNotify> iObservers;
   160 	RPointerArray<MUsbDeviceNotify> iObservers;
       
   161 	RPointerArray<MUsbDeviceNotifyInternal> iThermalObservers;
   156 	RPointerArray<CUsbmanExtensionPlugin> iExtensionPlugins;
   162 	RPointerArray<CUsbmanExtensionPlugin> iExtensionPlugins;
       
   163 	
   157 	TUsbDeviceState  iDeviceState;
   164 	TUsbDeviceState  iDeviceState;
   158 	TUsbServiceState iServiceState;
   165 	TUsbServiceState iServiceState;
   159 	TInt iLastError;
   166 	TInt iLastError;
   160 	RDevUsbcClient iLdd;
   167 	RDevUsbcClient iLdd;
   161 	CUsbDeviceStateWatcher* iDeviceStateWatcher;
   168 	CUsbDeviceStateWatcher* iDeviceStateWatcher;