none
ILocation trouble

    Question

  • 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
    Friday, October 02, 2009 12:16 PM

Answers

  • 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 by WindowsNT Thursday, October 15, 2009 2:09 PM
    Wednesday, October 14, 2009 11:59 PM
    Moderator

All replies

  • Michael:

    Have you enabled the GPS Sensor in the Location & Other Sensors page in the Control Panel ?
    Friday, October 02, 2009 5:50 PM
    Moderator
  • 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
    Friday, October 02, 2009 5:51 PM
  • 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
    Monday, October 05, 2009 3:40 PM
    Moderator
  • 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
    Tuesday, October 13, 2009 4:51 PM
  • 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 by WindowsNT Thursday, October 15, 2009 2:09 PM
    Wednesday, October 14, 2009 11:59 PM
    Moderator
  • 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
    Thursday, October 15, 2009 1:57 PM
  • That was very helpful comment. I had the precise problem. But do you have any comments on how to go about getting to know the exact cause in managed code.

     

    Maybe catch (COMException ex) ......... is that good enough?

     

    regards,

     

    Digvijay

    Tuesday, June 22, 2010 2:09 PM
  • Hi Dan

    I have written a sample c++/COM program to retreive NMEA stream using Sensor API.

    But when i query for the sensor state on the GPS sensor it is  always returning SENSOR_STATE_INITIALIZING as state , but in order to get the Data Report it should always be in SENSOR_STATE_READY    right ??

    what am i missing???

    I even tried with the diagnostic tool it is showing that the "Pipe is being closed "


    • Edited by anisanaka Wednesday, January 14, 2015 10:25 AM
    Wednesday, January 14, 2015 10:24 AM