Adding Support for User Locations to an MSN Direct Application

Windows CE 5.0 Not SupportedWindows Embedded NavReady 2009 Supported

10/16/2008

To support the Send to GPS feature at Live Search, you must add support to an MSN Direct application for handling incoming messages that contain user locations.

To complete this task, you must already have created an application and added support for a custom message class to which an application typecasts messages of type USER_LOCATION. For more information, see How to Integrate MSN Direct into a Device and Adding Custom Classes for Incoming Messages.

To add support for user locations to an MSN Direct application

  1. In Platform Builder, open MSNDirect.cpp.

  2. In the DBR701 subclass that you created, add the USER_LOCATIONS service type to the list of supported service types. For more information, see the example later in this topic.

  3. In the overridden DBR701::ProcessInMessageFromReceiver method, add message-handling code to handle an incoming message when the service type is USER_LOCATIONS. For example, you can typecast the message to a UserLocationsMsg object by using UserLocationsMsg.h from the sample application. For an example of how to handle the contents of a user-locations message, see UserLocationsHandler.cpp in the MSN Direct sample application.

  4. (Optional) Parse location information from the UserLocationsMsg object that can be interpreted by a third-party navigation application.

    For example, you can call UserLocationsMsg::GetLocation to obtain a WGS84 object that describes the latitude and longitude of the location, and you can call UserLocationsMsg::GetName to obtain the name of the location.

  5. Rebuild your MSN Direct application.

Example

The following code example is a simple illustration of how to add USER_LOCATIONS to the list of supported service types by handling an incoming message if the service type is APPLICATION_LIST:

void DBRHost::ProcessInMessageFromReceiver(
     MsgFromReceiver *messageFromReceiver, 
     GenericHostMsg *responseMessage)
{
     int App = messageFromReceiver->GetApplicationType();

     switch (App)
     {
      case APPLICATION_LIST :
      {

      ApplicationListMsg *pMsg = ( ApplicationListMsg * )messageFromReceiver;
      ApplicationListMsg *appList = ( ApplicationListMsg * )outMessage;
      appList->Init();
      appList->SetTransactionId( inMessage->GetTransactionId() );
      appList->SetApplicationType( inMessage->GetApplicationType() );
      appList->SetResponse( true );
      appList->SetErrorCode( APP_ERR_SUCCESS );

      appList->AddApplication( USER_LOCATIONS );
      appList->FinishMessage();
      appList->SetCRC();
      }

// Prepare a simple response and no-error by default
     PrepareSimpleResponseMessage(responseMessage, 
          messageFromReceiver->GetTransactionId(), 
          messageFromReceiver->GetApplicationType(), APP_ERR_SUCCESS);
}

See Also

Concepts

How to Enable Users to Send Search Results from a Desktop PC to a Portable Navigation Device