internal static SensorReport FromNativeReport(Sensor originator, ISensorDataReport iReport)
        {
            SystemTime systemTimeStamp = new SystemTime();

            try
            {
                iReport.GetTimestamp(out systemTimeStamp);
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                System.Diagnostics.Trace.WriteLine(ex);
                return(null);
            }
            FILETIME ftTimeStamp = new FILETIME();

            SensorNativeMethods.SystemTimeToFileTime(ref systemTimeStamp, out ftTimeStamp);
            long     lTimeStamp = (((long)ftTimeStamp.dwHighDateTime) << 32) + (long)ftTimeStamp.dwLowDateTime;
            DateTime timeStamp  = DateTime.FromFileTime(lTimeStamp);

            SensorReport sensorReport = new SensorReport();

            sensorReport.originator = originator;
            sensorReport.timeStamp  = timeStamp;
            sensorReport.sensorData = SensorData.FromNativeReport(originator.internalObject, iReport);

            return(sensorReport);
        }
Exemplo n.º 2
0
        internal static SensorReport FromNativeReport(Sensor originator, ISensorDataReport iReport)
        {
            SystemTime systemTimeStamp = new SystemTime();

            iReport.GetTimestamp(out systemTimeStamp);
            FILETIME ftTimeStamp = new FILETIME();

            SensorNativeMethods.SystemTimeToFileTime(ref systemTimeStamp, out ftTimeStamp);
            long     lTimeStamp = (((long)ftTimeStamp.dwHighDateTime) << 32) + (long)ftTimeStamp.dwLowDateTime;
            DateTime timeStamp  = DateTime.FromFileTime(lTimeStamp);

            SensorReport sensorReport = new SensorReport();

            sensorReport.originator = originator;
            sensorReport.timeStamp  = timeStamp;
            sensorReport.sensorData = SensorData.FromNativeReport(originator.internalObject, iReport);

            return(sensorReport);
        }