bluetoothengine/btmac/inc/btmonocmdhandler/btmcprotocol.h
changeset 0 f63038272f30
child 2 0b192a3a05a4
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BTMCPROTOCOL_H
       
    20 #define BTMCPROTOCOL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <etelmm.h>
       
    24 #include <btengdiscovery.h>
       
    25 #include "btmcactive.h"
       
    26 #include "btmcprofileid.h"
       
    27 #include "btmcprotdatabuf.h"
       
    28 #include "HfpAtCmdHandler.h"
       
    29 
       
    30 // forward declarations
       
    31 class CATCommand;
       
    32 class CATResult;
       
    33 class TBtmcProtocolStatus;   
       
    34 class MBtmcObserver;
       
    35 class MATExtObserver;
       
    36 class CBtmcMobileLine;
       
    37 class CBtmcPhoneStatus;
       
    38 class CBtmcCallStatus;
       
    39 class CBtmcNumber;
       
    40 class CBtmcOperator;
       
    41 class CBtmcCallingHandler;
       
    42 class TBtmcProtDataBuf;
       
    43 class CDesC8ArrayFlat;
       
    44 
       
    45 
       
    46 const TUint KBTHSRemoteAudioVolumeControl = 0x0302;
       
    47 
       
    48 NONSHARABLE_CLASS(CBtmcProtocol) : public CBase, 
       
    49     public MBtmcActiveObserver, 
       
    50     public MBTEngSdpResultReceiver, 
       
    51     public MATExtObserver
       
    52       {
       
    53     public:
       
    54         static CBtmcProtocol* NewL(
       
    55             MBtmcObserver& aObserver, 
       
    56             TBtmcProfileId aProfile,
       
    57             const TDesC8& aBTDevAddr,
       
    58             TBool aAccessoryInitiated);
       
    59 
       
    60         ~CBtmcProtocol();
       
    61         
       
    62         /**
       
    63         * Handle an AT command from HF or HS unit.
       
    64         *
       
    65         */
       
    66         void NewProtocolDataL(const TDesC8& aData);
       
    67 
       
    68         void SendResponseL(const CATResult& aResult);
       
    69         
       
    70         void SendResponseL(const RPointerArray<CATResult>& aResults);
       
    71         
       
    72         void SendUnsoltResultL(const CATResult& aResult);
       
    73         
       
    74         void CmdHandlingCompletedL();
       
    75         
       
    76         TBtmcProtocolStatus& ProtocolStatus();
       
    77         
       
    78         void VoiceRecognitionError();
       
    79         
       
    80         void HandleNrecCompletedL(TInt aErr);
       
    81 
       
    82         void ActivateRemoteVolumeControl();
       
    83 
       
    84         void DeActivateRemoteVolumeControl();   
       
    85 
       
    86         TInt GetRemoteSupportedFeature();
       
    87 
       
    88         /**
       
    89          * Tells if AT+CHLD command handling is in progress
       
    90          */
       
    91         TBool ActiveChldHandling() const;
       
    92         
       
    93     private:        
       
    94         // from MBTEngSdpResultReceiver
       
    95         void ServiceSearchComplete( const RSdpRecHandleArray& /*aResult*/, 
       
    96 		                                         TUint /*aTotalRecordsCount*/, TInt /*aErr*/ ) {}
       
    97 		
       
    98         void AttributeSearchComplete( TSdpServRecordHandle /*aHandle*/, 
       
    99 		                                           const RSdpResultArray& /*aAttr*/, TInt /*aErr*/ ) {}
       
   100 		
       
   101         void ServiceAttributeSearchComplete( TSdpServRecordHandle /*aHandle*/, 
       
   102 		                                                  const RSdpResultArray& /*aAttr*/, 
       
   103 		                                                  TInt /*aErr*/ );
       
   104 		
       
   105 		void DeviceSearchComplete( CBTDevice* /*aDevice*/, TInt /*aErr*/ ) {}
       
   106 
       
   107         
       
   108         // From MBtmcActiveObserver
       
   109     
       
   110         void RequestCompletedL(CBtmcActive& aActive, TInt aErr);
       
   111         
       
   112         void CancelRequest(TInt aServiceId);
       
   113 
       
   114 		// From MATExtObserver
       
   115 			
       
   116         void ATExtHandleCommandCompletedL(TInt aErr, const TDesC8& aReply);
       
   117         
       
   118         void UnsolicitedResultFromATExtL(TInt aErr, const TDesC8& aAT);
       
   119 
       
   120     private:
       
   121         CBtmcProtocol(MBtmcObserver& aObserver);
       
   122         
       
   123         // 2nd phase construction, called by NewL()
       
   124         void ConstructL(TBtmcProfileId aProfile, const TDesC8& aBTDevAddr, TBool aAccessoryInitiated);
       
   125         
       
   126         void DoHandleCommandL();
       
   127                 
       
   128         void HandleTestCommandL(const CATCommand& aCmd);
       
   129         
       
   130         void HandleReadCommandL(const CATCommand& aCmd);
       
   131         
       
   132         void HandleWriteCommandL(const CATCommand& aCmd);
       
   133         
       
   134         void HandleActionCommandL(const CATCommand& aCmd);
       
   135 
       
   136         void DoSendProtocolDataL();
       
   137 
       
   138         void StartTimerL(TInt aService, TInt aTimeout);
       
   139         
       
   140         void StopTimer(TInt aService);
       
   141 
       
   142         TBool ServiceLevelConnected() const;
       
   143         
       
   144         void SetIndicatorL(TInt aIndicator, TInt aValue);
       
   145 
       
   146     private:
       
   147         MBtmcObserver& iObserver;  // unowned
       
   148         TBtmcProtocolStatus* iProtocolStatus; // owned
       
   149         RTelServer iServer; // owned
       
   150         RMobilePhone iPhone; // owned
       
   151         CBtmcPhoneStatus* iPhoneStatus;// owned
       
   152         CBtmcCallStatus* iCallStatus;// owned
       
   153 
       
   154         CBtmcNumber* iNumber; // owned
       
   155         CBtmcOperator* iOperator; // owned
       
   156 
       
   157         CBtmcCallingHandler* iCallingHandler;
       
   158         
       
   159         // Service Level Connection
       
   160         TInt iSlcMask;
       
   161 
       
   162         RTimer iTimer;// owned
       
   163         CBtmcActive* iTimerActive; // owned, SLC
       
   164         
       
   165         CBtmcActive* iEtelQuery; // owned
       
   166         
       
   167         CBtmcActive* iCmdHanldingActive;
       
   168  
       
   169         CHFPAtCmdHandler* iAtExt;
       
   170         
       
   171         // buffer of incoming At commands
       
   172         TBtmcProtDataBuf iInDataBuf;
       
   173         TBool iHandleCmdPending;
       
   174         CDesC8ArrayFlat* iOutgoPacketQueue; // owned
       
   175         TInt iCredit; // How many commands are allowed to acc
       
   176         TBool iVolumeSyncFromAccessory;
       
   177         CBTEngDiscovery* iBteng; // for volume query
       
   178         TBool iAccessoryInitiated; // who initiated the connection
       
   179         RMobilePhone::TMobilePhoneIdentityV1 iIdentity; // holds IMEI etc
       
   180         RMobilePhone::TMobilePhoneSubscriberId iId; // holds id
       
   181         };
       
   182 
       
   183 #endif // BTMCPROTOCOL_H
       
   184 
       
   185 // End of File
       
   186