examples/Telephony/ETel3rdPartyExample/IncomingCalls/CCallInfo.cpp

00001 /*
00002 Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010   this list of conditions and the following disclaimer in the documentation
00011   and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013   may be used to endorse or promote products derived from this software
00014   without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description:  
00028 */
00029 
00030 
00031 #include "CCallInfo.h"
00032 
00040 CCallInfo* CCallInfo::NewL(MExecAsync* aController)
00041         {
00042         CCallInfo* self = new(ELeave) CCallInfo(aController);
00043         CleanupStack::PushL(self);
00044         self->ConstructL();
00045         CleanupStack::Pop(self);
00046         return self;
00047         }
00048 
00053 CCallInfo::~CCallInfo()
00054         {
00055         Cancel();
00056         }
00057 
00062 void CCallInfo::DoStartRequestL()
00063         {
00064         CTelephony::TCallSelectionV1 callSelectionV1;
00065         CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg( callSelectionV1 );
00066 
00067         callSelectionV1.iLine = CTelephony::EVoiceLine;
00068         callSelectionV1.iSelect = CTelephony::EInProgressCall;
00069         
00070         // Retrieves information about the call selected by the aCallSelect argument.
00071         iTelephony->GetCallInfo(callSelectionV1Pckg,
00072                                 iCallInfoV1Pckg,
00073                                 iRemoteInfoV1Pckg);
00074 
00075         switch(iCallInfoV1.iStatus)
00076                 {
00077         case CTelephony::EStatusRinging:
00078                 iConsole->Printf(_L("RING RING RING\n"));
00079                 break;
00080         case CTelephony::EStatusConnected:
00081                 iConsole->Printf(_L("Call Status: Connected\n"));
00082                 break;
00083         case CTelephony::EStatusConnecting:
00084                 iConsole->Printf(_L("Call Status: Connecting\n"));
00085                 break;
00086         case CTelephony::EStatusAnswering:
00087                 iConsole->Printf(_L("Call Status: Answering\n"));
00088                 break;
00089         case CTelephony::EStatusIdle:
00090                 iConsole->Printf(_L("Call Status: Idle\n"));
00091                 break;
00092         case CTelephony::EStatusDisconnecting:
00093                 iConsole->Printf(_L("Call Status: Disconnecting\n"));
00094                 break;
00095         default:
00096                 iConsole->Printf(_L("Call status: Changed\n"));
00097                 break;
00098                 }
00099         TDateTime time = iCallInfoV1.iStartTime;
00100         
00101         // Print the received call information
00102         iConsole->Printf(_L("Call recieved at %d:%d:%d\n"),
00103                              time.Hour(),
00104                              time.Minute(),
00105                              time.Second());
00106         iConsole->Printf(_L("on %d.%d.%d\n"),
00107                              time.Day(),
00108                              time.Month(),
00109                              time.Year());
00110 
00111         if (iRemoteInfoV1.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable)
00112                 {
00113                 iConsole->Printf(iRemoteInfoV1.iRemoteNumber.iTelNumber);
00114                 }
00115         else
00116                 {
00117                 iConsole->Printf(_L("Private Number Dialling\n"));
00118                 }
00119         ExampleComplete();
00120         }
00121 
00128 CCallInfo::CCallInfo(MExecAsync* aController)
00129         : CISVAPIAsync(aController, KCallInfo),
00130           iCallInfoV1Pckg(iCallInfoV1),
00131           iRemoteInfoV1Pckg(iRemoteInfoV1)
00132         {
00133         // Empty method
00134         }
00135 
00139 void CCallInfo::ConstructL()
00140         {
00141         // Empty method
00142         }
00143 
00147 void CCallInfo::RunL()
00148         {
00149         // Empty method
00150         }
00151 
00155 void CCallInfo::DoCancel()
00156         {
00157         // Empty method
00158         }

Generated by  doxygen 1.6.2