/// <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); }
/// <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_InfraredSensorArray_Proxy_InfraredSensorArrayState_TO_Microsoft_Robotics_Services_InfraredSensorArray_Proxy_InfraredSensorArrayState0(object transformFrom) { global::Microsoft.Robotics.Services.InfraredSensorArray.Proxy.InfraredSensorArrayState target = new global::Microsoft.Robotics.Services.InfraredSensorArray.Proxy.InfraredSensorArrayState(); global::Microsoft.Robotics.Services.InfraredSensorArray.InfraredSensorArrayState from = ((global::Microsoft.Robotics.Services.InfraredSensorArray.InfraredSensorArrayState)(transformFrom)); global::System.Collections.Generic.List <global::Microsoft.Robotics.Services.Infrared.InfraredState> tmp = from.Sensors; if ((tmp != null)) { int count = tmp.Count; global::System.Collections.Generic.List <global::Microsoft.Robotics.Services.Infrared.Proxy.InfraredState> tmp0 = new global::System.Collections.Generic.List <global::Microsoft.Robotics.Services.Infrared.Proxy.InfraredState>(count); for (int index = 0; (index < count); index = (index + 1)) { global::Microsoft.Robotics.Services.Infrared.Proxy.InfraredState tmp1 = default(global::Microsoft.Robotics.Services.Infrared.Proxy.InfraredState); global::Microsoft.Robotics.Services.Infrared.InfraredState tmp2 = tmp[index]; if ((tmp2 != null)) { tmp1 = ((global::Microsoft.Robotics.Services.Infrared.Proxy.InfraredState)(Microsoft_Robotics_Services_Infrared_Proxy_InfraredState_TO_Microsoft_Robotics_Services_Infrared_Proxy_InfraredState0(tmp2))); } tmp0.Add(tmp1); } target.Sensors = tmp0; } return(target); }