How to send the Orientation Sensor data type to Sample Compass Application ? RRS feed

  • Question

  • Hi,

    I made the orientation sensor driver to use the UMDF 1(no use HID).

    If I test to use the SensorDiagnostic Tool, Sensor Properity and data type is show as below.

    But,I tested to use the Sample compass application(

    It did not get the DataEvent.

    I think that Application was called the "ReadingChanged()" function in "Scenario1_DataEvents.xaml.cpp". But it did not call.

    When Send the DataEvent in Driver layer , I use the "PostEvent()" function as below.



        ISensorClassExtension : public IUnknown




            virtual HRESULT STDMETHODCALLTYPE PostEvent(

                /* [in][string] */ __RPC__in_string LPWSTR pwszSensorID,

                /* [in] */ __RPC__in_opt IPortableDeviceValuesCollection *pEventCollection) = 0;




    What function is to send the DataEvent to call the "ReadingChanged()" in the Sample Application ?

    Monday, November 2, 2015 2:32 AM

All replies

  • Second, I tested to use the Sample compass application(

    When call "CompassReading^ reading = compass->GetCurrentReading();" in "void Scenario2_Polling::DisplayCurrentReading()" ,

    "HRESULT CSensorDdi::OnGetDataFields()" is called in Device driver as below.

        HRESULT CSensorDdi::OnGetDataFields(
            _In_  IWDFFile* appId,
            _In_  LPWSTR wszObjectID,
            _In_  IPortableDeviceKeyCollection* pKeys,
            _Out_ IPortableDeviceValues** ppValues

    I checked "appId","wszObjectID","pKeys" . All Parameter was correct.

     So, in this function , input all sensor data to "ppValues".

    and then check the "CompassReading^ reading " .

    "reading" is "NULL".

    I think that "CompassReading" class  can not get the data field value.

    • Edited by KyoungSuck.Ki Wednesday, November 4, 2015 6:13 AM wrong word
    Wednesday, November 4, 2015 6:10 AM
  • Third, I tested ISensorManager class and ISensor class as below.


    ISensorManager *manager;
    ISensorCollection *collection;
    ISensor *sensor;

    ISensorDataReport* ppdata;

     if (FAILED(CoCreateInstance(CLSID_SensorManager, NULL, CLSCTX_INPROC_SERVER, IID_ISensorManager, (void**)&manager)))

      if (FAILED(manager->GetSensorsByType(SENSOR_TYPE_AGGREGATED_DEVICE_ORIENTATION, &collection)))

     ULONG count = 0;
     if (!count)
     collection->GetAt(0, &sensor);


    PROPVARIANT *tempdata = new PROPVARIANT;



    It was working fine.

    I think that WinRT Class is wrong.

    Friday, November 6, 2015 6:47 AM