quick_recipes (779892), страница 47

Файл №779892 quick_recipes (Symbian Books) 47 страницаquick_recipes (779892) страница 472018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 47)

There is a difference in how you use this parameter on UIQand S60 devices. It is required on UIQ devices, but not required on S60devices. If you forget to specify it on UIQ devices, you will get an errorcode 103.The aAudioType parameter is the FourCC representing the audioformat for recording. The same as for the video type, this parameter ismandatory on UIQ devices but it is not on S60 devices.

If you don’tspecify this parameter on UIQ devices, the audio will not be recorded,and you will record video without audio.What may go wrong when you do this: Not all methods in CVideoRecorderUtility are supported by all Symbian OS devices. Forexample, CVideoRecorderUtility::OpenDesL(), CVideoRecorderUtility::OpenFileL() and CVideoRecorderUtility::OpenUrlL() are not supported in S60 devices as atthe time of writing.How to select a video controller plug-inThe CMMFControllerPluginSelectionParameters::ListImplementationsL() method can be used to retrieve all controllerplug-ins that match our search criteria. There are several possible criteria,but we will discuss two of them only: format and media IDs.The first criterion is the required format support. You can set this bycalling CMMFControllerPluginSelectionParameters::SetRequiredRecordFormatSupportL(), which takes a CMMFFormatSelectionParameters parameter.Note that you can use a full filename as a parameter for CMMFFormatSelectionParameters::SetMatchToFileNameL() as it usesTParse (see Recipe 4.1.2.1) for an example of how to use this class.The next criterion is the media IDs that must be supported by theplug-in, for example audio or video.

It is set by calling CMMFControllerPluginSelectionParameters::SetMediaIdsL().The first parameter is an array of media IDs that the selected plug-insmust support. The second parameter, aMatchType, is the type of matchto be made. There are three possible values:TELEPHONY263• ENoMediaIdMatch. This means no media ID match will be performed.• EAllowOtherMediaIds.

All plug-ins that support the media ID willbe returned. It includes plug-ins that support other media IDs. Forexample, if you request audio, plug-ins that support video and audiowill also be returned.• EAllowOnlySuppliedMediaIds. Only plug-ins that support theexact media IDs will be returned. If you specify audio, then onlyplug-ins that support audio will be returned.We can then call RMMFControllerImplInfoArray::ListImplementationsL() to retrieve all the controller plug-ins. Thismethod requires a parameter with the type RMMFControllerImplInfoArray, which is an array of CMMFControllerImplementationInformation.At this point, we have an array of controller plug-ins that support ourcriteria.

The recipe simply retrieves the UID of the first plug-in in the listthat can record to the specified format.4.7.4 Resources• Forum Nokia Multimedia Technology Resources: www.forum.nokia.com/main/resources/technologies/multimedia/index.html.• Sony Ericsson Developer World’s Multimedia and PersonalizationDocs: www.developer.sonyericsson.com/site/global/docstools/multimedia/p multimedia.jsp.• FourCC.org, Video Codec and Pixel Format Definitions: www.fourcc.org.• Exif.org, unofficial site dedicated to EXIF and related resources:www.exif.org.4.8 TelephonyOn earlier versions of Symbian OS, to access telephony services, itwas necessary to use a number of different specialized classes, notall of which were available in the public SDKs.

On Symbian OS v9,telephony is accessed using a convenience class called CTelephony.Some alternative classes can be used instead of CTelephony, such asRConnectionMonitor (available in S60), but you will find that theyactually require more platform security capabilities and this may preventyou from experimenting with self-signed applications.264SYMBIAN C++ RECIPESAlso, when you have learned to use one of the methods providedby CTelephony, the other methods become really easy to handle toobecause, in general, they are used in the same way.The following sequence is usually required:1.Check which function to call to get the initial value(s).2.Check the enumeration value to be passed for monitoring the valuewhen it changes.3.Check which enumeration value you need to pass to cancel anoutstanding request.All of the methods provided by CTelephony use active objects; thisis why all the examples that use CTelephony are CActive-derivedclasses.

For each of the following recipes, to reuse the example code inyour own projects, follow these steps:1.Copy both the .cpp source file and the .h header file stated at thetop of the recipe into your own project directories. This code containsthe declaration and definition of the telephony-access active object.2.Add the etel3rdparty library to your project settings and checkthat you also have the required platform security capabilities set forthe project.3.Derive the C class from which you intend to use the telephonyfunctions from the required callback interface class.

