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

Symbian OS Communications (779884), страница 81

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

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

This may cause some problems, depending on whatlevel of network access your application is expecting.Using WinSockThe WinSock connection method replaces the Symbian OS IP stack witha version that uses Windows native sockets directly (hence referring toit as the ‘WinSock’ connection method). Rather than use the SymbianOS TCP/IP stack and supporting infrastructure, WinSock maps sockets inSymbian OS directly to sockets on your PC.The advantage of this is that your PC network connection is useddirectly – Symbian OS applications just appear to the Windows networking stack to be additional clients using TCP or UDP sockets, so there’sno additional setup required.

The disadvantages are that you can’t havethe same port listening in the emulator as on the PC (they are using thesame TCP/IP stack), and that you are bypassing most of the Symbian OSnetworking stack, so the on-device behavior you see will be different. Inparticular, many of the features of the Symbian OS IP stack are not replicated in Winsock, so you will find that any protocol-level GetOpt(),SetOpt(), and Ioctl() calls you make will not work. Additionally,features such as multicast IP addresses are not supported by WinSock.There are two versions of WinSock in existence. The original wascreated by Symbian, distributed from the Symbian Developer website,and targeted at UIQ2.1 SDKs – we won’t talk about it here as it doesn’twork with more recent Symbian OS releases.

The other is a version fromNokia contained in the S60 3rd edition SDKs. It considerably enhancesthe version that Symbian created, and makes the connection appear morelike a standard network connection on Symbian OS – for example, it usesthe IAP selection dialog, and sends progress notifications when starting,just like a real network connection would.If you just require a simple network connection for your testing thenWinSock is ideal. It works ‘out of the box’ and provides a simple way toconnect the emulator to an IP network with a minimum fuss. However,402SETTING UP FOR DEVELOPMENTbe aware of the potential differences between the behavior of networkingAPIs when using WinSock and a real device.Of course, if you’re using the UIQ3 SDK then WinSock isn’t availableto you, so you’ll have to consider another method.Using NT RASNT RAS was once the mainstay of IP connectivity for Symbian OSdevelopment. More recently, Ethernet-based options have taken over asthe connectivity methods of choice – they’re faster, easier to set up anddon’t require extra cables.

However, we’ll briefly note down the settingsfor NT RAS here in case anyone’s feeling particularly brave and wants totry using it.The first requirement is a null modem cable between a serial portthat Symbian OS can access and a COM port that is set up for NTRAS. The Windows side is fairly easy to set up by enabling the ‘Routingand remote access’ service, then configuring it through the ‘Networkconnections’ – ‘Incoming connections’ options. The Symbian OS sideis harder, as it involves editing the entries in CommsDat to create anew IAP. See the section ‘Configuring Commsdat’ for more details onhow to add and update entries in CommsDat.

The UIQ3 SDK has anentry for NT RAS already (although it is set up to use a virtual IR serialport).The key settings when using NT RAS are as follows:In the ModemBearer record:• Agent should be set to ‘csd.agt’• PortName should be set to ‘COMM::0’ (unless you want to usea virtual serial port, in which case you’d use ‘BTCOMM::0’ or‘IRCOMM::0’)• IfName should be ‘PPP’• CSYName should be ‘ECUART’ (again, unless you’re using a virtualserial port, in which case you’d want ‘BTCOMM’ or ‘IRCOMM’)In the DialOutISP record:• IfAuthName and IfAuthPass should be set to appropriate valuesfor a user on the machine that is hosting the RAS service. TraditionallySymbian has used ‘RasUser’ and ‘pass’ for a generic RAS account.• UseLoginScript should be ‘TRUE’• LoginScript should be ‘CHARMAP \[windows-1252\]\nLOOP10\n{\nSEND "CLIENTCLIENT"+<0x0d>\nWAIT 3\n{\n"SERVER"OK\n}\n}\nEXIT KErrNoAnswer$\n\nOK:\nEXIT\n’TELEPHONY403Note that the standard settings supplied by Symbian only have one‘CLIENT’, but in order to get it to work with Windows 2000 and XP, theaddition of a second ‘CLIENT’ is necessary (so the string sent becomes‘CLIENTCLIENT’).Using an analog modemUsing an analogue modem is very similar to using NT RAS, but this timethe rest of the settings in the ModemBearer record are important, as isthe phone number in the DialOutISP record.

