os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/src/rusbmspublisher.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 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 the License "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 
    18 /**
    19  @file
    20  @internalTechnology
    21 */
    22 
    23 #include <e32cmn.h>
    24 #include <e32std.h>
    25 #include <e32property.h>
    26 #include <e32def.h>
    27 #include <e32debug.h>
    28 #include "rusbmspublisher.h"
    29 #include "debug.h"
    30 
    31 //------------------------------------------------------------------------------
    32 /**
    33 Constructor
    34 */
    35 
    36 const TUid KMyPropertyCat = {0x10285B2E};
    37 const TUid KUsbmanSvrSid = {0x101fe1db};
    38 
    39     enum TPropertyKeys
    40         {
    41         KUsbManOtgEventProperty = 1,
    42         KUsbManServerProperty = 2,
    43         KUsbManConnectionStateProperty = 3
    44         };
    45 
    46 
    47 RUsbOtgEventPublisher::RUsbOtgEventPublisher()
    48 	{
    49 //	TInt result = iProperty.Attach(KMyPropertyCat, KUsbManOtgEventProperty, EOwnerThread);
    50 //	__ASSERT_DEBUG(result == KErrNone, User::Invariant());
    51 	}
    52 
    53 
    54 RUsbOtgEventPublisher::~RUsbOtgEventPublisher()
    55 	{
    56 //	iProperty.Close();
    57 //	RProperty::Delete(KMyPropertyCat, KUsbManOtgEventProperty);
    58 	}
    59 
    60 /**
    61 Publishing method
    62 
    63 Publishes the USB event property event
    64 
    65 @param aEvent
    66 */
    67 void RUsbOtgEventPublisher::PublishEvent(TInt aEvent)
    68 	{
    69 
    70 	TInt result = iProperty.Attach(KMyPropertyCat, KUsbManOtgEventProperty, EOwnerThread);
    71 	__ASSERT_DEBUG(result == KErrNone, User::Invariant());
    72 
    73     __USBOTGPRINT(_L("****************** PublishEvent...."));
    74     result = iProperty.Set(aEvent);
    75     __USBOTGPRINT2(_L("****************** PublishEvent %d %d"), aEvent, result);
    76 
    77 	iProperty.Close();
    78 	RProperty::Delete(KMyPropertyCat, KUsbManOtgEventProperty);
    79 	}
    80 
    81 
    82 //------------------------------------------------------------------------------
    83 void RUsbManServerPublisher::PublishEvent()
    84 	{
    85 	TInt result = iProperty.Attach(KUsbmanSvrSid, KUsbManServerProperty, EOwnerThread);
    86 	__ASSERT_DEBUG(result == KErrNone, User::Invariant());
    87 
    88     __USBOTGPRINT(_L("****************** PublishServer...."));
    89     result = iProperty.Set(1);
    90     __USBOTGPRINT1(_L("****************** PublishServer %d"), result);
    91 
    92 	iProperty.Close();
    93 	RProperty::Delete(KMyPropertyCat, KUsbManServerProperty);
    94 	}
    95 
    96 //------------------------------------------------------------------------------
    97 void RUsbManConnectionStatePublisher::PublishEvent(TBool aActive)
    98 	{
    99 	TInt result = iProperty.Attach(KUsbmanSvrSid, KUsbManConnectionStateProperty, EOwnerThread);
   100 	__ASSERT_DEBUG(result == KErrNone, User::Invariant());
   101 
   102     __USBOTGPRINT1(_L("****************** PublishConnectionState Active=%d...."), aActive);
   103     result = iProperty.Set(aActive);
   104     __USBOTGPRINT1(_L("****************** PublishConnectionState %d"), result);
   105 
   106 	iProperty.Close();
   107 	RProperty::Delete(KMyPropertyCat, KUsbManConnectionStateProperty);
   108 	}