Define andimplement the required virtual function(s) in that class.4.Add a pointer member variable to the class to own an instance of thetelephony-access active object.5.Add construction code to instantiate the telephony-access activeobject, and corresponding code to delete it in the destructor.For example, if you want to add functionality which dials a phone callto your application, first copy Call_Dialer.h and Call_Dialer.cppfiles into your project. The content of the files is as follows:// Callback interfaceclass MCallDialerCallBack{public:virtual void DialerDone(TInt aError)=0;};// Telephony-access active objectclass CMyCallDialer : public CActive{TELEPHONYenum TMyCallStates{EMyCallIdle,EMyCallDialing,EMyCallHangingup,EMyCallAnswering};public:// public constructors & destructorstatic CMyCallDialer* NewLC(MCallDialerCallBack& aCallBack);static CMyCallDialer* NewL(MCallDialerCallBack& aCallBack);∼CMyCallDialer();// public functionsvoid Dial(const TDesC& aPhoneNumber,CTelephony::TCallerIdentityRestrict aRestinction =CTelephony::EIdRestrictDefault);void Hangup();void AnswerIncomingCall();protected: // from CActivevoid RunL();void DoCancel();private:CMyCallDialer(MCallDialerCallBack& aCallBack);void ConstructL();private:MCallDialerCallBack& iCallBack;CTelephony* iTelephony;CTelephony::TCallId iCallId;CTelephony::TCallParamsV1 iCallParams;CTelephony::TCallParamsV1Pckg iCallParamsPckg;TMyCallStates iState;};// Code for NewL() and NewLC() factory methods is omitted for clarityCMyCallDialer::CMyCallDialer(MCallDialerCallBack& aCallBack): CActive(EPriorityStandard), iCallBack(aCallBack),iCallParamsPckg(iCallParams), iState(EMyCallIdle){}CMyCallDialer::∼CMyCallDialer(){// always cancel any pending request before deleting the objectsCancel();delete iTelephony;}void CMyCallDialer::ConstructL(){// Active objects needs to be added to active schedulerCActiveScheduler::Add(this);iTelephony = CTelephony::NewL();}void CMyCallDialer::Dial(const TDesC& aPhoneNumber,CTelephony::TCallerIdentityRestrict aRestriction){if(!IsActive() && iTelephony){265266SYMBIAN C++ RECIPESCTelephony::TTelNumber telNumber(aPhoneNumber);CTelephony::TCallParamsV1 callParams;callParams.iIdRestrict = aRestriction;CTelephony::TCallParamsV1Pckg callParamsPckg(callParams);iState = EMyCallDialing;// ask CTelephony to dial new call// RunL will be called when the call is connected or it failsiTelephony->DialNewCall(iStatus, callParamsPckg,telNumber, iCallId);SetActive();// after starting the request AO needs to be set active}}void CMyCallDialer::AnswerIncomingCall(){if(!IsActive() && iTelephony){iState = EMyCallAnswering;iTelephony->AnswerIncomingCall(iStatus, iCallId);SetActive();// after starting the request AO needs to be set active}}void CMyCallDialer::Hangup(){if(!IsActive() && iTelephony){iState = EMyCallHangingup;iTelephony->Hangup(iStatus, iCallId);SetActive();// after starting the request AO needs to be set active}}// Handle completion eventsvoid CMyCallDialer::RunL(){iState = EMyCallIdle;// use callback function to tell owner that we have finishediCallBack.DialerDone(iStatus.Int());}void CMyCallDialer::DoCancel(){// You need to specify what you want to cancel// We also need to check first which call is currently activeif(iState == EMyCallDialing){iTelephony->CancelAsync(CTelephony::EDialNewCallCancel);}if(iState == EMyCallHangingup){iTelephony->CancelAsync(CTelephony::EHangupCancel);}TELEPHONY267if(iState == EMyCallAnswering){iTelephony->CancelAsync(CTelephony::EAnswerIncomingCallCancel);}iState = EMyCallIdle;}Your class must derive from MCallDialerCallBack and overridethe DialerDone() interface.

Add an instance of CMyCallDialer asa member of the class:#include "Call_Dialer.h"class CMyClass : public CBase, MCallDialerCallBack{public: // From MCallDialerCallBackvoid DialerDone(TInt aError);...private:...CMyCallDialer* iMyCallDialer;...};Your class must implement the DialerDone() callback function,which the dialer uses to communicate when it is finished with the task:void CMyClass::DialerDone(TInt aError){// do something in here, which must NOT leave...}The next step is to pass a reference to this class when instantiating theCMyCallDialer active object:iMyCallDialer = CMyCallDialer::NewL(*this);You can then call the Dial(), Hangup() and AnswerIncomingCall() functions of CMyCallDialer to implement the logic of yourapplication.Finally, do not forget to modify your class destructor to delete theCMyCallDialer class instance!Note: Since the emulator environment does not have telephony hardware included, only very few of the methods of the CTelephonyclass can be tested in the emulator.

Construction of classes requiringactual hardware has been disabled for emulator builds with #ifdefWINS macro.268SYMBIAN C++ RECIPESCode that uses telephony requires the NetworkServices platform security capability to protect against malicious code that couldpotentially run up a large phone bill.

To install code that requires theNetworkServices capability on the device you will need to addthis capability to the MMP file and sign the SIS file before it can beinstalled. For more information about this, consult Chapter 3.4.8.1 Easy Recipes4.8.1.1Handle Phone CallsAmount of time required: 20 minutesLocation of example code: \Telephony\Telephony_DialerRequired library(s): etel3rdparty.libRequired header file(s): etel3rdparty.hRequired platform security capability(s): NetworkServicesProblem: You want to make a call and hang it up.Solution: The CTelephonyAppUi class shows how to use the Call_Dialer code.In order to dial a call, you need to call CTelephony::DialNewCall().

When the call is answered or rejected, RunL() will be calledand the error code can be retrieved from the iStatus variable.When calling DialNewCall(), you could also set restrictions onhow your phone number is shown on the receiving handset by setting theiIdRestrict variable defined in CTelephony::TCallParamsV1.Possible values are:• EIdRestrictDefault (use default phone settings),• ESendMyId (show your number on the receiving end), and• EDontSendMyId (do not show your number on the receiving end).In order to answer a call, you need to have an incoming call in theringing state (note that outgoing calls also move to the ringing state rightafter the dialing state).

Характеристики

Тип файла
PDF-файл
Размер
1,59 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6392
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее