Exemplo n.º 1
0
        public static double?GetRawData(FullDataReading reading, RawDataLocation location)
        {
            double?value = null;

            foreach (PartialRawData data in reading.RawDatas)
            {
                //                if ((data.Code - 0xD0) == location.PartialIndex)
                if ((data.Code - 0xF8) == location.PartialIndex)
                {
                    uint offset = location.Offset * 2;

                    switch (location.Size)
                    {
                    case (ChannelSize.Full):

                        FloatField field = new FloatField(true);

                        field.UnPack(data.RawData, ref offset);

                        value = field.Value;

                        break;

                    case (ChannelSize.Half):

                        UInt16DataField shortField = new UInt16DataField(true);

                        shortField.UnPack(data.RawData, ref offset);

                        value = shortField.Value;

                        break;

                    case (ChannelSize.Double):
                        throw new NotImplementedException("no double sizes supported yet");
                    }
                }
            }

            return(value);
        }