예제 #1
0
 /// <summary>
 ///Deserializes MarkRobotState
 ///</summary>
 ///<param name="reader">the reader from which to deserialize</param>
 ///<returns>deserialized MarkRobotState</returns>
 public virtual object Deserialize(System.IO.BinaryReader reader)
 {
     this._LastStartTime                 = global::Microsoft.Dss.Services.Serializer.BinarySerializationHelper.DeserializeDateTime(reader);
     this._SensorPollingInterval         = reader.ReadInt32();
     this._BatteryVoltagePinIndex        = reader.ReadInt32();
     this._BatteryVoltageDivider         = reader.ReadDouble();
     this._InfraredRawValueDivisorScalar = reader.ReadDouble();
     this._InfraredDistanceExponent      = reader.ReadDouble();
     this._SonarTimeValueMultiplier      = reader.ReadDouble();
     if ((reader.ReadByte() != 0))
     {
         this._DriveState = ((global::Microsoft.Robotics.Services.Drive.Proxy.DriveDifferentialTwoWheelState)(((Microsoft.Dss.Core.IDssSerializable)(new global::Microsoft.Robotics.Services.Drive.Proxy.DriveDifferentialTwoWheelState())).Deserialize(reader)));
     }
     if ((reader.ReadByte() != 0))
     {
         this._InfraredSensorState = ((global::Microsoft.Robotics.Services.InfraredSensorArray.Proxy.InfraredSensorArrayState)(((Microsoft.Dss.Core.IDssSerializable)(new global::Microsoft.Robotics.Services.InfraredSensorArray.Proxy.InfraredSensorArrayState())).Deserialize(reader)));
     }
     if ((reader.ReadByte() != 0))
     {
         this._SonarSensorState = ((global::Microsoft.Robotics.Services.SonarSensorArray.Proxy.SonarSensorArrayState)(((Microsoft.Dss.Core.IDssSerializable)(new global::Microsoft.Robotics.Services.SonarSensorArray.Proxy.SonarSensorArrayState())).Deserialize(reader)));
     }
     if ((reader.ReadByte() != 0))
     {
         this._BatteryState = ((global::Microsoft.Robotics.Services.Battery.Proxy.BatteryState)(((Microsoft.Dss.Core.IDssSerializable)(new global::Microsoft.Robotics.Services.Battery.Proxy.BatteryState())).Deserialize(reader)));
     }
     return(this);
 }
예제 #2
0
 /// <summary>
 ///Copies the data member values of the current MarkRobotState to the specified target object
 ///</summary>
 ///<param name="target">target object (must be an instance of)</param>
 public virtual void CopyTo(Microsoft.Dss.Core.IDssSerializable target)
 {
     global::Microsoft.Robotics.ReferencePlatform.MarkRobot.Proxy.MarkRobotState typedTarget = ((global::Microsoft.Robotics.ReferencePlatform.MarkRobot.Proxy.MarkRobotState)(target));
     typedTarget._LastStartTime                 = this._LastStartTime;
     typedTarget._SensorPollingInterval         = this._SensorPollingInterval;
     typedTarget._BatteryVoltagePinIndex        = this._BatteryVoltagePinIndex;
     typedTarget._BatteryVoltageDivider         = this._BatteryVoltageDivider;
     typedTarget._InfraredRawValueDivisorScalar = this._InfraredRawValueDivisorScalar;
     typedTarget._InfraredDistanceExponent      = this._InfraredDistanceExponent;
     typedTarget._SonarTimeValueMultiplier      = this._SonarTimeValueMultiplier;
     if ((this._DriveState != null))
     {
         global::Microsoft.Robotics.Services.Drive.Proxy.DriveDifferentialTwoWheelState tmp = new global::Microsoft.Robotics.Services.Drive.Proxy.DriveDifferentialTwoWheelState();
         ((Microsoft.Dss.Core.IDssSerializable)(this._DriveState)).CopyTo(((Microsoft.Dss.Core.IDssSerializable)(tmp)));
         typedTarget._DriveState = tmp;
     }
     if ((this._InfraredSensorState != null))
     {
         global::Microsoft.Robotics.Services.InfraredSensorArray.Proxy.InfraredSensorArrayState tmp0 = new global::Microsoft.Robotics.Services.InfraredSensorArray.Proxy.InfraredSensorArrayState();
         ((Microsoft.Dss.Core.IDssSerializable)(this._InfraredSensorState)).CopyTo(((Microsoft.Dss.Core.IDssSerializable)(tmp0)));
         typedTarget._InfraredSensorState = tmp0;
     }
     if ((this._SonarSensorState != null))
     {
         global::Microsoft.Robotics.Services.SonarSensorArray.Proxy.SonarSensorArrayState tmp1 = new global::Microsoft.Robotics.Services.SonarSensorArray.Proxy.SonarSensorArrayState();
         ((Microsoft.Dss.Core.IDssSerializable)(this._SonarSensorState)).CopyTo(((Microsoft.Dss.Core.IDssSerializable)(tmp1)));
         typedTarget._SonarSensorState = tmp1;
     }
     if ((this._BatteryState != null))
     {
         global::Microsoft.Robotics.Services.Battery.Proxy.BatteryState tmp2 = new global::Microsoft.Robotics.Services.Battery.Proxy.BatteryState();
         ((Microsoft.Dss.Core.IDssSerializable)(this._BatteryState)).CopyTo(((Microsoft.Dss.Core.IDssSerializable)(tmp2)));
         typedTarget._BatteryState = tmp2;
     }
 }
 public static object Microsoft_Robotics_Services_SonarSensorArray_Proxy_SonarSensorArrayState_TO_Microsoft_Robotics_Services_SonarSensorArray_Proxy_SonarSensorArrayState0(object transformFrom)
 {
     global::Microsoft.Robotics.Services.SonarSensorArray.Proxy.SonarSensorArrayState target            = new global::Microsoft.Robotics.Services.SonarSensorArray.Proxy.SonarSensorArrayState();
     global::Microsoft.Robotics.Services.SonarSensorArray.SonarSensorArrayState       from              = ((global::Microsoft.Robotics.Services.SonarSensorArray.SonarSensorArrayState)(transformFrom));
     global::System.Collections.Generic.List <global::Microsoft.Robotics.Services.Sonar.SonarState> tmp = from.Sensors;
     if ((tmp != null))
     {
         int count = tmp.Count;
         global::System.Collections.Generic.List <global::Microsoft.Robotics.Services.Sonar.Proxy.SonarState> tmp0 = new global::System.Collections.Generic.List <global::Microsoft.Robotics.Services.Sonar.Proxy.SonarState>(count);
         for (int index = 0; (index < count); index = (index + 1))
         {
             global::Microsoft.Robotics.Services.Sonar.Proxy.SonarState tmp1 = default(global::Microsoft.Robotics.Services.Sonar.Proxy.SonarState);
             global::Microsoft.Robotics.Services.Sonar.SonarState       tmp2 = tmp[index];
             if ((tmp2 != null))
             {
                 tmp1 = ((global::Microsoft.Robotics.Services.Sonar.Proxy.SonarState)(Microsoft_Robotics_Services_Sonar_Proxy_SonarState_TO_Microsoft_Robotics_Services_Sonar_Proxy_SonarState0(tmp2)));
             }
             tmp0.Add(tmp1);
         }
         target.Sensors = tmp0;
     }
     return(target);
 }