Главная » Просмотр файлов » Smartphone Operating System

Smartphone Operating System (779883), страница 54

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

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

Byintegrating the specific implementation of this model for a particularphone type into a module, Symbian OS designers ensured that the API forthis functionality would remain the same across different phones, and theapplication programmer is free from worrying about the implementationspecifics for a particular phone. When Symbian OS is used with newphone hardware for the first time, a new TSY must be developed.TSY modules are designed to plug into the telephony server and provideaccess to telephony functionality. Search your Symbian phone or emulator and look for TSY modules provided with the device.

In Symbian OSv9, you should find several TSYs that are provided with the distribution,including generic phone TSYs and ones that implement CDMA.The ETel SubsystemThe ETel subsystem has four key constituents (see Figure 12.1): the ETelserver, the Phone abstraction, the Line abstraction, and the Call object.ETel serverThe ETel server manages access to the telephony system.

It is accessedusing functions from the RTelServer class. Before telephony can beused by an application, it must connect to the telephony server. This isdone with the Connect() function. Using this function, applications252TELEPHONYClient applicationClient applicationCore APIExtension APIETel serverTSY APITSY moduleTSY moduleTelephonyhardwareTelephonyhardwareFigure 12.2 ETel structural diagramconnect to the telephony server, specifying how many message slotsare needed. A single message slot is a communication channel in onedirection. The default number of slots assigned is 32.

The RTelServerclass is a subclass of the RSessionBase class, and therefore inheritsthe Close() function, which is used to shut down an active telephonyserver session.Once a connection is established, the TSY module that is neededshould be loaded. TSY modules can be manipulated through the LoadPhoneModule() and UnloadPhoneModule() functions. The firstfunction loads a TSY module, and the second function removes a TSYmodule.

These modules are analogous to device drivers (especially inthat they relate to a specific device – in this case, the particular basebandhardware in the phone) and are implemented with logical and physicalcomponents particular to the specific baseband. Recall from Chapter 11A STRUCTURAL OVERVIEW253that device drivers need to be loaded and unloaded; TSYs require thesame handling.Once the appropriate TSY module has been loaded, applications canmake queries about its properties. These queries take the form of telephony server functions, such as the Version() or GetPhoneInfo()functions, and result in requests being sent to, and responses returningfrom, the ETel server. It is possible to obtain version information, thephone’s name, the type of telephone network it uses, and other information. Information about the TSY itself is also available from the telephonyserver.

