diff -r 3d9964be03bc -r 25c602fd1f26 usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp Wed Sep 15 14:10:49 2010 +0300 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp Wed Oct 13 16:35:28 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -78,6 +78,9 @@ LOG_FUNC iUsbServer->IncrementSessionCount(); +#ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + iThernalLevelMsgPending = EFalse; +#endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV } @@ -413,7 +416,30 @@ // is next called. } } - +#ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV +void CUsbSession::UsbThermalStateChange(TInt /*aLastError*/, TInt aNewValue) +#else +void CUsbSession::UsbThermalStateChange(TInt /*aLastError*/, TInt /*aNewValue*/) +#endif + { +#ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + LOG_FUNC + + // Update local copy with the latest value from P&S key + iUsbThermalLevel = aNewValue; + + // Forward it to upper layer if there is a client pending there + if (iMsgObserverOutstanding) + { + ForwardThermalMessage(); + } + else + { + iThernalLevelMsgPending = ETrue; + } +#endif //SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + } + /** * Dequeues an event and completes the observer's request with it. */ @@ -450,6 +476,25 @@ } } +#ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + +void CUsbSession::ForwardThermalMessage() + { + LOG_FUNC + + TPckg pckg(iUsbThermalLevel); + + // Mark no pending since we're going to complete client request. + iMsgObserverOutstanding = EFalse; + + // Mark no new thermal message need to be forward + iThernalLevelMsgPending = EFalse; + + const TInt err = iMsgObserverMessage.Write(0, pckg); + iMsgObserverMessage.Complete(err); + } +#endif //SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + /** * Handles the request (in the form of a the message) received from the client * @@ -883,14 +928,14 @@ LOGTEXT(_L8(" Reset Device Event Queue")); iDevStateQueueHead = 0; iDevStateQueueTail = 0; - iObserverQueueEvents = ETrue; + iObserverQueueEvents = ETrue; } else if (iDevStateQueueHead != iDevStateQueueTail) { // event(s) queued, we can de-queue one now UsbDeviceDequeueEvent(); } - + return KErrNone; } @@ -915,7 +960,9 @@ iServiceObserverMessage = aMessage; iServiceObserverOutstanding = ETrue; + aComplete = EFalse; + return KErrNone; } @@ -1924,7 +1971,15 @@ // event(s) queued, we can de-queue one now UsbMsgDequeue(); } - + +#ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + if (iThernalLevelMsgPending) + { + ForwardThermalMessage(); + aComplete = ETrue; + } +#endif + return KErrNone; }