accessoryservices/autoaudioasy/inc/cautoaudioasyservice.h
branchRCL_3
changeset 21 ccb4f6b3db21
equal deleted inserted replaced
20:1ddbe54d0645 21:ccb4f6b3db21
       
     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:  This class handles connect and disconnect to AccFw.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_AUTOAUDIOASYSERVICE_H__
       
    19 #define C_AUTOAUDIOASYSERVICE_H__
       
    20 
       
    21 #include <accessoryserver.h>
       
    22 #include <accessorycontrol.h>
       
    23 #include <accpolgenericid.h>
       
    24 #include <accpolgenericidarray.h>
       
    25 
       
    26 #include "mautoaudioasypropertylistener.h"
       
    27 
       
    28 class CAutoAudioAsyPropertyObserver;
       
    29 
       
    30 
       
    31 /**
       
    32  * This class will notification for enabling/disabling RTP streaming channel
       
    33    and handles connect and disconnect to AccFW.
       
    34  */
       
    35 NONSHARABLE_CLASS(CAutoAudioAsyService): public CActive,
       
    36 										 public MAutoAudioAsyPropertyListener
       
    37     {
       
    38 public:
       
    39     /**
       
    40      * Two-phased constructor
       
    41      */
       
    42     static CAutoAudioAsyService* NewL ();
       
    43 
       
    44     virtual ~CAutoAudioAsyService ();    
       
    45 
       
    46 	/**
       
    47     * Starts ASY service
       
    48     */
       
    49 	void StartL ();
       
    50 	
       
    51     /**
       
    52      * Free resources on disconnect or on error
       
    53      */
       
    54     void FreeResources ();
       
    55 
       
    56     /**
       
    57      * @param aPS Handle to the property
       
    58      * @param aUid The Uid of the property
       
    59      * @param aKey The property key
       
    60      * @param aStatus The property change status
       
    61      * @return void
       
    62      */
       
    63     void PropertyChange ( RProperty& aPS, TUid aUid, TUint aKey, TInt aStatus );
       
    64 
       
    65 protected:
       
    66 
       
    67     // CActive
       
    68     void DoCancel ();
       
    69     void RunL ();
       
    70     TInt RunError ( TInt aError );
       
    71 
       
    72 private: //methods
       
    73 
       
    74     CAutoAudioAsyService ();
       
    75 
       
    76     void ConstructL ();
       
    77     void ConnectAccessoryL ();
       
    78     void AccessoryDisconnected ();
       
    79 
       
    80 private: //data
       
    81     /**
       
    82      * State of the service class.
       
    83      */
       
    84     enum TServiceState
       
    85         {
       
    86         EServiceStateIdle,
       
    87         EServiceStateConnecting,
       
    88         EServiceStateConnected
       
    89         };
       
    90 
       
    91     /**
       
    92      * Handle to accessory server
       
    93      * Own.
       
    94      */
       
    95     RAccessoryServer  iAccessoryServer;
       
    96 
       
    97     /**
       
    98      * Handle to accessory control
       
    99      * Own.
       
   100      */
       
   101     RAccessoryControl iAccessoryControl;
       
   102 
       
   103     /**
       
   104      * Generic id header
       
   105      */
       
   106     TAccPolGIDHeader  iGenericIDHeader;
       
   107 
       
   108     /**
       
   109      * State of the service class
       
   110      */
       
   111     TServiceState iState;
       
   112 
       
   113     /**
       
   114      * Generic id
       
   115      * Own.
       
   116      */
       
   117     CAccConGenericID* iGenericId;
       
   118 
       
   119     /**
       
   120      * Observer that receives notifications about RTP Channel
       
   121      * Own.
       
   122      */
       
   123     CAutoAudioAsyPropertyObserver* iPropertyObserver;
       
   124     };
       
   125 
       
   126 #endif // C_AUTOAUDIOASYSERVICE_H__