387 iCmdHanldingActive = CBtmcActive::NewL(*this, CActive::EPriorityStandard, KServiceCmdHandling); |
387 iCmdHanldingActive = CBtmcActive::NewL(*this, CActive::EPriorityStandard, KServiceCmdHandling); |
388 if (iProtocolStatus->iSlc) |
388 if (iProtocolStatus->iSlc) |
389 { |
389 { |
390 iCallStatus->ReportCallStatusL(); |
390 iCallStatus->ReportCallStatusL(); |
391 } |
391 } |
392 iVolumeSyncFromAccessory = EFalse; |
|
393 TRACE_FUNC_EXIT |
392 TRACE_FUNC_EXIT |
394 } |
393 } |
395 |
394 |
396 void CBtmcProtocol::DoHandleCommandL() |
395 void CBtmcProtocol::DoHandleCommandL() |
397 { |
396 { |
936 TRACE_ASSERT(aCmd.ParamNum() == 1, KErrArgument); |
935 TRACE_ASSERT(aCmd.ParamNum() == 1, KErrArgument); |
937 TATParam param = TATParam(); |
936 TATParam param = TATParam(); |
938 LEAVE_IF_ERROR(aCmd.Parameter(0, param)) |
937 LEAVE_IF_ERROR(aCmd.Parameter(0, param)) |
939 TInt value; |
938 TInt value; |
940 LEAVE_IF_ERROR(param.Int(value)) |
939 LEAVE_IF_ERROR(param.Int(value)) |
941 if (!iPhoneStatus) |
940 // In HFP, AT+VGS is not valid before service level connection |
|
941 // has established. |
|
942 // In HSP, AT+VGS is allowed at any time. |
|
943 if (!iPhoneStatus && iProtocolStatus->iProfile == EBtmcHSP ) |
942 { |
944 { |
943 iPhoneStatus = CBtmcPhoneStatus::NewL(*this, iPhone, iProtocolStatus->iProfile); |
945 iPhoneStatus = CBtmcPhoneStatus::NewL(*this, iPhone, iProtocolStatus->iProfile); |
944 iPhoneStatus->SetVolumeControlFeatureL(ETrue); |
946 iPhoneStatus->SetVolumeControlFeatureL(ETrue); |
945 } |
947 } |
946 if(iVolumeSyncFromAccessory) |
948 if(iPhoneStatus) |
947 { |
949 { |
948 iPhoneStatus->SetSpeakerVolumeL(value); |
950 iPhoneStatus->SetSpeakerVolumeL(value); |
949 } |
951 } |
950 break; |
952 break; |
951 } |
953 } |
1023 CleanupStack::PushL(ok); |
1025 CleanupStack::PushL(ok); |
1024 resarr.AppendL(ok); |
1026 resarr.AppendL(ok); |
1025 CleanupStack::Pop(ok); |
1027 CleanupStack::Pop(ok); |
1026 SendResponseL(resarr); |
1028 SendResponseL(resarr); |
1027 CleanupStack::PopAndDestroy(&resarr); |
1029 CleanupStack::PopAndDestroy(&resarr); |
1028 |
|
1029 // solution to volume sync - phone will always send its volume status back to accessory |
|
1030 |
|
1031 if( (aCmd.Id() == EATVGS) && (iVolumeSyncFromAccessory == EFalse) ) |
|
1032 { |
|
1033 iVolumeSyncFromAccessory = ETrue; |
|
1034 TInt vol(KErrNotFound); |
|
1035 |
|
1036 if(iPhoneStatus) |
|
1037 { |
|
1038 vol = iPhoneStatus->GetVolumeStatus(); |
|
1039 } |
|
1040 |
|
1041 if(vol > KErrNotFound) // volume exists |
|
1042 { |
|
1043 TATParam param = TATParam(); |
|
1044 LEAVE_IF_ERROR(aCmd.Parameter(0, param)) |
|
1045 TInt value; |
|
1046 LEAVE_IF_ERROR(param.Int(value)) |
|
1047 if(value != vol) |
|
1048 { |
|
1049 CATResult* event = CATResult::NewLC(EATVGS, EATUnsolicitedResult, vol); |
|
1050 SendUnsoltResultL(*event); |
|
1051 CleanupStack::PopAndDestroy(event); |
|
1052 } |
|
1053 } |
|
1054 } |
|
1055 CmdHandlingCompletedL(); |
1030 CmdHandlingCompletedL(); |
1056 } |
1031 } |
1057 |
|
1058 |
1032 |
1059 // ----------------------------------------------------------------------------- |
1033 // ----------------------------------------------------------------------------- |
1060 // CBtmcProtocol::HandleActionCommandL |
1034 // CBtmcProtocol::HandleActionCommandL |
1061 // |
1035 // |
1062 // Action Command handled by this method: |
1036 // Action Command handled by this method: |