All TSY modules are assumed to support a minimal set of telephonyfunctionality, but by calling IsSupportedByModule() it is possible todetermine exactly what ETel functions are supported.Let’s take an example: we have a CPhoneCall class that initializes aphone and makes a voice phone call. The definition for this class mightlook like this:class CPhoneCall : public CActive{enum TCallState {EDialing, EDone, EError};public:∼CPhoneCall();public:// Static constructionstatic CPhoneCall* NewLC();static CPhoneCall* NewL();public:void MakeCall(TDesC& aTelephoneNumber);private:CPhoneCall();void ConstructL();void InitL();void DoCancel();void RunL();RTelServer iTelServer;RPhone iGsmPhone;RLine iPhoneLine;RCall iPhoneCall;TRequestStatus iCallStatus;TCallState iCallState;};Notice that this class is an active object that uses the iCallStatevariable to track its communication state and the iCallStatus variableto monitor its I/O progress.254TELEPHONYNow, consider the definition of the InitL() function as it appliesto the telephony server.

Here, we want to deal with a voice call over aGSM phone:void CPhoneCall::InitL(){RTelServer::TPhoneInfo phoneInfo;RPhone::TLineInfo lineInfo;RPhone::TCaps capabilities;RLine::TCaps lCapabilities;TInt result;TInt phones, lines, calls;TFullName name;// Connect to the telephony serverresult = iTelServer.Connect();User::LeaveIfError(result);// Load the right TSY_LIT(KTsyToLoad,"gsmbsc.tsy")result = iTelServer.LoadPhoneModule(KTsyToLoad);User::LeaveIfError(result);// Get information about phones from the serverresult = iTelServer.EnumeratePhones(phones);User::LeaveIfError(result);if (phones == 0) User::LeaveIfError(KErrNotSupported);// other code to init phones, lines and calls}We connect to the telephony server and load the GSM TSY module.

Ifno phones are supported (for example, if no GSM TSYs could be found),this code leaves with an error code.The phone abstractionAfter connecting to the ETel server, a phone supported by the telephonyserver should be selected. Phones are characterized by the RPhone classand are accessed through a subsession established by an RPhone object.As when establishing connections and sessions, we use Open() andClose() functions for this.

After opening a phone subsession, notifications can be set up and the phone must be initialized. Changes tothe phone’s state and capabilities are reported to the client application using functions known as notifications. Generally, the client makesA STRUCTURAL OVERVIEW255all the notification requests prior to calling any functions which maychange the state of the telephony device. Initializing is allowed to beasynchronous, because it may take some time to set up the telephonydevice.When a phone subsession is open and the device has been initialized,applications can use the other functions of the phone device or makequeries of it thorough the RPhone class interface.Let’s continue the CPhoneCall class example.

We need to expandthe implementation of the InitL() function to encompass initializingphones. The result is below:void CPhoneCall::InitL(){RTelServer::TPhoneInfo phoneInfo;RPhone::TLineInfo lineInfo;RPhone::TCaps capabilities;RLine::TCaps lCapabilities;TInt result;TInt phones,lines,calls;TFullName name;// code to initialize the telephony server connection// Get the information on the phone we needresult = iTelServer.GetPhoneInfo(0, phoneInfo);User::LeaveIfError(result);name.Copy(phoneInfo.iName);// Open the phone and get its capabilitiesresult = iGsmPhone.Open(iTelServer, name);User::LeaveIfError(result);result = iGsmPhone.GetCaps(capabilities);User::LeaveIfError(result);if ((capabilities.iFlags & RPhone::KCapsVoice) == 0)User::LeaveIfError(KErrNotSupported);// other code to init lines and calls}Note that the phone is initialized when the first asynchronous requestis sent. So we do not need to call Initialize() from this initializationcode.

In the code above, we retrieve the name of the first phone from thetelephony server and open it up. On a Nokia 8290 phone (a GSM phoneused in the United States), the name of this first phone is ‘GsmPhone1’.We conclude this code by making sure that the phone we obtained canindeed support voice capability.256TELEPHONYThe line abstractionOnce a subsession with a phone has been established, we may establish asubsession for a particular line. The line implementation is implementedby the RLine class.

As with RPhone objects, RLine object subsessionsare opened and closed with Open() and Close() functions.As with RPhone objects, RLine objects can be notified when properties of a line change. There are many different properties that can changeand this is reflected in the number of notification functions that are definedfor the RLine class. There are four notification functions, each with itsown cancellation function. Each is also asynchronous and requires astatus variable for monitoring; notification functions are useful here.Let’s continue to flesh out the CPhoneCall class example. Initializinga line for a phone means getting its name and opening a subsession, asbelow:void CPhoneCall::InitL(){RTelServer::TPhoneInfo phoneInfo;RPhone::TLineInfo lineInfo;RPhone::TCaps capabilities;RLine::TCaps lCapabilities;TInt result;TInt phones,lines,calls;TFullName name;// code to initialize the telephony server and phone// Get the info on the line we need – we have hard-coded 2 to open// the 3rd line.

In reality, one should use EnumerateLines() to// determine the required line on any particular phoneresult = iGsmPhone.GetLineInfo(2, lineInfo);User::LeaveIfError(result);name.Copy(lineInfo.iName);// Open the line and get its capabilitiesresult = iPhoneLine.Open(iGsmPhone, name);User::LeaveIfError(result);result = iPhoneLine.GetCaps(lCapabilities);User::LeaveIfError(result);if ((lCapabilities.iFlags & RLine::KCapsVoice) == 0)User::LeaveIfError(KErrNotSupported);// code to initialize call}A STRUCTURAL OVERVIEW257This example chooses the third line available on the phone and checksits capabilities.

On a Nokia 8290 phone, the third line is the voice line(the first two are fax and data lines) and the name of this line is Voice.The call objectWith a session established to the telephony server and phone and linesubsessions now open, we can finally open and manage a call. Callsare implemented by the RCall class. Before we discuss how to use thisclass, we should point out a few things about calls.• Calls have names, as with other telephony-server objects. The nameof a call is generated by the operating system through the TSY andreturned when a call subsession is opened. A ‘fully qualified name’ isone that includes call, line and phone information in the format:PhoneName::LineName::CallName• Opening a call subsession does not connect a call. As with phonesand lines, a call subsession must be opened before we can use acall.

Opening a subsession allows the telephony server to allocatememory and resources for a call but does not manipulate the call inany way.• Calls can be incoming as well as outgoing. In addition to instructingthe telephony server to make a call, we can instruct the server toanswer a call. Unlike the other layers in the model, a new subsessionis opened with calls other than Open() and Close(). The OpenNewCall() function in its several forms creates a new call in an idlestate. OpenExistingCall() is more usually used to open a call inan ‘alerting’ state. A new call can be opened by referencing an opentelephony server session, a phone subsession or a line subsession.Subsessions can be opened with existing calls, i.e., calls in progress.This is done by applications that want to work with calls alreadyreceived or started by other applications. For example, if one application placed a voice call, a second application could implement a calltimer.

To hang up after a certain time period, the timer applicationwould have to open the existing call with the OpenExistingCall()function.258TELEPHONYAs an example, we can complete the CPhoneCall::InitL() function. Here, we simply open a new call subsession by referencing the linesubsession:void CPhoneCall::InitL(){RTelServer::TPhoneInfo phoneInfo;RPhone::TLineInfo lineInfo;RPhone::TCaps capabilities;RLine::TCaps lCapabilities;TInt result;TInt phones,lines,calls;TFullName name;// code to initialize server, phone and line// Open a new callresult = iPhoneCall.OpenNewCall(iPhoneLine, name);User::LeaveIfError(result);}On our Nokia phone, this call is assigned the name VoiceCall1.Although it may seem like a long journey, eventually all sessions andsubsessions are opened and initialized.

At this point, we still have notmade a call, but the system is ready for this next step.Calls are made by instructing the Symbian phone to dial with a directorynumber or by connecting to an already dialed call. To dial a call, we usethe Dial() function from the RCall class. Dialing functions come insynchronous or asynchronous varieties and can include call parameters.To illustrate this, let’s define the MakeCall() function from ourCPhoneCall example. We have decided to make the CPhoneCallclass an active object and we can use an asynchronous version of theDial() function:void CPhoneCall::MakeCall(TDesC& aNumber){iPhoneCall.Dial(iCallStatus, aNumber);iCallState = EDialing;SetActive();}Since we have already set up the telephony system, this is a simpleimplementation.

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

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

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

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