--- a/bluetoothengine/bteng/bttoggle/src/bttoggle.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/bteng/bttoggle/src/bttoggle.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -303,9 +303,9 @@
iNotifier.CancelNotifier(KBTGenericQueryNotifierUid);
}
else if ( EPowerModeChangeNote == iActiveNotifier )
- {
- iNotifier.CancelNotifier(KBTGenericQueryNotifierUid);
- }
+ {
+ iNotifier.CancelNotifier(KBTGenericInfoNotifierUid);
+ }
// For all cancels, we must reset iActiveNotifier back to ENoneQuery
// to permit another request to be made.
@@ -330,8 +330,8 @@
switch (iActiveNotifier)
{
case EPowerModeQuery:
- iActiveNotifier = ENoneQuery;
- ShowNotification(ETrue);
+ ShowNotification(ETrue);
+ iActiveNotifier = EPowerModeChangeNote ;
SetActive();
break;
case ECloseConnectionQuery:
Binary file bluetoothengine/bteng/conf/CI_bteng.confml has changed
--- a/bluetoothengine/bteng/group/bld.inf Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/bteng/group/bld.inf Mon Jul 12 19:25:26 2010 +0300
@@ -37,9 +37,6 @@
../conf/bteng_10204DAB.crml MW_LAYER_CRML(bteng_10204DAB.crml)
../conf/bteng_10204DAC.crml MW_LAYER_CRML(bteng_10204DAC.crml)
-/*remove the following exportation, when SCB CR is approved*/
-../conf/CI_bteng.confml MW_LAYER_CONFML(CI_bteng.confml)
-
../data/btrfs.txt z:/resource/btrfs.txt
--- a/bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -707,9 +707,10 @@
TRACE_INFO( ( _L( "[CBTEngSrvSettingsMgr]\t Using HCI API v2 power manager" ) ) )
User::LeaveIfError( iPowerMgr.Open() );
#ifndef __WINS__
- iPowerMgr.SetPower( EBTOff, NULL, iActive->RequestStatus() );
- User::WaitForRequest( iActive->RequestStatus() );
- TInt status = ( iActive->RequestStatus().Int() == KErrAlreadyExists ? KErrNone : iActive->RequestStatus().Int() );
+ TRequestStatus reqStatus;
+ iPowerMgr.SetPower( EBTOff, NULL, reqStatus );
+ User::WaitForRequest( reqStatus );
+ TInt status = ( reqStatus.Int() == KErrAlreadyExists ? KErrNone : reqStatus.Int() );
User::LeaveIfError( status );
#else //__WINS__
iPowerState = EBTOff;
--- a/bluetoothengine/btmac/src/btmac/btmpagescanparametersmanager.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btmac/src/btmac/btmpagescanparametersmanager.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -71,6 +71,7 @@
KPageScanParametersListenerService);
iTimerActive = CBtmActive::NewL(*this, CActive::EPriorityStandard, KFastConnectionService);
+ LEAVE_IF_ERROR(iTimer.CreateLocal());
TRACE_FUNC_EXIT
}
@@ -89,7 +90,6 @@
if (!iTimerActive->IsActive())
{
TRACE_FUNC_ENTRY
- iTimer.CreateLocal();
iTimer.After(iTimerActive->iStatus, aTimeout);
iTimerActive->SetRequestId(aService);
iTimerActive->GoActive();
@@ -107,7 +107,6 @@
{
TRACE_FUNC_ENTRY
iTimerActive->Cancel();
- iTimer.Close();
TRACE_FUNC_EXIT
}
}
--- a/bluetoothengine/btsac/btrcc/inc/btrccVolumeLevelControllerBase.h Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/inc/btrccVolumeLevelControllerBase.h Mon Jul 12 19:25:26 2010 +0300
@@ -89,7 +89,7 @@
void Reset(); // Reset the volume level.
- TInt GetLocalMaxVolume();
+ TInt GetLocalMaxVolumeL();
TInt GetCurrentLocalVolume();
--- a/bluetoothengine/btsac/btrcc/src/btrccAbsoluteVolumeLevelController.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/src/btrccAbsoluteVolumeLevelController.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -67,7 +67,7 @@
{
TRACE_FUNC
CBTRCCVolumeLevelControllerBase::ConstructL();
- iLocalMaxVolume = GetLocalMaxVolume();
+ iLocalMaxVolume = GetLocalMaxVolumeL();
iInterfaceSelector = &aInterfaceSelector;
iRemConAbsoluteVolumeController = CRemConAbsoluteVolumeController::NewL(aInterfaceSelector,
--- a/bluetoothengine/btsac/btrcc/src/btrccLegacyVolumeLevelController.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/src/btrccLegacyVolumeLevelController.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -80,7 +80,7 @@
TRACE_INFO((_L("CBTRCCActive created")))
iCtrlRTimer.CreateLocal();
TRACE_INFO((_L("RTimer created")))
- iLocalMaxVolume = GetLocalMaxVolume();
+ iLocalMaxVolume = GetLocalMaxVolumeL();
}
// -----------------------------------------------------------------------------
--- a/bluetoothengine/btsac/btrcc/src/btrccLinker.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/src/btrccLinker.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -86,14 +86,35 @@
iRegisterVolumeChangeNotificationCounter = 0;
if (iAccObserver.IsAvrcpVolCTSupported())
{
- iAbsoluteVolController = CBTRCCAbsoluteVolumeLevelController::NewL(*iInterfaceSelector, *this);
- TRACE_INFO((_L("CBTRCCLinker::ConstructL, absolute volume controller created.")))
+ TInt err = KErrNone;
+ TRAP(err, iAbsoluteVolController = CBTRCCAbsoluteVolumeLevelController::NewL(*iInterfaceSelector, *this));
+ if( err )
+ {
+ // Absolute volume controller creation failed, this means that we don't have volume controller
+ // but continue construct linker.
+ iAbsoluteVolController = NULL;
+ TRACE_INFO((_L("CBTRCCLinker::ConstructL, absolute volume controller creation failed %d, continue anyway."), err))
+ }
+ else
+ {
+ TRACE_INFO((_L("CBTRCCLinker::ConstructL, absolute volume controller created.")))
+ }
// If also legacy is configured into use, prepare to use it with legacy devices.
if(iAccObserver.IsAvrcpLegacyVolCTSupported())
{
- iLegacyVolController = CBTRCCLegacyVolumeLevelController::NewL(*iInterfaceSelector, *this);
- TRACE_INFO((_L("CBTRCCLinker::ConstructL, legacy volume controller created.")))
+ TRAP(err, iLegacyVolController = CBTRCCLegacyVolumeLevelController::NewL(*iInterfaceSelector, *this));
+ if( err )
+ {
+ // Legacy volume controller creation failed, this means that we don't have volume controller
+ // but continue construct linker.
+ iLegacyVolController = NULL;
+ TRACE_INFO((_L("CBTRCCLinker::ConstructL, legacy volume controller creation failed %d, continue anyway."), err))
+ }
+ else
+ {
+ TRACE_INFO((_L("CBTRCCLinker::ConstructL, legacy volume controller created.")))
+ }
}
}
else
@@ -108,7 +129,7 @@
iRemConBatteryTgt = CRemConBatteryApiTarget::NewL(*iInterfaceSelector, *this);
- if (iAccObserver.IsAvrcpVolCTSupported())
+ if (iAbsoluteVolController || iLegacyVolController)
{
iInterfaceSelector->OpenControllerL();
}
@@ -445,6 +466,12 @@
// absolute controller or legacy controller.
if(!iVolController)
{
+ // iAbsoluteVolController may be NULL, if creation of devsound has
+ // been failed or local max volume provided by devsound is zero.
+
+ // iLegacyVolController may be NULL, depends on the configuration and
+ // if creation of devsound has been failed or local max volume provided
+ // by devsound is zero.
if (iAccObserver.IsAbsoluteVolumeSupported(iRemoteAddr))
{
iVolController = iAbsoluteVolController;
@@ -452,7 +479,7 @@
}
else
{
- iVolController = iLegacyVolController; // iLegacyVolController may be NULL, depends on the configuration.
+ iVolController = iLegacyVolController;
}
}
}
--- a/bluetoothengine/btsac/btrcc/src/btrccVolumeLevelControllerBase.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/src/btrccVolumeLevelControllerBase.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -122,23 +122,21 @@
}
// -----------------------------------------------------------------------------
-// CBTRCCVolumeLevelControllerBase::GetLocalMaxVolume
+// CBTRCCVolumeLevelControllerBase::GetLocalMaxVolumeL
// -----------------------------------------------------------------------------
//
-TInt CBTRCCVolumeLevelControllerBase::GetLocalMaxVolume()
+TInt CBTRCCVolumeLevelControllerBase::GetLocalMaxVolumeL()
{
TRACE_FUNC
- if(iLocalMaxVolume == 0)
+ // fetch max volume from adaptation and cache it.
+ CMMFDevSound* devSound = CMMFDevSound::NewL();
+ iLocalMaxVolume = devSound->MaxVolume();
+ TRACE_INFO((_L("Maximum volume is %d"), iLocalMaxVolume))
+ delete devSound; // This is not needed for anything else.
+ if( iLocalMaxVolume <= 0 )
{
- // fetch max volume from adaptation and cache it.
- CMMFDevSound* devSound = NULL;
- TRAPD( err, devSound = CMMFDevSound::NewL() );
- if(!err)
- {
- iLocalMaxVolume = devSound->MaxVolume();
- TRACE_INFO((_L("Maximum volume is %d"), iLocalMaxVolume))
- delete devSound; // This is not needed for anything else.
- }
+ TRACE_INFO((_L("Error, Maximum volume value is invalid")))
+ User::Leave(KErrNotSupported);
}
return iLocalMaxVolume;
}
--- a/bluetoothengine/btsac/inc/btsaController.h Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/inc/btsaController.h Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -239,6 +239,7 @@
CBtsacActive* iGavdpErrorActive;
TBTDevAddr iRemoteAddr;
+ TBool iNotifiedObserverOfNewAccessory;
TInt iSBCSEPIndex; // SBC SEP Index in iRemoteSEPs array
TBool iResetAudioInput;
TRequestStatus* iConnectStatus;
--- a/bluetoothengine/btsac/inc/btsacStateListening.h Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/inc/btsacStateListening.h Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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"
@@ -40,7 +40,9 @@
public:
- static CBtsacListening* NewL(CBTSAController& aParent, TBTSACGavdpResetReason aGavdpResetReason, TInt aDisconnectReason);
+ static CBtsacListening* NewL(CBTSAController& aParent,
+ TBTSACResetGavdp aResetGavdp = EDontResetGavdp,
+ TInt aDisconnectReason = KErrNone);
virtual ~CBtsacListening();
@@ -117,15 +119,14 @@
private:
- CBtsacListening(CBTSAController& aParent, TBTSACGavdpResetReason aGavdpResetReason, TInt aDisconnectReason);
+ CBtsacListening(CBTSAController& aParent, TBTSACResetGavdp aResetGavdp, TInt aDisconnectReason);
void ConstructL();
private:
- TBTSACGavdpResetReason iGavdpResetReason;
+ TBTSACResetGavdp iResetGavdp;
TInt iDisconnectReason;
TInt iPendingRequests;
TBTInitProcedure iInitializationProcedure;
- TBool iUnfinishedGavdpError;
/**
* AO for self completing.
@@ -134,4 +135,4 @@
};
#endif // C_BTSACLISTENING_H
-
\ No newline at end of file
+
--- a/bluetoothengine/btsac/inc/btsacdefs.h Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/inc/btsacdefs.h Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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"
@@ -57,10 +57,10 @@
EStreamConfiguredBySink
};
-enum TBTSACGavdpResetReason
+enum TBTSACResetGavdp
{
- EGavdpResetReasonNone,
- EGavdpResetReasonGeneral
+ EDontResetGavdp,
+ EResetGavdp
};
//Panic codes
--- a/bluetoothengine/btsac/src/btsaController.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsaController.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -448,11 +448,16 @@
void CBTSAController::NewAccessory(const TBTDevAddr& aAddr)
{
TRACE_FUNC
- TInt connectedProfiles = Observer().ConnectionStatus( aAddr );
- if( !(connectedProfiles & EStereo) )
- {
- Observer().NewAccessory( aAddr, EStereo );
- }
+ TRACE_INFO((_L("\tiNotifiedObserverOfNewAccessory = %d"), iNotifiedObserverOfNewAccessory))
+ if ( !iNotifiedObserverOfNewAccessory )
+ {
+ TInt connectedProfiles = Observer().ConnectionStatus( aAddr );
+ if( !(connectedProfiles & EStereo) )
+ {
+ Observer().NewAccessory( aAddr, EStereo );
+ iNotifiedObserverOfNewAccessory = ETrue;
+ }
+ }
}
// -----------------------------------------------------------------------------
@@ -462,7 +467,12 @@
void CBTSAController::DisconnectedFromRemote(const TBTDevAddr& aAddr, TInt /*aError*/)
{
TRACE_FUNC
- Observer().AccessoryDisconnected(aAddr, EStereo );
+ TRACE_INFO((_L("\tiNotifiedObserverOfNewAccessory = %d"), iNotifiedObserverOfNewAccessory))
+ if ( iNotifiedObserverOfNewAccessory )
+ {
+ Observer().AccessoryDisconnected(aAddr, EStereo );
+ iNotifiedObserverOfNewAccessory = EFalse;
+ }
}
// -----------------------------------------------------------------------------
@@ -533,6 +543,11 @@
//
void CBTSAController::SetRemoteAddr(const TBTDevAddr& aRemoteAddr)
{
+#ifdef PRJ_ENABLE_TRACE
+ TBuf<12> buf;
+ aRemoteAddr.GetReadable(buf);
+ TRACE_INFO((_L("CBTSAController::SetRemoteAddr aRemoteAddr = %S"), &buf))
+#endif
iRemoteAddr = aRemoteAddr;
}
@@ -542,6 +557,11 @@
//
TBTDevAddr CBTSAController::GetRemoteAddr() const
{
+#ifdef PRJ_ENABLE_TRACE
+ TBuf<12> buf;
+ iRemoteAddr.GetReadable(buf);
+ TRACE_INFO((_L("CBTSAController::GetRemoteAddr iRemoteAddr = %S"), &buf))
+#endif
return iRemoteAddr;
}
@@ -615,7 +635,7 @@
}
else
{
- TRAPD(err, ChangeStateL(CBtsacListening::NewL(*this, EGavdpResetReasonGeneral, EFalse)));
+ TRAPD(err, ChangeStateL(CBtsacListening::NewL(*this, EResetGavdp, KErrNone)));
if (err)
{
TRACE_INFO((_L("CBTSAController::NotifyError() Couldn't change state.")))
--- a/bluetoothengine/btsac/src/btsacState.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacState.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -50,7 +50,7 @@
CBtsacState* CBtsacState::ErrorOnEntryL(TInt /*aReason*/)
{
TRACE_FUNC
- return CBtsacListening::NewL(iParent, EGavdpResetReasonNone, KErrNone);
+ return CBtsacListening::NewL(iParent);
}
// -----------------------------------------------------------------------------
@@ -221,7 +221,7 @@
{
TRACE_INFO((_L("CBtsacState::GAVDP_AbortStreamConfirm(), state %d"), GetStateIndex()))
Parent().CompletePendingRequests(KCompleteAllReqs, KErrAbort);
- TRAPD(err, Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected)));
+ TRAPD(err, Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected)));
if (err)
{
TRACE_INFO((_L("CBtsacState::GAVDP_AbortStreamConfirm() Couldn't change state.")))
@@ -333,7 +333,7 @@
TRACE_INFO((_L("CBtsacState::GAVDP_AbortIndication(), state %d, SEID:%d"), GetStateIndex(), aSEID.SEID()))
(void)aSEID;
Parent().CompletePendingRequests(KCompleteAllReqs, KErrDisconnected);
- TRAPD(err, Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected)))
+ TRAPD(err, Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected)))
if(err)
{
TRACE_INFO((_L("CBtsacState::GAVDP_AbortIndication(), error! Couldn't change state")))
--- a/bluetoothengine/btsac/src/btsacStateAborting.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacStateAborting.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -76,7 +76,7 @@
{
TRACE_FUNC
Parent().CompletePendingRequests(KCompleteAllReqs, aError);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected));
}
// End of File
--- a/bluetoothengine/btsac/src/btsacStateConfigured.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacStateConfigured.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -173,7 +173,7 @@
{
TRACE_FUNC
Parent().CompletePendingRequests(KOpenAudioReq, aError);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, aError));
}
// -----------------------------------------------------------------------------
@@ -237,7 +237,7 @@
Parent().CompletePendingRequests(KDisconnectReq, KErrNone);
// Cancel all other requests
Parent().CompletePendingRequests(KCompleteAllReqs, KErrCancel);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrNone));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrNone));
}
// -----------------------------------------------------------------------------
--- a/bluetoothengine/btsac/src/btsacStateConfiguring.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacStateConfiguring.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -110,7 +110,7 @@
{
TRACE_FUNC
Parent().CompletePendingRequests((KConnectReq | KOpenAudioReq), aError);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, aError));
}
// -----------------------------------------------------------------------------
--- a/bluetoothengine/btsac/src/btsacStateConnected.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacStateConnected.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -184,7 +184,7 @@
TRACE_FUNC
StopTimer();
Parent().CompletePendingRequests((KConnectReq | KOpenAudioReq), aError);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, aError));
}
// -----------------------------------------------------------------------------
@@ -552,7 +552,7 @@
TRACE_INFO((_L("[SOCKET] created.")))
Parent().iStreamingSockets.Append(aNewSocket);
Parent().CompletePendingRequests(KCompleteAllReqs, KErrCancel);
- TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrNone)));
+ TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrNone)));
}
}
--- a/bluetoothengine/btsac/src/btsacStateConnecting.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacStateConnecting.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -81,7 +81,7 @@
{
TRACE_FUNC
Parent().CompletePendingRequests((KConnectReq | KOpenAudioReq), aError);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, aError));
}
// -----------------------------------------------------------------------------
--- a/bluetoothengine/btsac/src/btsacStateIdle.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacStateIdle.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -102,7 +102,7 @@
void CBtsacIdle::GAVDP_ConfigurationConfirm()
{
TRACE_INFO((_L("CBtsacIdle::GAVDP_ConfigurationConfirm() Local SEPs registered successfully.")))
- TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonNone, KErrNone)));
+ TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent())));
}
// -----------------------------------------------------------------------------
--- a/bluetoothengine/btsac/src/btsacStateListening.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacStateListening.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -35,9 +35,10 @@
// -----------------------------------------------------------------------------
//
CBtsacListening* CBtsacListening::NewL(CBTSAController& aParent,
- TBTSACGavdpResetReason aGavdpResetReason, TInt aDisconnectReason)
+ TBTSACResetGavdp aResetGavdp,
+ TInt aDisconnectReason)
{
- CBtsacListening* self = new( ELeave ) CBtsacListening(aParent, aGavdpResetReason, aDisconnectReason);
+ CBtsacListening* self = new( ELeave ) CBtsacListening(aParent, aResetGavdp, aDisconnectReason);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
@@ -49,10 +50,10 @@
// -----------------------------------------------------------------------------
//
CBtsacListening::CBtsacListening(CBTSAController& aParent,
- TBTSACGavdpResetReason aGavdpResetReason, TInt aDisconnectReason)
-: CBtsacState(aParent, EStateListening), iGavdpResetReason(aGavdpResetReason),
+ TBTSACResetGavdp aResetGavdp, TInt aDisconnectReason)
+: CBtsacState(aParent, EStateListening), iResetGavdp(aResetGavdp),
iDisconnectReason(aDisconnectReason), iPendingRequests(KRequestNone),
- iInitializationProcedure(EInitProcedureOngoing), iUnfinishedGavdpError(EFalse)
+ iInitializationProcedure(EInitProcedureOngoing)
{
}
@@ -262,12 +263,13 @@
case KRequestIdSelfComplete:
{
TBTDevAddr remoteAddr = Parent().GetRemoteAddr();
- if(iUnfinishedGavdpError)
- {
- // We have unfinished gavdp error, force gavdp reset
- iGavdpResetReason = EGavdpResetReasonGeneral;
- }
- if(iGavdpResetReason != EGavdpResetReasonNone)
+#ifdef PRJ_ENABLE_TRACE
+ TBuf<12> buf;
+ remoteAddr.GetReadable(buf);
+ TRACE_INFO((_L("\tremoteAddr = %S"), &buf))
+#endif
+ TRACE_INFO((_L("\tiResetGavdp = %d"), iResetGavdp))
+ if(iResetGavdp == EResetGavdp)
{
ResetGavdp();
}
@@ -275,11 +277,12 @@
{
GoListen();
}
- if((iDisconnectReason == KErrDisconnected || iDisconnectReason == KErrHCILinkDisconnection) &&
- iPendingRequests == KRequestNone)
+ TRACE_INFO((_L("\tiPendingRequests = %d"), iPendingRequests))
+ if(iPendingRequests == KRequestNone)
{
if(remoteAddr != TBTDevAddr())
{
+ TRACE_INFO((_L("\tcalling DisconnectedFromRemote with iDisconnectReason = %d"), iDisconnectReason))
Parent().DisconnectedFromRemote(remoteAddr, iDisconnectReason);
}
Parent().SetResetAudioInput(ETrue);
@@ -397,7 +400,7 @@
if(iInitializationProcedure != EInitProcedureDone)
{
TRACE_INFO((_L("CBtsacListening::HandleGavdpErrorL() error ignored, initialization procedure ongoing.")))
- iUnfinishedGavdpError = ETrue;
+ iResetGavdp = EResetGavdp;
return;
}
switch(aError)
--- a/bluetoothengine/btsac/src/btsacStateStreaming.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacStateStreaming.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -99,7 +99,7 @@
TRACE_INFO((_L("CBtsacStreaming::Cancel() iStreamer.StopStream() returned error(%d) !!!"), ret))
}
Parent().CompletePendingRequests(KCompleteAllReqs, aError);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, aError));
}
// -----------------------------------------------------------------------------
@@ -151,7 +151,7 @@
TRACE_FUNC
// For safety sake complete all pending requests
Parent().CompletePendingRequests(KCompleteAllReqs, KErrNone);
- TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected)));
+ TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected)));
}
@@ -171,7 +171,7 @@
{
TRACE_INFO((_L("CBtsacStreaming::StartRecording() Couldn't abort stream.")))
}
- TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected)));
+ TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected)));
}
}
@@ -188,7 +188,7 @@
TRACE_INFO((_L("CBtsacStreaming::DisconnectL() StopStream() returned error: %d"), ret))
}
Parent().CompletePendingRequests(KDisconnectReq, ret);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrNone));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrNone));
}
// -----------------------------------------------------------------------------
@@ -220,7 +220,7 @@
// It is possible the remote disconnected while we have active close audio request.
Parent().CompletePendingRequests(KCompleteAllReqs, KErrNone);
- TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected)));
+ TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected)));
}
// -----------------------------------------------------------------------------
@@ -339,7 +339,7 @@
else
{
Parent().CompletePendingRequests(KCompleteAllReqs, aError);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected));
}
break;
}
@@ -347,7 +347,7 @@
case KErrDisconnected: // -36
{
Parent().CompletePendingRequests(KCompleteAllReqs, aError);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, aError));
break;
}
default:
@@ -355,7 +355,7 @@
// Unknown error. For safety's sake let's disconnect a2dp link and inform btaudioman
TRACE_INFO((_L("CBtsacStreaming::HandleGavdpErrorL() Unknown error, goes to listening")))
Parent().CompletePendingRequests(KCompleteAllReqs, aError);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected));
break;
}
}
--- a/bluetoothengine/btsac/src/btsacStateSuspended.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacStateSuspended.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -87,7 +87,7 @@
{
TRACE_FUNC
Parent().CompletePendingRequests(KOpenAudioReq, aError);
- Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError));
+ Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, aError));
}
// -----------------------------------------------------------------------------
--- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceClient.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceClient.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -25,12 +25,12 @@
#include "BTConnectionTimer.h"
#include "BTSUDebug.h"
-const TUint16 KMtuSizeReceiv = 0xFFFF; // 64kB
-const TUint16 KMtuSizeTrans = 0x3000; // 12kB
-const TInt KBufferSize = 0x4000; // 16kB
+const TUint16 KMtuSizeReceiv = 0xFFFF; // 64kB - 1 (65535)
+const TUint16 KMtuSizeTrans = 0x8000; // 32kB
+const TInt KBufferSize = 0x8000; // 32kB
-const TInt KBTConnectionTimeout = 20000000; // 20 seconds
-const TInt KBTAbortTimeout = 2000000; // 20 seconds
+const TInt KBTConnectionTimeout = 20 * 1000 * 1000; // 20 seconds
+const TInt KBTAbortTimeout = 2 * 1000 * 1000; // 2 seconds
// CONSTANTS
--- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -743,7 +743,7 @@
{
FLOG(_L("[BTSU]\t CBTServiceStarter::ServiceAttributeSearchComplete()"));
TInt err = KErrNone;
- if (aErr==KErrEof && aAttr.Count()>0 )
+ if ((aErr==KErrEof || aErr==KErrNone) && aAttr.Count()>0 )
{
RSdpResultArray results=aAttr;
iBTEngDiscovery->ParseRfcommChannel(results,iClientChannel);
@@ -812,6 +812,10 @@
iState = EBTSStarterFindingBIP;
iTriedOPP = ETrue;
}
+ else if (aErr==KErrNone && aAttr.Count()==0)
+ {
+ // This isn't KErrEof so we aren't done yet, wait for further matches
+ }
else
{
// Set destroyer AO active (destroys CBTEngDiscovery/CBTEngSdpQuery classes). This is done
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/data/2002C3BA_TDSCDMA.rss Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,42 @@
+// Copyright (c) 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"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+// Contributors:
+//
+
+#include "../inc/atmisccmdpluginuids.hrh"
+#include <ecom/registryinfo.rh>
+#include <atext_interfaceuid.h>
+
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x2002C3BA;//KUidATCFunEcomDll;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x2001CBEE; // ATEXT_INTERFACE_DUN_UID;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x2002DC6B;// KUidATMiscCmdEcomImpl;
+ version_no = 1;
+ display_name = "Miscellaneous AT commands Implementation";
+ default_data = "MAT+CLCK|MAT+CPWD|MAT+CUSD|MAT+CPIN|MAT+CNUM|MAT+CFUN|MAT+CBC|OAT+CMEE|MAT^HVER|MAT+CGSN|MAT+CGMR|MAT+CGMI|MAT+CMGD|OAT+CMGF";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
+// End of file
--- a/cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp Mon Jul 12 19:13:27 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp Mon Jul 12 19:25:26 2010 +0300
@@ -13,13 +13,19 @@
*
*/
+FEATUREVARIANT
+
#include <platform_paths.hrh>
#include <data_caging_paths.hrh>
#include "../inc/atmisccmdpluginuids.hrh"
CAPABILITY CAP_ECOM_PLUGIN
VENDORID VID_DEFAULT
+#ifdef PROTOCOL_TDSCDMA
+TARGET atmisccmdplugin_td.dll
+#else
TARGET atmisccmdplugin.dll
+#endif
TARGETTYPE PLUGIN
UID 0x10009D8D 0x2002C3BA
@@ -42,15 +48,30 @@
SOURCE ussdreadmessageimpl.cpp
SOURCE ussdsendmessageimpl.cpp
+#ifdef PROTOCOL_TDSCDMA
+SOURCE hvercommandhandler.cpp
+SOURCE cgsncommandhandler.cpp
+SOURCE cgmrcommandhandler.cpp
+SOURCE cmgwcommandhandler.cpp
+SOURCE cgmicommandhandler.cpp
+SOURCE cmgdcommandhandler.cpp
+SOURCE telephonywrapper.cpp
+#endif
USERINCLUDE ../inc
MW_LAYER_SYSTEMINCLUDE
+// Resources - inclusion controlled by iby
START RESOURCE ../data/2002C3BA.rss
TARGET atmisccmdplugin.rsc
END
+START RESOURCE ../data/2002C3BA_TDSCDMA.rss
+TARGET atmisccmdplugin_td.rsc
+END
+
+
LIBRARY ecom.lib
LIBRARY euser.lib
LIBRARY atextpluginbase.lib
@@ -65,8 +86,6 @@
LIBRARY etel3rdparty.lib
LIBRARY sysutil.lib
-LIBRARY flogger.lib
+DEBUGLIBRARY flogger.lib
-MACRO _DEBUG
-MACRO USE_FILE_LOGGING
// End of File
--- a/cbsatplugin/atmisccmdplugin/inc/atcommandparser.h Mon Jul 12 19:13:27 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/atcommandparser.h Mon Jul 12 19:25:26 2010 +0300
@@ -53,7 +53,14 @@
ECmdAtCpin,
ECmdAtCusd,
ECmdAtCnum,
- ECmdAtCmee
+ ECmdAtCmee,
+ ECmdAtHver,
+ ECmdAtCgsn,
+ ECmdAtCgmr,
+ ECmdAtCgmi,
+ ECmdAtCmgw,
+ ECmdAtCmgd,
+ ECmdAtCmgf
};
public:
TAtCommandParser();
--- a/cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h Mon Jul 12 19:13:27 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h Mon Jul 12 19:25:26 2010 +0300
@@ -81,6 +81,13 @@
*/
virtual void CreateCMEReplyAndComplete(TInt aError) = 0;
+ /*
+ * Complete the AT command request with AT CMS error code according to given Symbian error code
+ * @param aError Symbian error code
+ */
+
+ virtual void CreateCMSReplyAndComplete(TInt aError) = 0;
+
/**
* Returns plugin's character value settings (from CATExtPluginBase)
*
@@ -137,6 +144,10 @@
virtual TInt CreateOkOrErrorReply( RBuf8& aReplyBuffer,
TBool aOkReply );
+
+ virtual TInt CreateEditModeBuffer( RBuf8& aReplyBuffer );
+ virtual void CreateCMSReplyAndComplete(TInt aError);
+
virtual void CreateCMEReplyAndComplete(TInt aError);
virtual TInt GetCharacterValue( TCharacterTypes aCharType, TChar& aChar );
virtual TInt GetModeValue( TModeTypes aModeType, TBool& aMode );
@@ -148,7 +159,8 @@
TInt CreatePartOfReply( RBuf8& aBuffer );
void HandleCMEECommand();
-
+ void HandleCMGFCommand();
+
/*
* Utility function that connect to Etel server and establish a subsession to RMobilePhone
* Caller must close session and subsession after use.
@@ -175,7 +187,15 @@
CATCmdAsyncBase* iCNUMHandler;
CATCmdAsyncBase* iCFUNHandler;
CATCmdAsyncBase* iCBCHandler;
-
+
+ // TDSCDMA only
+ CATCmdSyncBase* iHVERHandler;
+ CATCmdSyncBase* iCGSNHandler;
+ CATCmdSyncBase* iCGMRHandler;
+ CATCmdSyncBase* iCGMIHandler;
+ CATCmdAsyncBase* iCMGWHandler;
+ CATCmdAsyncBase* iCMGDHandler;
+
/**
* Buffer for handle command's command
* Not own.
--- a/cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h Mon Jul 12 19:13:27 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h Mon Jul 12 19:25:26 2010 +0300
@@ -21,15 +21,17 @@
_LIT8(KCRLF, "\r\n");
_LIT8(KOKCRLF, "\r\n\r\nOK\r\n");
-_LIT8(KAtCLCK, "+CLCK: ");
+_LIT8(KAtCLCK, "\r\n+CLCK: ");
_LIT8(KAtCFUN, "+CFUN: ");
_LIT8(KAtCBC, "+CBC: ");
_LIT8(KAtCUSD, "+CUSD: ");
+_LIT8(KAtCMGW, "+CMGW: ");
-_LIT8(KCLCKSupportedCmdsList, "+CLCK: (\"PS\",\"SC\",\"AO\",\"OI\",\"OX\",\"AI\",\"IR\",\"AB\",\"AG\",\"AC\")\r\n\r\nOK\r\n");
-_LIT8(KCFUNSupportedCmdsList, "+CFUN: (0,1,4),(0,1)\r\n\r\nOK\r\n");
-_LIT8(KCBCSupportedCmdsList, "+CBC: (0,1,2,3),(1...100)\r\n\r\nOK\r\n");
+_LIT8(KCLCKSupportedCmdsList, "\r\n+CLCK: (\"PS\",\"SC\",\"AO\",\"OI\",\"OX\",\"AI\",\"IR\",\"AB\",\"AG\",\"AC\")\r\n\r\nOK\r\n");
+_LIT8(KCFUNSupportedCmdsList, "\r\n+CFUN: (0,1,4),(0,1)\r\n\r\nOK\r\n");
+_LIT8(KCBCSupportedCmdsList, "\r\n+CBC: (0,1,2,3),(1...100)\r\n\r\nOK\r\n");
_LIT8(KCUSDSupportedCmdsList, "+CUSD: (0,1)\r\n\r\nOK\r\n");
+_LIT8(KCMGDSupportedCmdsList, "\r\n+CMGD: (%S), (0,1,2,3,4)\r\n");
_LIT8(KATCLCKPS, "PS");
_LIT8(KATCLCKSC, "SC");
@@ -42,7 +44,12 @@
_LIT8(KATCLCKAG, "AG");
_LIT8(KATCLCKAC, "AC");
+_LIT8(KHVERModelString, "RM-");
+
+_LIT8(KCMSErr, "+CMS ERROR: ");
+
// Max buffer length for an MD5 digest - originally defined in SCPServerInterface.h
const TInt KSCPMaxHashLength( 32 );
+
#endif // ATMISCCMDPLUGINCONSTS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/cgmicommandhandler.h Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ * CGMICommandHandler class declaration for AT+CGMI command
+ *
+ */
+
+#ifndef CGMICOMMANDHANDLER_H
+#define CGMICOMMANDHANDLER_H
+
+#include "atcmdsyncbase.h"
+
+#include <Etel3rdParty.h>
+
+/**
+ * AT+CGMI command handler implementation class
+ */
+NONSHARABLE_CLASS( CCGMICommandHandler ) : public CATCmdSyncBase
+ {
+public:
+ static CCGMICommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ ~CCGMICommandHandler();
+
+public:
+ void SetManufacturer(const TDesC8& aManufacturer);
+ void SetTelephonyError(TInt aTelError);
+
+private: // methods from CATCmdSyncBase
+ virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+private:
+ CCGMICommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ void ConstructL();
+
+private:
+ TInt iTelError;
+ TBuf8<CTelephony::KPhoneManufacturerIdSize> iManufacturer;
+
+ RBuf8 iReply;
+ };
+
+#endif /* CGMICOMMANDHANDLER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/cgmrcommandhandler.h Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ * CGMRCommandHandler class declaration for AT+CGMR command
+ *
+ */
+
+#ifndef CGMRCOMMANDHANDLER_H
+#define CGMRCOMMANDHANDLER_H
+
+
+#include "atcmdsyncbase.h"
+
+/**
+ * AT+CGMR command handler implementation class
+ */
+NONSHARABLE_CLASS( CCGMRCommandHandler ) : public CATCmdSyncBase
+ {
+public:
+ static CCGMRCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ ~CCGMRCommandHandler();
+
+private: // methods from CATCmdSyncBase
+ virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+private:
+ CCGMRCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ void ConstructL();
+
+ TInt GetSoftwareVersion();
+
+private:
+ RBuf8 iReply;
+ };
+
+#endif /* CGMRCOMMANDHANDLER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/cgsncommandhandler.h Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ * CGSNCommandHandler class declaration for AT+CGSN command
+ *
+ */
+
+#ifndef CGSNCOMMANDHANDLER_H
+#define CGSNCOMMANDHANDLER_H
+
+#include "atcmdsyncbase.h"
+
+#include <Etel3rdParty.h>
+
+/**
+ * AT+CGSN command handler implementation class
+ */
+NONSHARABLE_CLASS( CCGSNCommandHandler ) : public CATCmdSyncBase
+ {
+public:
+ static CCGSNCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ ~CCGSNCommandHandler();
+
+public:
+ void SetSerialNum(const TDesC8& aSerial);
+ void SetTelephonyError(TInt aTelError);
+
+private: // methods from CATCmdSyncBase
+ virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+private:
+ CCGSNCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ void ConstructL();
+
+private:
+ TInt iTelError;
+ TBuf8<CTelephony::KPhoneSerialNumberSize> iSN;
+
+ RBuf8 iReply;
+ };
+
+#endif /* CGSNCOMMANDHANDLER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/cmgdcommandhandler.h Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ * CCMGDCommandHandler class declaration for AT+CMGD command
+ *
+ */
+
+#ifndef CMGDCOMMANDHANDLER_H
+#define CMGDCOMMANDHANDLER_H
+
+#include "atcmdasyncbase.h"
+
+#include <etelmm.h>
+
+class CMobilePhoneGsmSmsList;
+class CRetrieveMobilePhoneSmsList;
+/**
+ * AT+CMGD command handler implementation class
+ */
+NONSHARABLE_CLASS( CCMGDCommandHandler ) : public CATCmdAsyncBase
+ {
+private:
+/**
+ * States for CMGD command handler
+ */
+enum TCMGDState
+ {
+ ECMGDStateIdle,
+ ECMGDStateRetrieveAllIndices,
+ ECMGDStateDeleteOneEntry,
+ ECMGDStateDeleteFilteredEntries,
+ ECMGDStateDeleteAllEntries,
+ ECMGDStateSimStoreNotSupported
+ };
+
+enum TCMGDFilter
+ {
+ ECMGDFilterReadMessagesOnly,
+ ECMGDFilterReadAndSentMessages,
+ ECMGDFilterReadSentAndUnsentMessages
+ };
+
+public:
+ static CCMGDCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ ~CCMGDCommandHandler();
+
+private: // methods from CActive
+
+ virtual void RunL();
+ virtual void DoCancel();
+ virtual TInt RunError(TInt aError);
+
+private: // methods from CATCmdAsyncBase
+
+ virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+private:
+
+ CCMGDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ void ConstructL();
+
+ TInt ParseParameters();
+ TInt DoHandleCommand();
+
+ void GetMessageIndexListL();
+ void FilterMessageListL();
+
+private:
+
+ RMobileSmsMessaging iMobileSmsMessaging;
+ RMobileSmsStore iMobileSmsStore;
+
+ CRetrieveMobilePhoneSmsList* iRetrieveSmsList;
+ CMobilePhoneGsmSmsList* iGsmSmsList;
+
+ TCMGDState iHandlerState;
+ TCMGDFilter iFilterType;
+ TInt iIndex;
+ TInt iDelFlag;
+ RArray<TInt> iDeleteList;
+
+ RBuf8 iReply;
+ };
+
+#endif /* CMGDCommandHandler_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/cmgwcommandhandler.h Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ * CMGWCommandHandler class declaration for AT+CMGW command
+ *
+ */
+
+#ifndef CMGWCOMMANDHANDLER_H
+#define CMGWCOMMANDHANDLER_H
+
+#include "atcmdasyncbase.h"
+
+#include <etel3rdparty.h>
+#include <etelmm.h>
+
+class CRetrieveMobilePhoneSmspList;
+class CMobilePhoneSmspList;
+
+/**
+ * AT+CMGW command handler implementation class
+ */
+NONSHARABLE_CLASS( CCMGWCommandHandler ) : public CATCmdAsyncBase
+ {
+private:
+ enum TCMGWState
+ {
+ ECMGWStateIdle, // Idle
+ ECMGWStateEditMode, // Edit mode
+ ECMGWStateRetrieveSCA, // Retrieve SCA
+ ECMGWStatePreparePDU,
+ ECMGWStateWritePDU, // Write PDU
+ ECMGWStateSimStoreNotSupported // Sim store not supported
+ };
+
+public:
+ static CCMGWCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ ~CCMGWCommandHandler();
+
+ void SetMessageFormat(TInt aFormat);
+
+private: // methods from CActive
+ virtual void RunL();
+ virtual void DoCancel();
+ virtual TInt RunError (TInt aError);
+
+private: // methods from CATCmdAsyncBase
+ virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+private:
+ CCMGWCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ void ConstructL();
+
+ void HandleEditModeCommand( const TDesC8& aCmd );
+ TInt ParseParameters();
+ TInt CreateSmsEntry();
+ TInt ExtractSCA();
+
+private:
+ RMobileSmsMessaging iMobileSmsMessaging;
+ RMobileSmsStore iMobileSmsStore;
+ CRetrieveMobilePhoneSmspList* iRetrieveMobilePhoneSmspList;
+ CMobilePhoneSmspList* iMobilePhoneSmspList;
+ RMobileSmsMessaging::TMobileSmspEntryV1 iMobileSmspEntry;
+
+ RMobilePhone::TMobileAddress iServiceCentre;
+
+ TCMGWState iState;
+ RBuf8 iTPDU;
+
+ TInt iTPDULength;
+ TInt iTPDUStat;
+ TUint8 iSCALength;
+ RMobileSmsStore::TMobileSmsStoreStatus iMessageStatus;
+
+ RMobileSmsStore::TMobileGsmSmsEntryV1 iEntry;
+ RMobileSmsStore::TMobileGsmSmsEntryV1Pckg iEntryPckg;
+
+ RBuf8 iReply;
+
+ TInt iMsgFormat;
+ };
+
+#endif /* CMGWCOMMANDHANDLER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/cmserror.h Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description : define all +CMS Error codes.
+ * Reference:
+ * 3GPP TS 27.007 version 6.9.0 Release 6 118 ETSI TS 127 007 V6.9.0 (2007-06)
+ *
+ */
+
+#ifndef CMSERROR_H
+#define CMSERROR_H
+
+enum TATCMSError
+ {
+ EATCmsErrGeneral = 0,
+ EATCMSErr301 = 301,
+ EATCMSErr304 = 304,
+ EATCMSErr310 = 310,
+ EATCMSErr311 = 311,
+ EATCMSErr312 = 312,
+ EATCMSErr316 = 316,
+ EATCMSErr320 = 320,
+ EATCMSErr321 = 321,
+ EATCMSErr322 = 322
+ };
+
+#endif /* CMSERROR_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/hvercommandhandler.h Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ * CHVERCommandHandler class declaration for AT^HVER command
+ *
+ */
+
+#ifndef CHVERCOMMANDHANDLER_H
+#define CHVERCOMMANDHANDLER_H
+
+#include "atcmdsyncbase.h"
+#include "debug.h"
+
+#include <Etel3rdParty.h>
+
+/**
+ * AT^HVER command handler implementation class
+ */
+NONSHARABLE_CLASS( CHVERCommandHandler ) : public CATCmdSyncBase
+ {
+public:
+ static CHVERCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ ~CHVERCommandHandler();
+
+public:
+ void SetHWVersion(const TDesC8& aHWVersion);
+ void SetTelephonyError(TInt aTelError);
+
+private: // methods from CATCmdSyncBase
+ virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+private:
+ CHVERCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+ void ConstructL();
+
+ void ParseSWVersion(const TDesC8& aSWVersion);
+
+private:
+ TInt iTelError;
+ TBuf8<CTelephony::KPhoneModelIdSize> iModel;
+
+ RBuf8 iSWVersion;
+ RBuf8 iReply;
+ };
+
+#endif /* CHVERCOMMANDHANDLER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/telephonywrapper.h Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ * CTelephonyWrapper class declaration for wrapping CTelephony::GetPhoneId
+ *
+ */
+
+#ifndef TELEPHONYWRAPPER_H
+#define TELEPHONYWRAPPER_H
+
+#include <etel3rdparty.h>
+
+/**
+ * Synchronous wrapper for CTelephony::GetPhoneId
+ */
+NONSHARABLE_CLASS (CTelephonyWrapper) : public CActive
+ {
+public:
+ static CTelephonyWrapper* NewL();
+ virtual ~CTelephonyWrapper();
+
+ TInt SynchronousGetPhoneId();
+
+ const TDesC8& GetPhoneModel();
+ const TDesC8& GetPhoneSerialNum();
+ const TDesC8& GetPhoneManufacturer();
+
+private: // From CActive
+ virtual void RunL();
+ virtual void DoCancel();
+
+private: // Constructors
+ CTelephonyWrapper();
+ void ConstructL();
+
+private:
+ CActiveSchedulerWait iWaiter;
+
+ CTelephony* iTelephony;
+ CTelephony::TPhoneIdV1 iPhoneIdV1;
+ CTelephony::TPhoneIdV1Pckg iPhoneIdV1Pckg;
+
+ TBufC8<CTelephony::KPhoneModelIdSize> iModel;
+ TBufC8<CTelephony::KPhoneSerialNumberSize> iSn;
+ TBufC8<CTelephony::KPhoneManufacturerIdSize> iManufacturer;
+
+ };
+
+#endif /* TELEPHONYWRAPPER_H */
--- a/cbsatplugin/atmisccmdplugin/rom/atmisccmdplugin.iby Mon Jul 12 19:13:27 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/rom/atmisccmdplugin.iby Mon Jul 12 19:25:26 2010 +0300
@@ -16,7 +16,11 @@
#ifndef ATMISCCMDPLUGIN_IBY
#define ATMISCCMDPLUGIN_IBY
+#ifdef PROTOCOL_TDSCDMA
+ECOM_PLUGIN(atmisccmdplugin_td.dll, atmisccmdplugin_td.rsc)
+#else
ECOM_PLUGIN(atmisccmdplugin.dll, atmisccmdplugin.rsc)
+#endif
#endif // ATMISCCMDPLUGIN_IBY
--- a/cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -58,7 +58,16 @@
_LIT8(KAtCpin, "AT+CPIN");
_LIT8(KAtCusd, "AT+CUSD");
_LIT8(KAtCnum, "AT+CNUM");
- _LIT8(KAtCmee, "AT+CMEE");
+ _LIT8(KAtCmee, "AT+CMEE");
+#ifdef PROTOCOL_TDSCDMA
+ _LIT8(KAtHver, "AT^HVER");
+ _LIT8(KAtCgsn, "AT+CGSN");
+ _LIT8(KAtCgmr, "AT+CGMR");
+ _LIT8(KAtCgmi, "AT+CGMI");
+ _LIT8(KAtCmgw, "AT+CMGW");
+ _LIT8(KAtCmgd, "AT+CMGD");
+ _LIT8(KAtCmgf, "AT+CMGF");
+#endif
Trace(KDebugPrintS, "token: ", &token);
// Determine the AT command type
@@ -93,7 +102,37 @@
else if(!token.Compare(KAtCmee))
{
iCmdType = ECmdAtCmee;
+ }
+#ifdef PROTOCOL_TDSCDMA
+ else if(!token.CompareF(KAtHver))
+ {
+ iCmdType = ECmdAtHver;
}
+ else if(!token.CompareF(KAtCgsn))
+ {
+ iCmdType = ECmdAtCgsn;
+ }
+ else if(!token.CompareF(KAtCgmr))
+ {
+ iCmdType = ECmdAtCgmr;
+ }
+ else if(!token.CompareF(KAtCgmi))
+ {
+ iCmdType = ECmdAtCgmi;
+ }
+ else if(!token.CompareF(KAtCmgw))
+ {
+ iCmdType = ECmdAtCmgw;
+ }
+ else if(!token.CompareF(KAtCmgd))
+ {
+ iCmdType = ECmdAtCmgd;
+ }
+ else if(!token.CompareF(KAtCmgf))
+ {
+ iCmdType = ECmdAtCmgf;
+ }
+#endif
else
{
iCmdType = EUnknown;
--- a/cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp Mon Jul 12 19:13:27 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -24,13 +24,25 @@
#include "cnumcommandhandler.h"
#include "cfuncommandhandler.h"
#include "cbccommandhandler.h"
+#ifdef PROTOCOL_TDSCDMA
+#include "hvercommandhandler.h"
+#include "cgsncommandhandler.h"
+#include "cgmrcommandhandler.h"
+#include "cgmicommandhandler.h"
+#include "cmgwcommandhandler.h"
+#include "cmgdcommandhandler.h"
+#include "telephonywrapper.h"
+#endif
+
#include "atmisccmdpluginconsts.h"
+#include "cmserror.h"
#include "debug.h"
-#include <EXTERROR.H> // Additional RMobilePhone error code
+#include <exterror.h> // Additional RMobilePhone error code
// +CME error code
+_LIT8(KCMEMemoryFailure, "+CME ERROR: 23\r\n"); // Memory failure.\r\n
_LIT8(KCMEIncorrectPassword, "+CME ERROR: 16\r\n"); // Incorrect password.\r\n
_LIT8(KCMEPUKRequired, "+CME ERROR: 12\r\n"); // PUK required.\r\n
_LIT8(KCMENotAllowed, "+CME ERROR: 3\r\n"); // Operation not allowed.\r\n
@@ -38,6 +50,7 @@
_LIT8(KCMEPhoneUnknown, "+CME ERROR: 100\r\n"); // unknown error
const TInt KErrorReplyLength = 9; // CR+LF+"ERROR"+CR+LF
+const TInt KEditorReplyLength = 4; // CR+LF+'>'+' '
CATMiscCmdPlugin* CATMiscCmdPlugin::NewL()
{
@@ -59,7 +72,15 @@
delete iCNUMHandler;
delete iCFUNHandler;
delete iCBCHandler;
-
+#ifdef PROTOCOL_TDSCDMA
+ delete iHVERHandler;
+ delete iCGSNHandler;
+ delete iCGMRHandler;
+ delete iCGMIHandler;
+ delete iCMGWHandler;
+ delete iCMGDHandler;
+#endif
+
iPhone.Close();
iTelServer.Close();
}
@@ -81,6 +102,34 @@
iCNUMHandler = CCNUMCommandHandler::NewL(this, iCommandParser, iPhone, iTelServer);
iCFUNHandler = CCFUNCommandHandler::NewL(this, iCommandParser, iPhone);
iCBCHandler = CCBCCommandHandler::NewL(this, iCommandParser, iPhone);
+
+#ifdef PROTOCOL_TDSCDMA
+ iHVERHandler = CHVERCommandHandler::NewL(this, iCommandParser, iPhone);
+ iCGSNHandler = CCGSNCommandHandler::NewL(this, iCommandParser, iPhone);
+ iCGMRHandler = CCGMRCommandHandler::NewL(this, iCommandParser, iPhone);
+ iCGMIHandler = CCGMICommandHandler::NewL(this, iCommandParser, iPhone);
+ iCMGWHandler = CCMGWCommandHandler::NewL(this, iCommandParser, iPhone);
+ iCMGDHandler = CCMGDCommandHandler::NewL(this, iCommandParser, iPhone);
+
+ // Get telephony information - Model, IMEI, Manufacturer
+ CTelephonyWrapper* telephonyWrapper = CTelephonyWrapper::NewL();
+ TInt result = telephonyWrapper->SynchronousGetPhoneId();
+
+ if (KErrNone == result)
+ {
+ static_cast<CHVERCommandHandler*>(iHVERHandler)->SetHWVersion(telephonyWrapper->GetPhoneModel());
+ static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetSerialNum(telephonyWrapper->GetPhoneSerialNum());
+ static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetManufacturer(telephonyWrapper->GetPhoneManufacturer());
+ }
+ else // The result is used to determine whether to display CME error or not
+ {
+ static_cast<CHVERCommandHandler*>(iHVERHandler)->SetTelephonyError(result);
+ static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetTelephonyError(result);
+ static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetTelephonyError(result);
+ }
+ delete telephonyWrapper;
+#endif
+
TRACE_FUNC_EXIT
}
@@ -150,9 +199,46 @@
}
case (TAtCommandParser::ECmdAtCmee):
{
+ iCurrentHandler = NULL;
+ break;
+ }
+#ifdef PROTOCOL_TDSCDMA
+ case (TAtCommandParser::ECmdAtHver):
+ {
+ iCurrentHandler = iHVERHandler;
+ break;
+ }
+ case (TAtCommandParser::ECmdAtCgsn):
+ {
+ iCurrentHandler = iCGSNHandler;
+ break;
+ }
+ case (TAtCommandParser::ECmdAtCgmr):
+ {
+ iCurrentHandler = iCGMRHandler;
+ break;
+ }
+ case (TAtCommandParser::ECmdAtCgmi):
+ {
+ iCurrentHandler = iCGMIHandler;
+ break;
+ }
+ case (TAtCommandParser::ECmdAtCmgw):
+ {
+ iCurrentHandler = iCMGWHandler;
+ break;
+ }
+ case (TAtCommandParser::ECmdAtCmgd):
+ {
+ iCurrentHandler = iCMGDHandler;
+ break;
+ }
+ case (TAtCommandParser::ECmdAtCmgf):
+ {
iCurrentHandler = NULL;
break;
}
+#endif
case (TAtCommandParser::EUnknown):
default:
{
@@ -179,6 +265,13 @@
HandleCMEECommand();
HandleCommandCompleted( KErrNone, EReplyTypeOk);
}
+#ifdef PROTOCOL_TDSCDMA
+ else if (iCommandParser.Command() == TAtCommandParser::ECmdAtCmgf)
+ {
+ HandleCMGFCommand();
+ HandleCommandCompleted( KErrNone, EReplyTypeOk);
+ }
+#endif
else if (iCurrentHandler != NULL)
{
iHcCmd = &aCmd;
@@ -278,30 +371,29 @@
{
TRACE_FUNC_ENTRY
TInt ret = KErrNone;
- TInt partLength;
if ( iReplyBuffer.Length() <= 0 )
{
ret = KErrGeneral;
}
else
{
- partLength = NextReplyPartLength();
+ TInt partLength = NextReplyPartLength();
if ( iReplyBuffer.Length() < partLength )
{
ret = KErrNotFound;
}
- }
- Trace(KDebugPrintD, "ret: ", ret);
- if (ret == KErrNone)
- {
- aBuffer.Create( iReplyBuffer, partLength );
- iReplyBuffer.Delete( 0, partLength );
- if ( iReplyBuffer.Length() == 0 )
- {
- iReplyBuffer.Close();
- }
+ else if (ret == KErrNone)
+ {
+ aBuffer.Create( iReplyBuffer, partLength );
+ iReplyBuffer.Delete( 0, partLength );
+ if ( iReplyBuffer.Length() == 0 )
+ {
+ iReplyBuffer.Close();
+ }
+ }
}
+ Trace(KDebugPrintD, "ret: ", ret);
TRACE_FUNC_EXIT
return ret;
}
@@ -348,6 +440,11 @@
{
case EReplyTypeOther:
break;
+#ifdef PROTOCOL_TDSCDMA
+ case EReplyTypeEditor:
+ CreateEditModeBuffer( iReplyBuffer );
+ break;
+#endif
case EReplyTypeOk:
CreateOkOrErrorReply( iReplyBuffer, ETrue );
break;
@@ -360,9 +457,12 @@
}
CreatePartOfReply( *iHcReply );
HandleCommandCompleted( KErrNone, aReplyType );
- iHcCmd = NULL;
- iHcReply = NULL;
- iCurrentHandler = NULL;
+ if ( EReplyTypeEditor != aReplyType )
+ {
+ iHcCmd = NULL;
+ iHcReply = NULL;
+ iCurrentHandler = NULL;
+ }
TRACE_FUNC_EXIT
return KErrNone;
}
@@ -414,6 +514,28 @@
}
/**
+ * @see MATMiscCmdPlugin::CreateEditModeBuffer
+ */
+TInt CATMiscCmdPlugin::CreateEditModeBuffer( RBuf8& aReplyBuffer )
+ {
+ TRACE_FUNC_ENTRY
+ _LIT8( KReplyPromptAndSpace, "> " );
+ TBuf8<KEditorReplyLength> replyBuffer;
+ replyBuffer.Append( iCarriageReturn );
+ replyBuffer.Append( iLineFeed );
+ replyBuffer.Append( KReplyPromptAndSpace );
+
+ TInt err = aReplyBuffer.ReAlloc( aReplyBuffer.Length() + replyBuffer.Length() );
+ if (KErrNone != err)
+ {
+ return err;
+ }
+ aReplyBuffer.Append( replyBuffer );
+ TRACE_FUNC_EXIT
+ return KErrNone;
+ }
+
+/**
* @see MATMiscCmdPlugin::GetCharacterValue
*/
TInt CATMiscCmdPlugin::GetCharacterValue( TCharacterTypes aCharType,
@@ -501,6 +623,12 @@
response.Append(KCMENotAllowed);
break;
}
+ case KErrGsmMMImeiNotAccepted:
+ {
+ // Memory failure
+ response.Append(KCMEMemoryFailure);
+ break;
+ }
case KErrUnknown:
{
// unknown error
@@ -524,6 +652,101 @@
TRACE_FUNC_EXIT
}
+void CATMiscCmdPlugin::CreateCMSReplyAndComplete(TInt aError)
+ {
+ TRACE_FUNC_ENTRY
+
+ if(iQuietMode)
+ {
+ CreateReplyAndComplete(EReplyTypeError);
+ }
+ else
+ {
+ // return error code to AT client
+ RBuf8 response;
+ if (KErrNone != response.Create(KDefaultCmdBufLength))
+ {
+ CreateReplyAndComplete(EReplyTypeError);
+ return;
+ }
+
+ // return error code to AT client
+ response.Append(KCRLF);
+ response.Append(KCMSErr);
+
+ switch(aError)
+ {
+ case KErrGsmSMSReserved:
+ {
+ // Other application cause SMS interface being reserved
+ response.AppendNum(EATCMSErr301);
+ break;
+ }
+ case KErrGsmSMSInvalidPDUModeParameter:
+ {
+ // Under the mode of PDU, PDU parameter error
+ response.AppendNum(EATCMSErr304);
+ break;
+ }
+ case KErrNotReady:
+ case KErrNotFound:
+ case KErrGsmSMSSimNotInserted:
+ {
+ // SIM card not inserted
+ response.AppendNum(EATCMSErr310);
+ break;
+ }
+ case KErrGsmSMSSimPin1Required:
+ {
+ // PIN request by SIM card
+ response.AppendNum(EATCMSErr311);
+ break;
+ }
+ case KErrGsmSMSPhoneToSimLockRequired:
+ {
+ // PH-(U) SIM PIN request by SIM card
+ response.AppendNum(EATCMSErr312);
+ break;
+ }
+ case KErrGsmSMSSimPuk1Required:
+ {
+ // PUK request by SIM card
+ response.AppendNum(EATCMSErr316);
+ break;
+ }
+ case KErrGsmSMSMemoryFailure:
+ {
+ // Memory error
+ response.AppendNum(EATCMSErr320);
+ break;
+ }
+ case KErrPathNotFound:
+ case KErrGsmSMSInvalidMemoryIndex:
+ {
+ // Invalid Memory index number
+ response.AppendNum(EATCMSErr321);
+ break;
+ }
+ case KErrOverflow:
+ case KErrGsmSMSMemoryFull:
+ {
+ // Memory is full
+ response.AppendNum(EATCMSErr322);
+ break;
+ }
+ default:
+ {
+ response.AppendNum(EATCmsErrGeneral);
+ break;
+ }
+ }
+ CreateReplyAndComplete( EReplyTypeError, response );
+ response.Close();
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
TInt CATMiscCmdPlugin::HandleUnsolicitedRequest(const TDesC8& aAT )
{
TRACE_FUNC_ENTRY
@@ -555,6 +778,29 @@
TRACE_FUNC_EXIT
}
+
+void CATMiscCmdPlugin::HandleCMGFCommand()
+ {
+ TRACE_FUNC_ENTRY
+
+#ifdef PROTOCOL_TDSCDMA
+ TAtCommandParser::TCommandHandlerType cmdHandlerType = iCommandParser.CommandHandlerType();
+
+ if (cmdHandlerType == TAtCommandParser::ECmdHandlerTypeSet)
+ {
+ TInt msgFormat = 0;
+ TInt ret = iCommandParser.NextIntParam(msgFormat);
+ if(ret == KErrNone && iCMGWHandler)
+ {
+ static_cast<CCMGWCommandHandler*> (iCMGWHandler)->SetMessageFormat(msgFormat);
+ }
+ }
+#endif
+
+ TRACE_FUNC_EXIT
+ }
+
+
void CATMiscCmdPlugin::ConnectToEtelL(RTelServer& aTelServer, RMobilePhone& aPhone)
{
TRACE_FUNC_ENTRY
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/src/cgmicommandhandler.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description :
+ *
+ */
+
+#include "cgmicommandhandler.h"
+
+#include "atmisccmdpluginconsts.h"
+#include "debug.h"
+
+CCGMICommandHandler* CCGMICommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
+ {
+ TRACE_FUNC_ENTRY
+ CCGMICommandHandler* self = new (ELeave) CCGMICommandHandler(aCallback, aATCmdParser, aPhone);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ TRACE_FUNC_EXIT
+ return self;
+ }
+
+CCGMICommandHandler::CCGMICommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
+ CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
+ {
+ TRACE_FUNC_ENTRY
+ TRACE_FUNC_EXIT
+ }
+
+void CCGMICommandHandler::ConstructL()
+ {
+ TRACE_FUNC_ENTRY
+ iReply.CreateL(KDefaultCmdBufLength);
+ TRACE_FUNC_EXIT
+ }
+
+CCGMICommandHandler::~CCGMICommandHandler()
+ {
+ TRACE_FUNC_ENTRY
+ iReply.Close();
+ TRACE_FUNC_EXIT
+ }
+
+void CCGMICommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
+ {
+ TRACE_FUNC_ENTRY
+
+ TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
+
+ switch (cmdHandlerType)
+ {
+ case (TAtCommandParser::ECmdHandlerTypeTest):
+ {
+ iCallback->CreateReplyAndComplete( EReplyTypeOk );
+ break;
+ }
+ case (TAtCommandParser::ECmdHandlerTypeBase):
+ {
+ if(iTelError == KErrNone)
+ {
+ if (iReply.Length() == 0)
+ {
+ iReply.Append( KCRLF );
+ iReply.Append( iManufacturer );
+ iReply.Append( KCRLF );
+ }
+
+ iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
+ }
+ else
+ {
+ iCallback->CreateCMEReplyAndComplete(iTelError);
+ }
+ break;
+ }
+ default:
+ {
+ iCallback->CreateReplyAndComplete(EReplyTypeError);
+ break;
+ }
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
+void CCGMICommandHandler::SetManufacturer(const TDesC8& aManufacturer)
+ {
+ TRACE_FUNC_ENTRY
+ ASSERT( aManufacturer.Length() <= CTelephony::KPhoneModelIdSize );
+ iManufacturer.Zero();
+ iManufacturer.Copy(aManufacturer);
+ TRACE_FUNC_EXIT
+ }
+
+
+void CCGMICommandHandler::SetTelephonyError(TInt aTelError)
+ {
+ TRACE_FUNC_ENTRY
+ iTelError = aTelError;
+ TRACE_FUNC_EXIT
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/src/cgmrcommandhandler.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description :
+ *
+ */
+
+#include <sysutil.h>
+
+#include "cgmrcommandhandler.h"
+
+#include "atmisccmdpluginconsts.h"
+#include "debug.h"
+
+CCGMRCommandHandler* CCGMRCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
+ {
+ TRACE_FUNC_ENTRY
+ CCGMRCommandHandler* self = new (ELeave) CCGMRCommandHandler(aCallback, aATCmdParser, aPhone);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ TRACE_FUNC_EXIT
+ return self;
+ }
+
+CCGMRCommandHandler::CCGMRCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
+ CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
+ {
+ TRACE_FUNC_ENTRY
+ TRACE_FUNC_EXIT
+ }
+
+void CCGMRCommandHandler::ConstructL()
+ {
+ TRACE_FUNC_ENTRY
+ iReply.CreateL(KDefaultCmdBufLength);
+ TRACE_FUNC_EXIT
+ }
+
+CCGMRCommandHandler::~CCGMRCommandHandler()
+ {
+ TRACE_FUNC_ENTRY
+ iReply.Close();
+ TRACE_FUNC_EXIT
+ }
+
+void CCGMRCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
+ {
+ TRACE_FUNC_ENTRY
+
+ TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
+
+ switch (cmdHandlerType)
+ {
+ case (TAtCommandParser::ECmdHandlerTypeTest):
+ {
+ iCallback->CreateReplyAndComplete( EReplyTypeOk );
+ break;
+ }
+ case (TAtCommandParser::ECmdHandlerTypeBase):
+ {
+ TInt replyType = EReplyTypeOk;
+ if (iReply.Length() == 0)
+ {
+ replyType = GetSoftwareVersion();
+ }
+
+ if ( (EReplyTypeOk != replyType) )
+ {
+ iCallback->CreateCMEReplyAndComplete(KErrUnknown);
+ }
+ else
+ {
+ iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
+ }
+ break;
+ }
+ default:
+ {
+ iCallback->CreateReplyAndComplete(EReplyTypeError);
+ break;
+ }
+ }
+ TRACE_FUNC_EXIT
+ }
+
+TInt CCGMRCommandHandler::GetSoftwareVersion()
+ {
+ TRACE_FUNC_ENTRY
+ iReply.Append( KCRLF );
+
+ // Get software version (e.g. 010.009)
+ TBuf<KSysUtilVersionTextLength> swVersion;
+ TInt errorCode = SysUtil::GetSWVersion( swVersion );
+
+ if (KErrNone == errorCode)
+ {
+ TLex8 lex(swVersion.Collapse());
+ lex.SkipCharacters();
+ TPtrC8 token = lex.MarkedToken();
+ iReply.Append(token);
+
+ iReply.Append( KCRLF );
+ TRACE_FUNC_EXIT
+ return EReplyTypeOk;
+ }
+ else
+ {
+ TRACE_FUNC_EXIT
+ return EReplyTypeError;
+ }
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/src/cgsncommandhandler.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description :
+ *
+ */
+
+#include "cgsncommandhandler.h"
+
+#include "atmisccmdpluginconsts.h"
+#include "debug.h"
+
+CCGSNCommandHandler* CCGSNCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
+ {
+ TRACE_FUNC_ENTRY
+ CCGSNCommandHandler* self = new (ELeave) CCGSNCommandHandler(aCallback, aATCmdParser, aPhone);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ TRACE_FUNC_EXIT
+ return self;
+ }
+
+CCGSNCommandHandler::CCGSNCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
+ CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
+ {
+ TRACE_FUNC_ENTRY
+ TRACE_FUNC_EXIT
+ }
+
+void CCGSNCommandHandler::ConstructL()
+ {
+ TRACE_FUNC_ENTRY
+ iTelError = KErrNone;
+ iReply.CreateL(KDefaultCmdBufLength);
+ TRACE_FUNC_EXIT
+ }
+
+CCGSNCommandHandler::~CCGSNCommandHandler()
+ {
+ TRACE_FUNC_ENTRY
+ iReply.Close();
+ TRACE_FUNC_EXIT
+ }
+
+void CCGSNCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
+ {
+ TRACE_FUNC_ENTRY
+
+ TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
+
+ switch (cmdHandlerType)
+ {
+ case (TAtCommandParser::ECmdHandlerTypeTest):
+ {
+ iCallback->CreateReplyAndComplete( EReplyTypeOk );
+ break;
+ }
+ case (TAtCommandParser::ECmdHandlerTypeBase):
+ {
+ if(iTelError == KErrNone)
+ {
+ if (iReply.Length() == 0)
+ {
+ iReply.Append( KCRLF );
+ iReply.Append( iSN );
+ iReply.Append( KCRLF );
+ }
+
+ iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
+ }
+ else
+ {
+ iCallback->CreateCMEReplyAndComplete(iTelError);
+ }
+ break;
+ }
+ default:
+ {
+ iCallback->CreateReplyAndComplete(EReplyTypeError);
+ break;
+ }
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
+void CCGSNCommandHandler::SetSerialNum(const TDesC8& aSerial)
+ {
+ TRACE_FUNC_ENTRY
+ ASSERT( aSerial.Length() <= CTelephony::KPhoneSerialNumberSize );
+ iSN.Zero();
+ iSN.Copy(aSerial);
+ TRACE_FUNC_EXIT
+ }
+
+void CCGSNCommandHandler::SetTelephonyError(TInt aTelError)
+ {
+ TRACE_FUNC_ENTRY
+ iTelError = aTelError;
+ TRACE_FUNC_EXIT
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/src/cmgdcommandhandler.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,452 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description :
+ *
+ */
+
+#include "cmgdcommandhandler.h"
+#include <mmtsy_names.h>
+#include <mmretrieve.h>
+#include <exterror.h>
+
+#include "atmisccmdpluginconsts.h"
+#include "debug.h"
+
+const TInt KDefaultListLength = 256;
+
+CCMGDCommandHandler* CCMGDCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
+ {
+ TRACE_FUNC_ENTRY
+ CCMGDCommandHandler* self = new (ELeave) CCMGDCommandHandler(aCallback, aATCmdParser, aPhone);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ TRACE_FUNC_EXIT
+ return self;
+ }
+
+CCMGDCommandHandler::CCMGDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
+ CATCmdAsyncBase(aCallback, aATCmdParser, aPhone)
+ {
+ TRACE_FUNC_ENTRY
+
+ TRACE_FUNC_EXIT
+ }
+
+void CCMGDCommandHandler::ConstructL()
+ {
+ TRACE_FUNC_ENTRY
+
+ iReply.CreateL(KDefaultCmdBufLength);
+
+ User::LeaveIfError( iMobileSmsMessaging.Open(iPhone) );
+
+ TInt err = iMobileSmsStore.Open(iMobileSmsMessaging, KETelIccSmsStore);
+ if (err != KErrNone)
+ {
+ iHandlerState = ECMGDStateSimStoreNotSupported;
+ }
+
+ iRetrieveSmsList = CRetrieveMobilePhoneSmsList::NewL(iMobileSmsStore, RMobileSmsStore::KETelMobileGsmSmsEntryV1);
+
+ TRACE_FUNC_EXIT
+ }
+
+CCMGDCommandHandler::~CCMGDCommandHandler()
+ {
+ TRACE_FUNC_ENTRY
+ Cancel();
+ delete iGsmSmsList;
+ delete iRetrieveSmsList;
+ iMobileSmsStore.Close();
+ iMobileSmsMessaging.Close();
+ iReply.Close();
+ iDeleteList.Close();
+ TRACE_FUNC_EXIT
+ }
+
+void CCMGDCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
+ {
+ TRACE_FUNC_ENTRY
+
+ if (iHandlerState == ECMGDStateSimStoreNotSupported)
+ {
+ // Reply "ERROR" if SIM store is not supported
+ iCallback->CreateReplyAndComplete(EReplyTypeError);
+ TRACE_FUNC_EXIT
+ return;
+ }
+
+ TInt ret = KErrNone;
+
+ TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
+
+ switch (cmdHandlerType)
+ {
+ case (TAtCommandParser::ECmdHandlerTypeTest):
+ {
+ iRetrieveSmsList->Start(iStatus);
+ iHandlerState = ECMGDStateRetrieveAllIndices;
+ SetActive();
+ }
+ break;
+ case (TAtCommandParser::ECmdHandlerTypeSet):
+ {
+ ret = ParseParameters();
+ if (ret == KErrNone)
+ {
+ Trace(_L("index = %d"), iIndex);
+ Trace(_L("delflag = %d"), iDelFlag);
+ ret = DoHandleCommand();
+ }
+ else
+ {
+ ret = KErrArgument;
+ }
+ break;
+ }
+ default:
+ {
+ ret = KErrNotSupported;
+ break;
+ }
+ }
+ if (ret == KErrGsmSMSInvalidMemoryIndex)
+ {
+ iCallback->CreateCMSReplyAndComplete(ret);
+ }
+ else if (ret != KErrNone)
+ {
+ iCallback->CreateReplyAndComplete(EReplyTypeError);
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
+void CCMGDCommandHandler::RunL()
+ {
+ TRACE_FUNC_ENTRY
+
+ iReply.Zero();
+
+ TInt err = iStatus.Int();
+ if(err == KErrNone)
+ {
+ switch (iHandlerState)
+ {
+ case ECMGDStateRetrieveAllIndices:
+ {
+ GetMessageIndexListL();
+ iDeleteList.Reset();
+ break;
+ }
+ case ECMGDStateDeleteOneEntry:
+ case ECMGDStateDeleteAllEntries:
+ {
+ // do nothing
+ break;
+ }
+ case ECMGDStateDeleteFilteredEntries:
+ {
+ FilterMessageListL();
+ break;
+ }
+ default:
+ {
+ iHandlerState = ECMGDStateIdle;
+ iCallback->CreateReplyAndComplete(EReplyTypeError);
+ TRACE_FUNC_EXIT
+ return;
+ }
+ }
+
+ if (iDeleteList.Count() != 0)
+ {
+ // delete the first entry in the list
+ iMobileSmsStore.Delete(iStatus, iDeleteList[0]);
+ iDeleteList.Remove(0);
+ iHandlerState = ECMGDStateDeleteOneEntry;
+ SetActive();
+ }
+ else
+ {
+ // deleting finished
+ iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
+ }
+ }
+ else if (err == KErrNotFound)
+ {
+ // no message found in SIM
+ switch (iHandlerState)
+ {
+ case ECMGDStateRetrieveAllIndices:
+ {
+ iHandlerState = ECMGDStateIdle;
+ iReply.Format(KCMGDSupportedCmdsList, &KNullDesC8);
+ iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
+ break;
+ }
+ default:
+ iHandlerState = ECMGDStateIdle;
+ iCallback->CreateCMSReplyAndComplete(err);
+ break;
+ }
+ }
+ else
+ {
+ iHandlerState = ECMGDStateIdle;
+ iCallback->CreateCMSReplyAndComplete(err);
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
+TInt CCMGDCommandHandler::RunError(TInt aError)
+ {
+ TRACE_FUNC_ENTRY
+
+ iCallback->CreateCMSReplyAndComplete(aError);
+
+ TRACE_FUNC_EXIT
+ return KErrNone;
+ }
+
+void CCMGDCommandHandler::DoCancel()
+ {
+ TRACE_FUNC_ENTRY
+
+ switch (iHandlerState)
+ {
+ case ECMGDStateRetrieveAllIndices:
+ case ECMGDStateDeleteFilteredEntries:
+ {
+ iRetrieveSmsList->Cancel();
+ break;
+ }
+ case ECMGDStateDeleteOneEntry:
+ {
+ iMobileSmsStore.CancelAsyncRequest(EMobilePhoneStoreDelete);
+ break;
+ }
+ case ECMGDStateDeleteAllEntries:
+ {
+ iMobileSmsStore.CancelAsyncRequest(EMobilePhoneStoreDeleteAll);
+ break;
+ }
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
+TInt CCMGDCommandHandler::ParseParameters()
+ {
+ TRACE_FUNC_ENTRY
+
+ TInt ret = KErrNone;
+ TInt index = 0;
+ TInt delflag = 0; // default value
+ TInt otherParams = 0;
+
+ // get index
+ TInt retIndex = iATCmdParser.NextIntParam(index);
+ // get delflag
+ TInt retDelflag = iATCmdParser.NextIntParam(delflag);
+ // get other params
+ TInt retOther = iATCmdParser.NextIntParam(otherParams);
+ // Syntax error happens if
+ // a)there is no param2 or param2 error
+ // b)there is no param1 but param2==0
+ // c)there are too many params
+ TBool noParam = (retIndex!=KErrNone && retDelflag!=KErrNone || retDelflag==KErrGeneral );
+ TBool noParam1 = (retIndex!=KErrNone && retDelflag==KErrNone && delflag==0);
+ TBool tooManyParams = (retOther!=KErrNotFound);
+
+ if (noParam || noParam1 || tooManyParams)
+ {
+ ret = KErrArgument;
+ }
+ else
+ {
+ iIndex = index;
+ iDelFlag = delflag;
+ }
+
+ TRACE_FUNC_EXIT
+ return ret;
+ }
+
+TInt CCMGDCommandHandler::DoHandleCommand()
+ {
+ TRACE_FUNC_ENTRY
+
+ TInt err = KErrNone;
+
+ switch (iDelFlag)
+ {
+ case 0:
+ // deletes the designated message with <index>.
+ {
+ if (iIndex == 0)
+ {
+ // The first position in SIM store is 1,
+ // so zero is not in the supported range.
+ err = KErrGsmSMSInvalidMemoryIndex;
+ }
+ else
+ {
+ iDeleteList.Reset();
+ iMobileSmsStore.Delete(iStatus, iIndex);
+ iHandlerState = ECMGDStateDeleteOneEntry;
+ SetActive();
+ }
+ }
+ break;
+ case 1:
+ // deletes all read message in first-choice memory and reserves unread message,
+ // sent message and unsent message.
+ {
+ iRetrieveSmsList->Start(iStatus);
+ iHandlerState = ECMGDStateDeleteFilteredEntries;
+ iFilterType = ECMGDFilterReadMessagesOnly;
+ SetActive();
+ }
+ break;
+ case 2:
+ // deletes all read message and sent message in first-choice memory
+ // and reserves unread message and unsent message.
+ {
+ iRetrieveSmsList->Start(iStatus);
+ iHandlerState = ECMGDStateDeleteFilteredEntries;
+ iFilterType = ECMGDFilterReadAndSentMessages;
+ SetActive();
+ }
+ break;
+ case 3:
+ // deletes all read message, sent message and unsent message in first-choice memory
+ // and reserves unread message.
+ {
+ iRetrieveSmsList->Start(iStatus);
+ iHandlerState = ECMGDStateDeleteFilteredEntries;
+ iFilterType = ECMGDFilterReadSentAndUnsentMessages;
+ SetActive();
+ }
+ break;
+ case 4:
+ // deletes all messages in first-choice memory, including unread message.
+ {
+ iDeleteList.Reset();
+ iMobileSmsStore.DeleteAll(iStatus);
+ iHandlerState = ECMGDStateDeleteAllEntries;
+ SetActive();
+ }
+ break;
+
+ default:
+ err = KErrNotSupported;
+ break;
+ }
+
+ TRACE_FUNC_EXIT
+ return err;
+ }
+
+void CCMGDCommandHandler::GetMessageIndexListL()
+ {
+ TRACE_FUNC_ENTRY
+
+ iReply.Zero();
+ delete iGsmSmsList;
+ iGsmSmsList = NULL;
+
+ RBuf8 list;
+ list.CreateL(KDefaultListLength);
+ CleanupClosePushL(list);
+
+ iGsmSmsList = iRetrieveSmsList->RetrieveGsmListL();
+ TInt entriesNum = iGsmSmsList->Enumerate();
+
+ if (entriesNum > 0)
+ {
+ // Append 1st item
+ RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
+ entry = iGsmSmsList->GetEntryL(0);
+ list.AppendNum(entry.iIndex);
+
+ for (TInt i=1; i<entriesNum; ++i)
+ {
+ entry = iGsmSmsList->GetEntryL(i);
+ list.Append(',');
+ list.AppendNum(entry.iIndex);
+ }
+ }
+ iReply.Format(KCMGDSupportedCmdsList, &list);
+
+ CleanupStack::PopAndDestroy(&list); //list
+
+ TRACE_FUNC_EXIT
+ }
+
+/**
+ * Filter message list with iFilterType
+ * ECMGDFilterReadSentAndUnsentMessages: read, sent and unsent messages
+ * ECMGDFilterReadAndSentMessages: read and sent messages
+ * ECMGDFilterReadMessagesOnly: read messages
+ */
+void CCMGDCommandHandler::FilterMessageListL()
+ {
+ TRACE_FUNC_ENTRY
+
+ delete iGsmSmsList;
+ iGsmSmsList = NULL;
+
+ iDeleteList.Reset();
+
+ iGsmSmsList = iRetrieveSmsList->RetrieveGsmListL();
+ TInt entriesNum = iGsmSmsList->Enumerate();
+
+ for (TInt i=0; i<entriesNum; ++i)
+ {
+ RMobileSmsStore::TMobileGsmSmsEntryV1 entry = iGsmSmsList->GetEntryL(i);
+ switch (iFilterType)
+ {
+ case ECMGDFilterReadSentAndUnsentMessages:
+ {
+ // add unsent message
+ if (entry.iMsgStatus == RMobileSmsStore::EStoredMessageUnsent)
+ {
+ iDeleteList.AppendL(entry.iIndex);
+ break;
+ }
+ }
+ case ECMGDFilterReadAndSentMessages:
+ {
+ // add sent message
+ if (entry.iMsgStatus == RMobileSmsStore::EStoredMessageSent)
+ {
+ iDeleteList.AppendL(entry.iIndex);
+ break;
+ }
+ }
+ case ECMGDFilterReadMessagesOnly:
+ {
+ // add read message
+ if (entry.iMsgStatus == RMobileSmsStore::EStoredMessageRead )
+ {
+ iDeleteList.AppendL(entry.iIndex);
+ break;
+ }
+ }
+ }
+ }
+
+ TRACE_FUNC_EXIT
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/src/cmgwcommandhandler.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,552 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description :
+ *
+ */
+
+#include "cmgwcommandhandler.h"
+#include <mmretrieve.h>
+#include <mmlist.h>
+#include <exterror.h>
+
+#include "atmisccmdpluginconsts.h"
+#include "debug.h"
+
+const TUint KEOT = 26; // End of Transmission
+const TUint KESC = 27; // Escape
+
+const TUint8 KSCATonBitMask = 0x70;
+const TUint8 KSCANpiBitMask = 0x0F;
+
+CCMGWCommandHandler* CCMGWCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
+ {
+ TRACE_FUNC_ENTRY
+ CCMGWCommandHandler* self = new (ELeave) CCMGWCommandHandler(aCallback, aATCmdParser, aPhone);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ TRACE_FUNC_EXIT
+ return self;
+ }
+
+CCMGWCommandHandler::CCMGWCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
+ CATCmdAsyncBase(aCallback, aATCmdParser, aPhone),
+ iEntryPckg(iEntry)
+ {
+ TRACE_FUNC_ENTRY
+ TRACE_FUNC_EXIT
+ }
+
+void CCMGWCommandHandler::ConstructL()
+ {
+ TRACE_FUNC_ENTRY
+ iReply.CreateL(KDefaultCmdBufLength);
+ iTPDU.CreateL(KDefaultCmdBufLength);
+
+ User::LeaveIfError( iMobileSmsMessaging.Open(iPhone) );
+
+ TInt err = iMobileSmsStore.Open(iMobileSmsMessaging, KETelIccSmsStore);
+ if (err != KErrNone)
+ {
+ iState = ECMGWStateSimStoreNotSupported;
+ }
+ iRetrieveMobilePhoneSmspList = CRetrieveMobilePhoneSmspList::NewL(iMobileSmsMessaging);
+
+ TRACE_FUNC_EXIT
+ }
+
+CCMGWCommandHandler::~CCMGWCommandHandler()
+ {
+ TRACE_FUNC_ENTRY
+ Cancel();
+ delete iRetrieveMobilePhoneSmspList;
+ delete iMobilePhoneSmspList;
+ iMobileSmsStore.Close();
+ iMobileSmsMessaging.Close();
+ iReply.Close();
+ iTPDU.Close();
+ TRACE_FUNC_EXIT
+ }
+
+/**
+ * Set message format
+ * 0: PDU mode
+ * 1: Text mode - not supported
+ */
+void CCMGWCommandHandler::SetMessageFormat(TInt aFormat)
+ {
+ TRACE_FUNC_ENTRY
+ if (aFormat == 0 || aFormat == 1)
+ {
+ iMsgFormat = aFormat;
+ }
+ Trace(_L("Message format: %d"), iMsgFormat);
+ TRACE_FUNC_ENTRY
+ }
+
+void CCMGWCommandHandler::HandleCommand(const TDesC8& aCmd, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
+ {
+ TRACE_FUNC_ENTRY
+
+ if (iMsgFormat == 1 || iState == ECMGWStateSimStoreNotSupported )
+ {
+ // Reply "ERROR" if text mode is set
+ // Reply "ERROR" if SIM store is not supported
+ iCallback->CreateReplyAndComplete( EReplyTypeError );
+ TRACE_FUNC_EXIT
+ return;
+ }
+
+ TInt err = KErrNone;
+
+ TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
+
+ switch (cmdHandlerType)
+ {
+ case (TAtCommandParser::ECmdHandlerTypeTest):
+ {
+ iCallback->CreateReplyAndComplete( EReplyTypeOk );
+ break;
+ }
+ case (TAtCommandParser::ECmdHandlerTypeSet):
+ {
+ switch(iState)
+ {
+ case ECMGWStateIdle:
+ {
+ // Parse parameters
+ err = ParseParameters();
+ if (err == KErrNone)
+ {
+ Trace(_L("Parse parameters OK."));
+ Trace(_L("Length = %d"), iTPDULength);
+ Trace(_L("stat = %d"), iTPDUStat);
+
+ iTPDU.Zero();
+ iState = ECMGWStateEditMode;
+ iCallback->CreateReplyAndComplete( EReplyTypeEditor );
+ }
+ else
+ {
+ // Syntax error
+ Trace(_L("Syntax error. err = %d"), err);
+ iState = ECMGWStateIdle;
+ iCallback->CreateReplyAndComplete(EReplyTypeError);
+ }
+ break;
+ }
+ case ECMGWStateEditMode: // Edit state
+ {
+ HandleEditModeCommand(aCmd);
+ break;
+ }
+ default: // Other states
+ {
+ Cancel();
+ iCallback->CreateReplyAndComplete( EReplyTypeError );
+ }
+ }
+ break;
+ }
+ default:
+ {
+ iCallback->CreateReplyAndComplete( EReplyTypeError );
+ break;
+ }
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
+void CCMGWCommandHandler::HandleEditModeCommand( const TDesC8& aCmd )
+ {
+ TRACE_FUNC_ENTRY
+
+ TInt err = KErrNone;
+ TUint8 cmdCharVal = 0;
+ if (aCmd.Length())
+ {
+ cmdCharVal = aCmd[0];
+ }
+
+ switch ( cmdCharVal )
+ {
+ case KEOT: // End of Transmission: Now write the message
+ {
+ // Extract SCA fro PDU
+ err = ExtractSCA();
+ if (err == KErrNotFound)
+ {
+ // SCA not provided by client
+ if (iMobileSmspEntry.iServiceCentre.iTelNumber.Length() == 0)
+ {
+ // Retrieve SMS parameter list
+ iRetrieveMobilePhoneSmspList->Start(iStatus);
+ iState = ECMGWStateRetrieveSCA;
+ SetActive();
+ }
+ else
+ {
+ // Got the SCA from SIM params already - self complete
+ iServiceCentre = iMobileSmspEntry.iServiceCentre;
+
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete(status, KErrNone);
+ iState = ECMGWStatePreparePDU;
+ SetActive();
+ }
+ }
+ else if( err == KErrNone )
+ {
+ // Got the SCA from client (in iService Centre) - self complete
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete(status, KErrNone);
+ iState = ECMGWStatePreparePDU;
+ SetActive();
+ }
+ else
+ {
+ // Extract SCA failed
+ iState = ECMGWStateIdle;
+ iCallback->CreateCMSReplyAndComplete(KErrGsmSMSInvalidPDUModeParameter);
+ }
+ break;
+ }
+ case KESC: // Escape
+ {
+ iState = ECMGWStateIdle;
+ iCallback->CreateReplyAndComplete( EReplyTypeOk );
+ break;
+ }
+ default: // Still entering PDU data
+ {
+ iTPDU.Append( aCmd );
+ iCallback->CreateReplyAndComplete( EReplyTypeEditor );
+ break;
+ }
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
+void CCMGWCommandHandler::RunL()
+ {
+ TRACE_FUNC_ENTRY
+
+ iReply.Zero();
+ TInt err = iStatus.Int();
+ Trace(_L("State = %d, err = %d"), iState, err);
+
+ if (err == KErrNone)
+ {
+ switch (iState)
+ {
+ case ECMGWStateRetrieveSCA:
+ {
+ // Got SCA from SIM params - update iServiceCentre
+ iMobilePhoneSmspList = iRetrieveMobilePhoneSmspList->RetrieveListL();
+ iMobileSmspEntry = iMobilePhoneSmspList->GetEntryL(0);
+ iServiceCentre = iMobileSmspEntry.iServiceCentre;
+
+ // Complete self to send PDU in next state
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete(status, KErrNone);
+ iState = ECMGWStatePreparePDU;
+ SetActive();
+ }
+ break;
+ case ECMGWStatePreparePDU:
+ {
+ // Create an SMS entry from PDU
+ iEntry.iServiceCentre = iServiceCentre;
+
+ err = CreateSmsEntry();
+ if (err == KErrNone)
+ {
+ Trace(_L("Create SMS entry OK."));
+ Trace(_L("Service center: %S"),
+ &iEntry.iServiceCentre.iTelNumber);
+ Trace(_L("Type of number: %d"),
+ iEntry.iServiceCentre.iTypeOfNumber);
+ Trace(_L("Number plan: %d"),
+ iEntry.iServiceCentre.iNumberPlan);
+ Trace(_L("Message status: %d"), iEntry.iMsgStatus);
+
+ // Start to write PDU
+ iEntry.iIndex = -1;
+ iMobileSmsStore.Write(iStatus, iEntryPckg);
+ iState = ECMGWStateWritePDU;
+ SetActive();
+ }
+ else
+ {
+ // Create failed
+ iState = ECMGWStateIdle;
+ iCallback->CreateCMSReplyAndComplete(KErrGsmSMSInvalidPDUModeParameter);
+ }
+ break;
+ }
+ case ECMGWStateWritePDU:
+ {
+ Trace(_L("Write successful. Index = %d"), iEntry.iIndex);
+
+ iReply.Append(KCRLF);
+ iReply.Append(KAtCMGW);
+ iReply.AppendNum(iEntry.iIndex);
+ iState = ECMGWStateIdle;
+ iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
+ }
+ break;
+ default:
+ iState = ECMGWStateIdle;
+ iCallback->CreateReplyAndComplete(EReplyTypeError);
+ break;
+ }
+ }
+ else
+ {
+ iState = ECMGWStateIdle;
+ iCallback->CreateCMSReplyAndComplete(err);
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
+TInt CCMGWCommandHandler::RunError(TInt aError)
+ {
+ TRACE_FUNC_ENTRY
+
+ delete iMobilePhoneSmspList;
+ iMobilePhoneSmspList = NULL;
+ iState = ECMGWStateIdle;
+ iCallback->CreateCMSReplyAndComplete(aError);
+
+ TRACE_FUNC_EXIT
+ return KErrNone;
+ }
+
+void CCMGWCommandHandler::DoCancel()
+ {
+ TRACE_FUNC_ENTRY
+
+ switch (iState)
+ {
+ case ECMGWStateRetrieveSCA:
+ {
+ iRetrieveMobilePhoneSmspList->Cancel();
+ break;
+ }
+ case ECMGWStateWritePDU:
+ {
+ iMobileSmsStore.CancelAsyncRequest(EMobilePhoneStoreWrite);
+ break;
+ }
+ }
+ iState = ECMGWStateIdle;
+
+ TRACE_FUNC_EXIT
+ }
+/**
+ * Parse parameters of +CMGW=<length>,<stat>
+ */
+TInt CCMGWCommandHandler::ParseParameters()
+ {
+ TRACE_FUNC_ENTRY
+
+ TInt ret = KErrNone;
+ iTPDULength = 0;
+ iTPDUStat = 0; // default value
+ TInt otherParams = 0;
+ // Get length
+ TInt retLength = iATCmdParser.NextIntParam(iTPDULength);
+ // Get status
+ TInt retStat = iATCmdParser.NextIntParam(iTPDUStat);
+ // Get other parameters
+ TInt retOther = iATCmdParser.NextIntParam(otherParams);
+ // syntax error happens if
+ // a)there is no param 1
+ // b)there are 3 params
+ // c)param 2 is not 0,1,2 or 3
+ TBool noParam1 = (retLength != KErrNone);
+ TBool badParam2 = (retStat == KErrGeneral);
+ TBool tooManyParams = (retOther != KErrNotFound);
+
+ if (noParam1 || badParam2 || tooManyParams)
+ {
+ ret = KErrArgument;
+ }
+ else
+ {
+ switch (iTPDUStat)
+ {
+ case 0:
+ // to receive unread message
+ iMessageStatus = RMobileSmsStore::EStoredMessageUnread;
+ break;
+ case 1:
+ // to receive read message
+ iMessageStatus = RMobileSmsStore::EStoredMessageRead;
+ break;
+ case 2:
+ // Unsent is not supported in this version
+ ret = KErrNotSupported;
+ break;
+ case 3:
+ // Sent is not supported in this version
+ ret = KErrNotSupported;
+ break;
+ default:
+ ret = KErrArgument;
+ break;
+ }
+ iEntry.iMsgStatus = iMessageStatus;
+ }
+
+ TRACE_FUNC_EXIT
+ return ret;
+ }
+
+/**
+ * Create an SMS entry from the PDU string
+ */
+TInt CCMGWCommandHandler::CreateSmsEntry()
+ {
+ TRACE_FUNC_ENTRY
+
+ TInt err = KErrNone;
+
+ // Check the length
+ if (iTPDU.Length() != (iSCALength+iTPDULength+1)*2)
+ {
+ TRACE_FUNC_EXIT
+ return KErrArgument;
+ }
+
+ RBuf8 buf;
+ err = buf.Create(iTPDULength);
+ if (err != KErrNone)
+ {
+ TRACE_FUNC_EXIT
+ return err;
+ }
+ // Convert to binary format
+ for(TInt i=(iSCALength+1)*2; i< iTPDU.Length(); i+=2)
+ {
+ TLex8 lex(iTPDU.Mid(i, 2));
+ TUint8 val = 0;
+ err = lex.Val(val, EHex);
+ if (err != KErrNone)
+ {
+ buf.Close();
+ TRACE_FUNC_EXIT
+ return err;
+ }
+ buf.Append(val);
+ }
+ iEntry.iMsgData.Copy(buf);
+
+ buf.Close();
+ TRACE_FUNC_EXIT
+ return KErrNone;
+ }
+
+/**
+ * Extract the SMS service center address from the head of PDU string
+ */
+TInt CCMGWCommandHandler::ExtractSCA()
+ {
+ TRACE_FUNC_ENTRY
+
+ TInt err = KErrNone;
+ TLex8 lex;
+ RMobilePhone::TMobileAddress sca;
+ // SCA length
+ lex.Assign(iTPDU.Left(2));
+ err = lex.Val(iSCALength, EHex);
+ if (err != KErrNone)
+ {
+ TRACE_FUNC_EXIT
+ return err;
+ }
+ TInt length = iTPDU.Length();
+ if (iSCALength == 0)
+ {
+ // Service center is not found in PDU
+ err = KErrNotFound;
+ }
+ else if (iSCALength > (length-2)/2)
+ {
+ // Service certer length error
+ err = KErrArgument;
+ }
+ else
+ {
+ // SCA is given
+ // Parse SCA TON and NPI
+ TUint8 val = 0;
+ lex.Assign(iTPDU.Mid(2,2));
+ err = lex.Val(val, EHex);
+ if (err != KErrNone)
+ {
+ TRACE_FUNC_EXIT
+ return err;
+ }
+ TUint8 ton = (val&KSCATonBitMask)>>4;
+ TUint8 npi = val&KSCANpiBitMask;
+ switch (ton) // TON
+ {
+ case 0: // 000
+ sca.iTypeOfNumber = RMobilePhone::EUnknownNumber;
+ break;
+ case 1: // 001
+ sca.iTypeOfNumber = RMobilePhone::EInternationalNumber;
+ sca.iTelNumber.Append('+');
+ break;
+ case 2: // 010
+ sca.iTypeOfNumber = RMobilePhone::ENationalNumber;
+ break;
+ default:
+ // CMCC doesn't support other types
+ TRACE_FUNC_EXIT
+ return KErrArgument;
+ }
+ switch (npi) // NPI
+ {
+ case 0: // 0000
+ sca.iNumberPlan = RMobilePhone::EUnknownNumberingPlan;
+ break;
+ case 1: // 0001
+ sca.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
+ break;
+ default:
+ // CMCC doesn't support other number plans
+ TRACE_FUNC_EXIT
+ return KErrArgument;
+ }
+ // Extract SCA number
+ for (TInt i=4; i<(iSCALength+1)*2; i+=2)
+ {
+ sca.iTelNumber.Append(iTPDU[i+1]);
+ sca.iTelNumber.Append(iTPDU[i]);
+ }
+ if(sca.iTelNumber[sca.iTelNumber.Length()-1] == 'F'
+ || sca.iTelNumber[sca.iTelNumber.Length()-1] == 'f')
+ {
+ sca.iTelNumber.Delete(sca.iTelNumber.Length()-1, 1);
+ }
+ iServiceCentre = sca;
+ }
+ TRACE_FUNC_EXIT
+ return err;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/src/hvercommandhandler.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description :
+ *
+ */
+
+#include "hvercommandhandler.h"
+#include <sysutil.h>
+
+#include "atmisccmdpluginconsts.h"
+#include "debug.h"
+
+const TUint KCommaValue = 44;
+const TUint KSpaceValue = 32;
+
+CHVERCommandHandler* CHVERCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
+ {
+ TRACE_FUNC_ENTRY
+ CHVERCommandHandler* self = new (ELeave) CHVERCommandHandler(aCallback, aATCmdParser, aPhone);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ TRACE_FUNC_EXIT
+ return self;
+ }
+
+CHVERCommandHandler::CHVERCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
+ CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
+ {
+ TRACE_FUNC_ENTRY
+ TRACE_FUNC_EXIT
+ }
+
+void CHVERCommandHandler::ConstructL()
+ {
+ TRACE_FUNC_ENTRY
+ iTelError = KErrNone;
+ iSWVersion.CreateL(KSysUtilVersionTextLength);
+ iReply.CreateL(KDefaultCmdBufLength);
+ TRACE_FUNC_EXIT
+ }
+
+CHVERCommandHandler::~CHVERCommandHandler()
+ {
+ TRACE_FUNC_ENTRY
+ iSWVersion.Close();
+ iReply.Close();
+ TRACE_FUNC_EXIT
+ }
+
+void CHVERCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
+ {
+ TRACE_FUNC_ENTRY
+
+ TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
+
+ if (cmdHandlerType != TAtCommandParser::ECmdHandlerTypeBase)
+ {
+ iCallback->CreateReplyAndComplete(EReplyTypeError);
+ }
+ else if(iTelError == KErrNone)
+ {
+ if (iReply.Length() == 0)
+ {
+ // Get model
+ iReply.Append( KCRLF );
+ iReply.Append( iModel );
+
+ TChar commaValue = KCommaValue;
+ TChar spaceValue = KSpaceValue;
+ iReply.Append( commaValue );
+ iReply.Append( spaceValue );
+
+ // Get software version (RM-xxx)
+ TBuf<KSysUtilVersionTextLength> swVersion;
+ TInt errorCode = SysUtil::GetSWVersion( swVersion );
+
+ if (KErrNone == errorCode)
+ {
+ ParseSWVersion(swVersion.Collapse());
+ iReply.Append(iSWVersion);
+ }
+ iReply.Append( KCRLF );
+ }
+ iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
+ }
+ else
+ {
+ iCallback->CreateCMEReplyAndComplete(iTelError);
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
+void CHVERCommandHandler::ParseSWVersion(const TDesC8& aSWVersion)
+ {
+ TRACE_FUNC_ENTRY
+ if (iSWVersion.Length() != 0)
+ {
+ TRACE_FUNC_EXIT
+ return;
+ }
+
+ TInt start = aSWVersion.Find(KHVERModelString);
+
+ if ( KErrNotFound != start )
+ {
+ TLex8 lex(aSWVersion);
+ lex.Inc(start);
+ lex.Mark();
+ lex.SkipCharacters();
+ TPtrC8 token = lex.MarkedToken();
+
+ iSWVersion.Append(token);
+ }
+ TRACE_FUNC_EXIT
+ }
+
+void CHVERCommandHandler::SetHWVersion(const TDesC8& aHWVersion)
+ {
+ TRACE_FUNC_ENTRY
+ iModel.Zero();
+ if (aHWVersion.Length() <= CTelephony::KPhoneModelIdSize)
+ {
+ iModel.Copy(aHWVersion);
+ }
+ else
+ {
+ iModel.Copy(aHWVersion.Left(CTelephony::KPhoneModelIdSize));
+ }
+ TRACE_FUNC_EXIT
+ }
+
+
+
+void CHVERCommandHandler::SetTelephonyError(TInt aTelError)
+ {
+ TRACE_FUNC_ENTRY
+ iTelError = aTelError;
+ TRACE_FUNC_EXIT
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/src/telephonywrapper.cpp Mon Jul 12 19:25:26 2010 +0300
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 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"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description :
+ *
+ */
+
+#include "telephonywrapper.h"
+#include "debug.h"
+
+CTelephonyWrapper* CTelephonyWrapper::NewL()
+ {
+ TRACE_FUNC_ENTRY
+ CTelephonyWrapper* self = new (ELeave) CTelephonyWrapper();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ TRACE_FUNC_EXIT
+ return self;
+ }
+
+CTelephonyWrapper::CTelephonyWrapper() :
+ CActive(CActive::EPriorityStandard),
+ iPhoneIdV1Pckg(iPhoneIdV1)
+ {
+ TRACE_FUNC_ENTRY
+ TRACE_FUNC_EXIT
+ }
+
+void CTelephonyWrapper::ConstructL()
+ {
+ TRACE_FUNC_ENTRY
+ CActiveScheduler::Add(this);
+ iTelephony = CTelephony::NewL();
+ TRACE_FUNC_EXIT
+ }
+
+CTelephonyWrapper::~CTelephonyWrapper()
+ {
+ TRACE_FUNC_ENTRY
+ Cancel();
+ delete iTelephony;
+ TRACE_FUNC_EXIT
+ }
+
+TInt CTelephonyWrapper::SynchronousGetPhoneId()
+ {
+ TRACE_FUNC_ENTRY
+
+ if (!IsActive())
+ {
+ iTelephony->GetPhoneId(iStatus, iPhoneIdV1Pckg);
+ SetActive();
+ iWaiter.Start();
+
+ if (KErrNone == iStatus.Int())
+ {
+ iModel = iPhoneIdV1.iModel.Collapse();
+ iSn = iPhoneIdV1.iSerialNumber.Collapse();
+ iManufacturer = iPhoneIdV1.iManufacturer.Collapse();
+ }
+ }
+ else
+ {
+ TRACE_FUNC_EXIT
+ return KErrInUse;
+ }
+
+ TRACE_FUNC_EXIT
+ return iStatus.Int();
+ }
+
+const TDesC8& CTelephonyWrapper::GetPhoneModel()
+ {
+ TRACE_FUNC_ENTRY
+ TRACE_FUNC_EXIT
+ return iModel;
+ }
+
+const TDesC8& CTelephonyWrapper::GetPhoneSerialNum()
+ {
+ TRACE_FUNC_ENTRY
+ TRACE_FUNC_EXIT
+ return iSn;
+ }
+
+const TDesC8& CTelephonyWrapper::GetPhoneManufacturer()
+ {
+ TRACE_FUNC_ENTRY
+ TRACE_FUNC_EXIT
+ return iManufacturer;
+ }
+
+void CTelephonyWrapper::RunL()
+ {
+ TRACE_FUNC_ENTRY
+ iWaiter.AsyncStop();
+ TRACE_FUNC_EXIT
+ }
+
+void CTelephonyWrapper::DoCancel()
+ {
+ TRACE_FUNC_ENTRY
+ iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
+ iWaiter.AsyncStop();
+ TRACE_FUNC_EXIT
+ }
+
+