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

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

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

The position returnedto the client may be either a GPS position (calculated in the mobiledevice) or a final network position (calculated using the measurementsby a remote server in the network). The position that is calculated first(the GPS position or the final network position) is generally returnedto the client. The final network position may also be returned to theclient after the return of the GPS position.• Cell-Based PositioningLBS obtains a position fix from the network without using GPS. Thisposition fix is sometimes less accurate than that obtained using GPS.A client application cannot directly choose the positioning mode thatis used for its location request. A handset manufacturer may providean LBS ‘control panel’ type of application where the GPS mode can beselected by an end user.

However, for modes that involve the network(Terminal-Based Positioning, Terminal-Assisted Positioning, Hybrid andCell-Based Positioning), it is possible for a network operator to overridethe GPS mode as part of the location request. If a client wants to knowprecisely how a position fix was calculated, this information is availablein the returned position information object.312SYMBIAN C++ RECIPESA typical scenario might be as follows:• Create a session with the location server (LS).• Create a subsession with the LS using default positioning module.• Set required update options.• Issue a location information request.• Get requested data in TPositionInfo variable or handle possibleerrors.• Close the subsession and the session.The code sample below implements this scenario for the simplest case.A production-quality application will not use User::Wait() to receivean asynchronous notification, but uses an active object to handle events.#include <lbs.h>TInt GetPositionInfoL(TPosition& aPos){RPositionServer server;RPositioner positioner;// 1.

Create a session with the location serverUser::LeaveIfError(server.Connect());CleanupClosePushL(server);// 2. Create a subsession using the default positioning moduleUser::LeaveIfError(positioner.Open(server));CleanupClosePushL(positioner);// 3. Set update optionsTPositionUpdateOptions puo;// Update the position every 30 secpuo.SetUpdateInterval(30000000);// Set update request timeout to 15 secondspuo.SetUpdateTimeOut(15000000);// Set the optionspositioner.SetUpdateOptions(puo);// 4. Request location information// Could also call positioner.GetLastKnownPosition(posInfo, status)// to get cached location information// Set position requestor_LIT(KRequestor,"Location Sample Application");TInt err =positionerEx.SetRequestor( CRequestor::ERequestorService,CRequestor::EFormatApplication, KRequestor );TPositionInfo posInfo;TRequestStatus status;positioner.NotifyPositionUpdate(posInfo, status);LOCATION-BASED SERVICES313// Wait on an event (in production code, you should// use an active object)User::WaitForRequest(status);// 5.

