Ask a questionAsk a question
 

AnswerILocation trouble

  • Friday, October 02, 2009 12:16 PMWindowsNT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am trying to use ILocation to get the location lon/lat while a GPS sensor is attached and there are two problems.

    1. No notification method (my ILocationEvents) is called

    2. When I manually call ILocation::GetReport() , I get a HRESULT error "pipe is closing"

    What's wrong ?


    Michael

Answers

  • Wednesday, October 14, 2009 11:59 PMDan PolivyMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Michael,

    The error you are getting is HRESULT_FROM_WIN32(ERROR_NO_DATA), which seems to map to the friendly (but unhelpful, in this case) string "The pipe is being closed."  That's the expected error when the platform doesn't see your sensor providing a valid report.

    A few other things to look at:
    - Make sure you're using VT_R8 as the types for your lat/long/etc fields, NOT VT_R4.  An earlier version of the header/documentation was out of sync on this and might have caused some confusion.
    - Download the Diagnostic Tool from the MSDN Code Gallery (http://code.msdn.microsoft.com/SensorsAndLocation).  What do you see when you select your sensor?  Specifically, for category, type, state, and data fields?

    The data fields should look something like this:

    SENSOR_DATA_TYPE_TIMESTAMP 2009-10-14T16:57:18.0470000-07:00
    SENSOR_DATA_TYPE_LATITUDE_DEGREES 47.6632791712841
    SENSOR_DATA_TYPE_LONGITUDE_DEGREES -122.151004966225
    SENSOR_DATA_TYPE_ALTITUDE_ELLIPSOID_METERS 0
    SENSOR_DATA_TYPE_ERROR_RADIUS_METERS 200

    - You can also capture an XML dump via the tool of your sensor--do that and post the relevant bits here, that will help diagnose the issue.
    - Also look at the Default Location CPL, and ensure it is empty.  When you do this, do you still get the STATUS_RUNNING status from the API?

    Dan
    • Marked As Answer byWindowsNT Thursday, October 15, 2009 2:09 PM
    •  

All Replies

  • Friday, October 02, 2009 5:50 PMArvind AiyarMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Michael:

    Have you enabled the GPS Sensor in the Location & Other Sensors page in the Control Panel ?
  • Friday, October 02, 2009 5:51 PMWindowsNT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yes.

    Its my driver. Am I missing something ? I 've marked it as a GPS Location sensor and I return required values (lon/lat/radius error).



    Michael
  • Monday, October 05, 2009 3:40 PMDan PolivyMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Michael,

    Are you properly reporting State and Data Updated events?  The location API is driven primarily off of events posted from the driver, but it is important for the state events to be sent as well, and in the correct order, as described here:

    http://msdn.microsoft.com/en-us/library/dd445404.aspx

    Dan
  • Tuesday, October 13, 2009 4:51 PMWindowsNT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yes I am doing it correctly, and ILocation::GetReportStatus returns STATUS_RUNNING.
    The problem is when trying ILocation::GetReport(__uuidof(ILatLongReport),&lmr); It returns  0x800700e8 The pipe is being closed. 
    Why would that method return that sort of error ?



    Michael
  • Wednesday, October 14, 2009 11:59 PMDan PolivyMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Michael,

    The error you are getting is HRESULT_FROM_WIN32(ERROR_NO_DATA), which seems to map to the friendly (but unhelpful, in this case) string "The pipe is being closed."  That's the expected error when the platform doesn't see your sensor providing a valid report.

    A few other things to look at:
    - Make sure you're using VT_R8 as the types for your lat/long/etc fields, NOT VT_R4.  An earlier version of the header/documentation was out of sync on this and might have caused some confusion.
    - Download the Diagnostic Tool from the MSDN Code Gallery (http://code.msdn.microsoft.com/SensorsAndLocation).  What do you see when you select your sensor?  Specifically, for category, type, state, and data fields?

    The data fields should look something like this:

    SENSOR_DATA_TYPE_TIMESTAMP 2009-10-14T16:57:18.0470000-07:00
    SENSOR_DATA_TYPE_LATITUDE_DEGREES 47.6632791712841
    SENSOR_DATA_TYPE_LONGITUDE_DEGREES -122.151004966225
    SENSOR_DATA_TYPE_ALTITUDE_ELLIPSOID_METERS 0
    SENSOR_DATA_TYPE_ERROR_RADIUS_METERS 200

    - You can also capture an XML dump via the tool of your sensor--do that and post the relevant bits here, that will help diagnose the issue.
    - Also look at the Default Location CPL, and ensure it is empty.  When you do this, do you still get the STATUS_RUNNING status from the API?

    Dan
    • Marked As Answer byWindowsNT Thursday, October 15, 2009 2:09 PM
    •  
  • Thursday, October 15, 2009 1:57 PMWindowsNT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you - the bug is that I was returning R4 for X and Y. Fixed now. The driver has been updated and provides an ILocation report now. Best Regards.
    Michael