Главная » Просмотр файлов » Concepts with Symbian OS

Concepts with Symbian OS (779878), страница 51

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

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

Every device is different, butevery device must eventually be presented in a standard way. Thismeans that devices must speak to the operating system via some kindof ‘translator’, and that translator is the device driver. Device driversare typically loaded dynamically when their intermediary services areneeded, much like the drivers for other types of device I/O (discussed inChapter 9).The protocol implementation for an operating system is a good exampleof the stack model of communications.

Most implementations of communications form a stack, as we demonstrated with Symbian OS. Asdiscussed in Chapter 9, abstraction plays a big role here. While thesame API is in often place, the implementation functions are dynamicallyloaded when they are needed.Consider, for example, the code below, which is for a generic Linuxserver that accepts a socket connection from a client and reads andprocesses the client’s request across the socket.void main(int argc, char **argv){/* Declarations for sockets */int sockfd;int result, select;int readfds[32];struct sockaddr_in sin;int msgsock;char recv_buffer[256];/* Step 1: Create the socket.

*/sockfd = socket (AF_INET, SOCK_STREAM, 0);if (sockfd < 0){(void) perror ("socket creation");exit(-1);}/* Step 2: Data setup */sin = (struct sockaddr_in *) & salocal;memset ((char *) sin, "\0", sizeof (salocal));sin->sin_family = AF_INET;sin->sin_addr.s_addr = INADDR_ANY;sin->sin_port = 1100;/* Step 3: Bind the socket to the network */result = bind (sockfd, & salocal, sizeof (*sin));244MODELING COMMUNICATIONSif (result < 0){(void) perror ("socket binding");exit(-1);}/* Step 4: Set up listening on the socket */listen(sockfd,5);for(;;) {FD_ZERO(&readfds);if(sockfd >= 0) FD_SET(sockfd, &readfds);/* Step 5: Wait for input on the socket */status = select(32, &readfds, NULL, NULL, NULL);if(status == -1){if (errno == EINTR) continue;exit(101);}if((sockfd >= 0) && FD_ISSET(sockfd, &readfds)){DEBUG("Setting up the MSG SOCKET\n");/* Step 6: GOT input, accept it, creating a file descriptor.

*/msgsock = accept(sockfd, 0, 0);/* At this point, we have a file descriptor (msgsock) that wecan read and write to. NOW we process the data that comesover the socket.Step 7: Process input. */result = read(msgsock, recv_buffer, (int) sizeof(recv_buffer));if(result > 0){result = process_cmd(recv_buffer,msgsock);close(msgsock);}}}}Each system call addresses some part in the stack. Step 1 creates asocket, unbound but with a definition (it is a TCP/IP network socket,AF_INET, to be opened over TCP, SOCK_STREAM). Step 3 pushes a bitdeeper into the stack, using the data set up in Step 2 to bind the filedescriptor to an entry in a system table connected with networks.

Thisbind() call implies that a read or write takes place and loads the codenecessary to connect the read or write with the data on a network. Beforebind(), a socket is just a file descriptor; after bind(), it is a descriptorEXERCISES245tied to a specific implementation of read and write system calls. Step 4activates network listening for requests, using read() and write()calls to engage in socket protocols with the other side of the networkconnection. At the end of this call, the device driver has been loaded andis actively working with the network port to process network data. Step 5is a blocking call that waits until some file descriptor has data on it.

Again,notice the abstraction in this call. The select() call takes a collectionof file descriptors of all kinds and returns when at least one has data. Thatimplies that all the descriptors must have the same interface (read/write).When the call returns, we assume that the socket we have set up as a filedescriptor has data waiting. Step 6 accepts that data, deriving a regulartwo-way socket from the server socket. Step 7 begins receiving data.This example illustrates the abstraction and modularity built into thestack model of communications. It combines a client–server approachwith stack-oriented implementations and sockets to give us an effectiveway of describing network service. These models have proved so usefulthat they are built into most modern operating systems in use today.11.4SummaryThis chapter has discussed the types of models that operating systemsuse to characterize communications. Abstraction is the key to using thesemodels.