However, since we can’timagine there are many people out there who actually want to use thismethod for connecting to a network, we’re going to leave the setup as anexercise for the reader.Using a serial link to a mobile phoneThis is covered in the next section as part of the wider setup for attachinga mobile phone to the emulator.13.4 TelephonyAttaching a phone to the Symbian OS emulator is possible, as Symbianprovides a TSY that uses AT commands to communicate with a phoneover a serial cable or a virtual serial port of some kind.

The MultiModeTSY (MM.TSY) is available in both UIQ and S60 SDKs.Finding a phone that supports the required range of AT commandsthough is a somewhat trickier prospect. Fewer and fewer recent phonessupport a sufficient set of AT commands to allow the MM TSY to initialise,let alone operate. The best strategy is to try different phones until you findone that works. The rule of thumb is the older the better, and the morebasic the better.In order to use a phone with the MM.TSY, you firstly need to connectto it.

This should be possible over infrared, Bluetooth or a serial cable(if your phone supports it). Once again, configuration involves changingvalues in CommsDat.Firstly, dump your current CommsDat repository to CED format usingthe instructions in the ‘Configuring Commsdat’ section of this chapter.Then you need to alter the following sections:In the ModemBearer table, find a suitable modem to use. In mostcases you can just pick the first one. Alter the TSYName to ‘MM’ andthe PortName and CSYName to whichever technology you want to useto connect – Bluetooth, infrared or serial (see ‘Using NT RAS’ for moredetails on the options for these fields). Finally, in order to use the phonefor GPRS access, change the Agent field to ‘psd.agt’.

To use it forcircuit switched access, change the Agent field to ‘csd.agt’.404SETTING UP FOR DEVELOPMENTIntheGlobalSettingstable,changeModemForPhoneServicesAndSms and the TsyForBearerAvailability to ‘MM’.Due to our inability to find a recent phone that supported MM TSY,we don’t have steps for the rest of the changes that would be necessaryto use a phone with the emulator. At this point, the setup should be closeto working – SMSs and MMSs should be routed to the TSY, and incomingmessages should be sent to the message store. The IP networking codeshould also be able to use GPRS to connect to the network. However, aswe haven’t got this far ourselves, there may be some areas which we’vefailed to cover where the configuration needs tweaking some more.13.5‘Help, help, my serial port’s been stolen’One of the most common problems in setting up the emulator is aserial port being in use by another component within Symbian OS.

Thebest solution to this is to download the excellent Portmon from SysInternals (now Microsoft) at http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/Portmon.mspx. Then have a look at the traffic that’sbeing sent over the serial port.Typically, you can spot the TSY using the port, as the traffic will haveAT commands in the output. Switching the viewing mode from ASCII tohex is the best option to spot BCSP or IrDA traffic.Bluetooth BCSP traffic is easy to spot with a repeated pattern of C0 4041 00 7E DA DC ED ED A9 7A C0 being transmitted.

