public AsyncSensorData(Robot robot, ResponseCode code, Byte seqNum, Byte[] data, AsynchronousId asyncCode, Int32 length, UInt64 mask)
     : base(robot, code, seqNum, data, asyncCode, length)
 {
     if ((Int32)Data.Length == CountBits(mask) * 2)
     {
         Int32 num = 0;
         if (MaskHasFlag(mask, (DataStreaming)((Int64)458752)))
         {
             Attitude = new AttitudeReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num = num + 6;
         }
         if (MaskHasFlag(mask, (DataStreaming)((Int64)57344)))
         {
             Accelorometer = new AccelerometerReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num = num + 6;
         }
         if (MaskHasFlag(mask, (DataStreaming)((Int64)7168)))
         {
             Gyrometer = new GyrometerReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num = num + 6;
         }
         if (MaskHasFlag(mask, DataStreaming.Quaternion))
         {
             Quaternion = new QuaternionReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4), (Single)GetFloatFromBytes(num + 6));
             num = num + 8;
         }
         if (MaskHasFlag(mask, DataStreaming.Location))
         {
             Location = new LocationReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2));
             num = num + 4;
         }
         if (MaskHasFlag(mask, DataStreaming.Velocity))
         {
             Velocity = new VelocityReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2));
             num = num + 4;
         }
     }
 }
Esempio n. 2
0
 public AsyncSensorData(Robot robot, ResponseCode code, Byte seqNum, Byte[] data, AsynchronousId asyncCode, Int32 length, UInt64 mask)
     : base(robot, code, seqNum, data, asyncCode, length)
 {
     if ((Int32)Data.Length == CountBits(mask) * 2)
     {
         Int32 num = 0;
         if (MaskHasFlag(mask, (DataStreaming)((Int64)458752)))
         {
             Attitude = new AttitudeReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num      = num + 6;
         }
         if (MaskHasFlag(mask, (DataStreaming)((Int64)57344)))
         {
             Accelorometer = new AccelerometerReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num           = num + 6;
         }
         if (MaskHasFlag(mask, (DataStreaming)((Int64)7168)))
         {
             Gyrometer = new GyrometerReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num       = num + 6;
         }
         if (MaskHasFlag(mask, DataStreaming.Quaternion))
         {
             Quaternion = new QuaternionReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4), (Single)GetFloatFromBytes(num + 6));
             num        = num + 8;
         }
         if (MaskHasFlag(mask, DataStreaming.Location))
         {
             Location = new LocationReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2));
             num      = num + 4;
         }
         if (MaskHasFlag(mask, DataStreaming.Velocity))
         {
             Velocity = new VelocityReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2));
             num      = num + 4;
         }
     }
 }