We discussed how client–server relationships are built and howimplementation stacks use abstraction to connect system calls together.We described how the ideas of sockets and event-driven communicationsprovided mechanisms to understand implementation details. We thengave examples of these models from both Symbian OS and Linux.Exercises1.We stressed many different uses for abstraction in this chapter. Findthem and describe why each one is useful.2.Client–server relationships can be found in many places in an operating system. Find at least three such relationships in the operatingsystem of your choice and report them.3.In a mobile phone call, there are a series of client–server relationshipsthat are established.

Identify these and report them.246MODELING COMMUNICATIONS4.Describe how a web page is requested and delivered between a webbrowser and a website. Identify the client–server relationships in thesequence of events.5.Invent a communications stack for a person who speaks French toget a message (spoken by him in French) to a colleague in Germany.The message must be received the same day and must be in Germanwhen it reaches the colleague.6.In Symbian OS, Bluetooth communications is done primarily throughsockets. Explain why this is preferred to just opening the Bluetoothdevice and reading from and writing to it.7.An application needs to open a socket to a web server, send a requestand read a web page.

Describe the events that would be generatedby that sequence of operations.12TelephonyThe convergence of telephony and handheld computing devices has hada long history. Modems have been available commercially since the1960s and, from that time, telephony services and computers have beenlinked. As integrated devices were developed, control over telephonyfunctions became a more crucial issue for operating system designers.The support of telephony had to adhere to the communications modelsthat have governed all computer communications.

Telephony functionality became an important component of Symbian OS even beforethe first true Symbian OS phones (the Ericsson R380 and Nokia 9210Communicator) shipped, with core functionality to support a ‘two-box’connection (PDA to phone) appearing for the original Psion Series 5range. These devices demonstrated how telephony communications andcomputing capability – integrating data and voice capability – can bemutually beneficial.This chapter examines how operating systems can support telephony.Symbian OS obviously stands out as a great example of telephonysupport.

A wide variety of telephony functions and uses are providedby the Symbian OS ETel telephony subsystem. This chapter gives anoverview of telephony services and the operating systems componentsthat implement them. We then take a look at the ETel model and itsinterfaces by examining the different situations it was designed to addressand looking at the structure of the APIs. We dig into the details of ETel bylooking at the main aspects in its design.24812.1TELEPHONYModeling Telephony ServicesCommunication using a conventional analog telephone is usually splitinto two forms: data and voice communication.

Data communication overa telephone is handled by a modem, a digital-to-analog converter. Digitalcommunication in the form of binary data is converted to analog audiorepresentation that can be sent between telephones over conventionalphone systems. At the other end, the reverse process takes place.The computer controls the modem by using a set of commands. TheHayes command set, for example, is by far the most widely used setof commands for modems. Hayes-format commands take the form of‘AT’ commands: the character sequence ‘AT’ followed by characters tocommand the modem to do certain tasks.

To initialize a modem andcause it to dial a number, for example, we might give it the followingcommand string:ATQ0E1DT555-3454This string tells the modem to send result codes back to the computerin response to commands, echo back the commands sent to the modemand tone-dial the number 555-3454.Voice communication via both the public-switched-telephone network(PSTN) and the mobile phone network (for example, GSM) is effectively apeer-to-peer connection, where the ‘address’ of the remote device is thetelephone number being dialed.

The telephone number is accepted bythe telephone-network-switching infrastructure and a connection is madebetween the local and remote devices, until one or both terminate theconnection by ‘hanging up’. A telephone may be able to handle severaltelephone lines; each line can typically multiplex several phone calls atonce, by working appropriately with the telephone system.Telephone networks can be wired (‘landline’ PSTN networks) or wireless (mobile phone networks).

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

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

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

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