IrDA traffic shouldshow up as 10 FF or C0 bytes in a row.If there is no IrDA pod attached, the other way to tell that IrDA istrying to use the port is to look for a sequence of about 12 attempts intotal to set or clear RTS or DTR – you can identify these as they looksimilar to ‘IOCTL SERIAL SET DTR’ (but might say RTS instead of DTRor CLR instead of SET). This is the IrDA stack in Symbian OS trying tocommunicate with the pod, and results in a very characteristic sequenceof events in the Portmon window.0.00005671epoc.exe0.00000782 epoc.exeSerial0SUCCESS0.00000140 epoc.exeSerial0SUCCESS0.00000168 epoc.exeSerial0SUCCESS0.00000140 epoc.exe0.00000112 epoc.exeSerial0SUCCESS0.00000503 epoc.exeSerial0SUCCESSIRP_MJ_CREATESerial0SUCCESS Options: OpenIOCTL_SERIAL_GET_COMMSTATUSIOCTL_SERIAL_GET_BAUD_RATEIOCTL_SERIAL_GET_LINE_CONTROLIOCTL_SERIAL_GET_CHARSSerial0 SUCCESSIOCTL_SERIAL_GET_HANDFLOWIOCTL_SERIAL_GET_COMMSTATUS‘HELP, HELP, MY SERIAL PORT’S BEEN STOLEN’4050.00000419 epoc.exeIOCTL_SERIAL_GET_COMMSTATUSSerial0SUCCESS0.00000531 epoc.exeIOCTL_SERIAL_SET_WAIT_MASKSerial0SUCCESS Mask: RXCHAR CTS DSR RLSD BRK ERR RING0.00000140epoc.exeIOCTL_SERIAL_SET_QUEUE_SIZESerial0SUCCESS InSize: 1024 OutSize: 10240.00000447epoc.exeIOCTL_SERIAL_GET_COMMSTATUSSerial0SUCCESS0.00000531epoc.exeIOCTL_SERIAL_GET_COMMSTATUSSerial0SUCCESS0.00000140epoc.exeIOCTL_SERIAL_GET_BAUD_RATESerial0SUCCESS0.00000140epoc.exeIOCTL_SERIAL_GET_LINE_CONTROLSerial0SUCCESS0.00000140epoc.exeIOCTL_SERIAL_GET_CHARSSerial0 SUCCESS0.00000140epoc.exeIOCTL_SERIAL_GET_HANDFLOWSerial0SUCCESS0.00000419epoc.exeIOCTL_SERIAL_GET_COMMSTATUSSerial0SUCCESS0.00000112epoc.exeIOCTL_SERIAL_GET_BAUD_RATESerial0SUCCESS0.00000140epoc.exeIOCTL_SERIAL_GET_LINE_CONTROLSerial0SUCCESS0.00000112epoc.exeIOCTL_SERIAL_GET_CHARSSerial0 SUCCESS0.00000112epoc.exeIOCTL_SERIAL_GET_HANDFLOWSerial0SUCCESS0.00001090epoc.exeIOCTL_SERIAL_SET_BAUD_RATESerial0SUCCESS Rate: 9600.00000670epoc.exeIOCTL_SERIAL_SET_DTR Serial0 SUCCESS0.00000643epoc.exeIOCTL_SERIAL_SET_LINE_CONTROLSerial0SUCCESS StopBits: 1 Parity: NONE WordLength: 80.00000447epoc.exeIOCTL_SERIAL_SET_CHAR Serial0 SUCCESSEOF:0ERR:0 BRK:0 EVT:0 XON:11 XOFF:130.00000615epoc.exeIOCTL_SERIAL_SET_HANDFLOWSerial0SUCCESS Shake:80000009 Replace:80 XonLimit:768 XoffLimit:2560.00000475epoc.exeIOCTL_SERIAL_GET_COMMSTATUSSerial0SUCCESS0.00000447epoc.exeIOCTL_SERIAL_GET_COMMSTATUSSerial0SUCCESS0.00000615epoc.exeIOCTL_SERIAL_GET_MODEMSTATUSSerial0SUCCESS0.00000643epoc.exeIOCTL_SERIAL_GET_COMMSTATUSSerial0SUCCESS5.00801834epoc.exeIOCTL_SERIAL_WAIT_ON_MASKSerial0SUCCESS0.00000447epoc.exeIOCTL_SERIAL_GET_COMMSTATUSSerial0SUCCESS0.00000587epoc.exeIOCTL_SERIAL_GET_MODEMSTATUSSerial0SUCCESS0.00000978epoc.exeIOCTL_SERIAL_GET_COMMSTATUSSerial0SUCCESS0.00002263epoc.exeIOCTL_SERIAL_SET_WAIT_MASKSerial0SUCCESS Mask: RXCHAR CTS DSR RLSD BRK ERR0.00000251epoc.exeIRP_MJ_CLEANUP Serial0SUCCESS0.01102067epoc.exeIRP_MJ_CLOSESerial0SUCCESSExample 13.1 A component within Symbian OS opening the COMport to check for an attached device406SETTING UP FOR DEVELOPMENT13.5.1 Freeing up Serial Ports that are in UseIn order to stop Bluetooth or IrDA using a serial port, the best option isto alter the setting in the appropriate.

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

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

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

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