Reading temperature from CPro

I’m attempting to read temperature from a CPro sensor (model
2; hw rev 0.3; sw rev 1.2.5).
  I used the
documentation and the UWP starter app to successfully get a reference to,
subscribe and read from a temperature data signal.

//Obtain reference to data signal
temp_signal =
mbl_mw_multi_chnl_temp_get_temperature_data_signal(cppBoard, (byte)Sensor.MultiChannelTemperature.Source.PRESET_THERMISTOR);

//Subscribe to data signal
bl_mw_datasignal_subscribe(temp_signal,
dataSignalReadHandler);

//Read from signal on timer
mbl_mw_datasignal_read(temp_signal);

I’m having trouble understanding the marshalled data in the
read handler.
  The IntPtr data is
marshalled into a
MbientLab.MetaWear.Core.Data.  The value member is another IntPtr.  How does one obtain temperature value from
the struct?
  Documentation indicates the
value is a float and needs to be cast.
  Am
I going about this the right way?

 

//Signal read handler

private void
dataSignalReadHandler(IntPtr data)

{

Data marshalledData = Marshal.PtrToStructure<Data>(data);

       System.Diagnostics.Debug.WriteLine(((float)marshalledData.value); //

       System.Diagnostics.Debug.WriteLine(marshalledData.epoch);

       System.Diagnostics.Debug.WriteLine(marshalledData.typeId);

       System.Diagnostics.Debug.WriteLine(marshalledData.length);

}

Comments

This discussion has been closed.