Receive location informationif (status.Int() != KErrNone){// Handle possible client-server errorsCleanupStack::PopAndDestroy(2, &server); // positioner, serverreturn status.Int();}// Get the position data object from the wrapper info objectposInfo.GetPosition(aPos);// Later on, use the obtained position information, e.g. calling// aPos.Latitude() etc. methods// 6. Close the subsession and sessionCleanupStack::PopAndDestroy(2, &server);}Various LBS classes hold position information as 32- and 64-bit realnumbers for most of the cases unless stated otherwise.

The standardmeasurement units are as follows:• Latitude and longitude are held in 64-bit real numbers. Altitude isheld in a 32-bit real number. By default, the WGS-84 datum is usedto reference coordinates. All positions returned by the location serveruse this coordinate reference system. Latitude values are in the range[−90, +90] (−90 <= latitude <= +90), whereas longitude values arein the range [−180, +180) (−180 <= longitude < +180).• Both horizontal and vertical accuracy are held in 32-bit real numbersthat represent the error offset in meters.

In practice, the actual positionlies within the respective accuracy circle with 68 % probability.• Bearings and headings are held in 32-bit real numbers and representthe direction in degrees from the true north. Their correspondingaccuracies are also held in 32-bit real numbers and represented indegrees.If you need to convert those values to the regular string representation,for instance, in the ±DDD MM?SS.SSS form, the following long (butsimple) function gives you some idea of how to do it:void GetDegreesString(const TReal64& aDegrees,TBuf<16>& aDegreesString){const TReal KSecondsInMinute = 60.0;const TInt KNumWidth = 3;314SYMBIAN C++ RECIPES// Degrees sign delimeter used in formatting methods_LIT(KDelimDegree,"\xb0"); // "◦ " symbol// Dot delimeter used in formatting methods_LIT(KDelimDot,"\x2e"); // "." symbol// Plus sign delimeter used in formatting methods_LIT(KDelimPlus,"\x2b"); // "+" symbol// Minus sign delimeter used in formatting methods_LIT(KDelimMinus,"\x2d"); // "-" symbol// Quotation sign delimeter used in formatting methods_LIT(KDelimQuot,"\x22"); // "" symbol// Apostrophe sign delimeter used in formatting methods_LIT(KApostrophe,"\x27"); // "'" symbol// Not-a-number string_LIT(KNan,"NaN");TReal64 realTmp = 0;// Check if aDegree is a proper number and exit otherwiseif ( Math::IsNaN(aDegrees) ){aDegreesString = KNan;return;}// Integer part of the degreesTInt intDegrees = 0;if ( Math::Int(realTmp,aDegrees) == KErrNone ){intDegrees = (TInt)realTmp;}// Positive float of the degreesTReal64 realDegrees = aDegrees;// Convert to positive valuesif ( intDegrees < 0 ){intDegrees = -intDegrees;realDegrees = -realDegrees;}// MinutesTReal64 realMinutes = 0;if ( Math::Frac(realMinutes,realDegrees) == KErrNone ){realMinutes *= KSecondsInMinute;}else{realMinutes = (realDegrees - intDegrees) * KSecondsInMinute;}// Integer part of the minutesTInt intMinutes = 0;if ( Math::Int(realTmp,realMinutes) == KErrNone ){intMinutes = (TInt)realTmp;}// SecondsTReal64 realSeconds = 0;if ( Math::Frac(realSeconds,realMinutes) == KErrNone ){realSeconds *= KSecondsInMinute;LOCATION-BASED SERVICES}else{realSeconds = (realMinutes - intMinutes) * KSecondsInMinute;}TInt intSeconds = 0;if ( Math::Int(realTmp,realSeconds) == KErrNone ){intSeconds = (TInt)realTmp;}// Check the sign of the resultif ( aDegrees >= 0 ){aDegreesString.Append(KDelimPlus);}else{aDegreesString.Append(KDelimMinus);}// Add the degreesTInt64 value = intDegrees;aDegreesString.AppendNum(value);// Add the separatoraDegreesString.Append(KDelimDegree);// Add the minutesvalue = intMinutes;aDegreesString.AppendNum(value);// Add the separatoraDegreesString.Append(KApostrophe);// Add the secondsvalue = intSeconds;aDegreesString.AppendNum(value);// Add the separatoraDegreesString.Append(KDelimQuot);// Add the separatoraDegreesString.Append(KDelimDot);// Get six last digitsrealSeconds -= intSeconds;realSeconds *= 1000;// Add the secondsaDegreesString.AppendNumFixedWidth(static_cast<TInt>(realSeconds),EDecimal, KNumWidth);}4.10.2.2Request Extended Location InformationAmount of time required: 30 minutesLocation of example code: \LocationRequired library(s): lbs.lib (S60), lbsselflocate.lib(UIQ)315316SYMBIAN C++ RECIPESRequired header file(s): lbs.hRequired platform security capability(s): LocationProblem: You want to obtain extended location information.Solution: In addition to the general position classes, there are two otherposition classes: TPositionCourseInfo and TPositionSatelliteInfo.

The latter class inherits from the former.TPositionCourseInfo incorporates a TCourse object, which provides information about the current speed at which the device is moving,the device’s direction in terms of bearing, and also the accuracy of theseparameters.In turn, TPositionSatelliteInfo contains information about thesatellites used in locating: how many satellites are available, which ofthose were used to produce the current estimate, and a list of the satelliteswith their data. The TSatelliteData class represents a satellite.A client gets the information by sending the appropriate TPositionInfo object to the location server via NotifyPositionUpdate().If the currently used positioning module supports the requested data,it fills the object with the data and returns it to the client.

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

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

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

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