This tutorial describes how to retrieve a call charge information from the network using the GSM Advice of Charge supplementary service.
The following code declares a class that has functions to get the charging information, and to return the value in real monetary units of the current call, accumulated charge, and maximum charge.
class TCostCalculator { public: // Initialise cost info void InitialiseL(RMobilePhone& aMobilePhone); // Gets current call cost TReal CurrentCallCost() { return iCostInfo.iPuct.iPricePerUnit * iCostInfo.iCCM; } // Gets accumulated call cost TReal AccumulatedCallCost() { return iCostInfo.iPuct.iPricePerUnit * iCostInfo.iACM; } // Gets maximum current call cost TReal MaximumCurrentCallCost() { return iCostInfo.iPuct.iPricePerUnit * iCostInfo.iACMmax; } private: RMobilePhone::TMobilePhoneCostInfoV1 iCostInfo; }; // Initialise cost info void TCostCalculator::InitialiseL(RMobilePhone& aMobilePhone) { RMobilePhone::TMobilePhoneCostInfoV1Pckg costInfoPckg(iCostInfo); TRequestStatus status; aMobilePhone.GetCostInfo(status,costInfoPckg); User::WaitForRequest(status); User::LeaveIfError(status.Int()); }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.