Motorola i88s manual Example Using PositionConnection

Page 10

Motorola Inc.

i88s J2ME Developers’ Guide

BATTERY_TOO_LOW – A constant to indicate that the battery is too weak to retrieve a fix.

FIX_NOT_ATTAIN_ASSIST_DATA_UNAV – This constant indicates that the location fix has timed out because a fix is not attainable, and assist data is unavailable.

FIX_NOT_ATTAINABLE – This constant indicates that the location fix has timed out because a fix is not attainable.

GPS_CHIPSET_MALFUNCTION – This constant indicates that the GPS chipset is malfunctioning.

UNAVAILABLE – This constant indicates that an unknown error has occurred. This is the default response code.

These response codes are used in conjunction with PositionConnection.getStatus() to determine the quality of the retrieved position. These values are only valid when either

POSITION_RESPONSE_ERROR or POSITION_RESPONSE_OK have been returned.

The following table shows possible response codes for these two values:

PositionConnection Status Values

Response Codes

POSITION_RESPONSE_OK

POSITION_OK

 

ACCURACY_NOT_ATTAINABLE

 

ACC_NOT_ATTAIN_ASSIST_DATA_UNAV

POSITION_RESPONSE_ERROR

FIX_NOT_ATTAINABLE

 

FIX_NOT_ATTAIN_ASSIST_DATA_UNAV

 

BATTERY_TOO_LOW

 

GPS_CHIPSET_MALFUNCTION

 

ALMANAC_OUT_OF_DATE, UNAVAILABLE

1.3.2.2 getAssistanceUsed()

Applications can use the getAssistanceUsed() method to check if a fix has been retrieved using assistance.

1.3.3 Example – Using PositionConnection

void getViaPositionConnection() throws IOException { com.motorola.iden.PositionConnection c = null; String name = “mposition:delay=low”;

try{

c = (PositionConnection)Connector.open(name); AggregatePosition oap = c.getPosition();

//Returns the AggregatePosition which contains the position using the

//parameter passed when connection was opened.

//Application should only check status by calling getStatus() after

//getPosition() or getPosition(String name) returns,

//otherwise it returns the same status and is

//considered an invalid call of getStatus().

//check the status code for permission and almanac over ride if(c.getStatus() ==

Version 1.0 - Page 10

Image 10
Contents I88s Multi-Communication Device J2ME Developers’ Guide J2ME Networking Document Overview DisclaimerAcronyms and Definitions Contact InformationAcronyms Used In This Guide Terminology Definition Agps On The i88s Phone OverviewAccuracy Position APIAssist Data Almanac Out Of Date PositionConnection ClassExample GetPosition Method DescriptionsRetrieving Position in Java GetPositionString nameUsing Position in Java GetStatusExample Using PositionConnection Positionresponsenoalmanacoverride Addition, to obtain better accurate speed and direction Recommendation J2ME Networking Http HttpsClass Descriptions Https HttpSupported Protocols on the i88s Phone SSL Secure Sockets TCP SocketsServerSockets Serial Port Access UDP SocketsConnection Optional Parameters Communicating on a PortExample using StreamConnection Implementation NotesTips Concurrent Connections For The i88s Phone Protocol MaximumClass Description File I/OMethod Descriptions Opening a file Reading and Writing Deleting a fileCode Examples Example # 2 Complete MIDlet code Motorola Inc I88s J2ME Developers’ Guide Os = sc.openOutputStream //get InputStream Sc.close Caveats Motorola Inc I88s J2ME Developers’ Guide
Related manuals
Manual 43 pages 17.94 Kb