2 using System.Collections.Generic;
5 using AnimatGUI.Framework;
9 namespace RobotIOControls
12 public class AnimatSerial : AnimatGUI.DataObjects.Robotics.RemoteControl
14 #region " Attributes "
16 protected string m_strPort =
"";
17 protected int m_iBaudRate = 38400;
26 #region " Attributes "
28 public override string Description {
get {
return "Performs serial communication with a target device to send data from the simulation and back.";} set { }}
29 public override string ButtonImageName {
get {
return "RoboticsGUI.Graphics.AnimatSerial.gif";}}
30 public override string WorkspaceImageName {
get {
return "RoboticsGUI.Graphics.AnimatSerialSmall.gif"; } }
31 public override string PartType {
get {
return "AnimatSerial"; }}
32 public override string ModuleName {
get {
return "RoboticsAnimatSim"; } }
34 public virtual string Port
42 SetSimData(
"Port", value,
true);
47 public virtual int BaudRate
56 throw new System.Exception(
"Invalid baud rate specified. Rate: " + value.ToString());
58 SetSimData(
"BaudRate", value.ToString(),
true);
63 public virtual int ChangeSimStepCount
72 throw new System.Exception(
"Invalid pulse sim step count specified. Rate: " + value.ToString());
74 SetSimData(
"ChangeSimStepCount", value.ToString(),
true);
75 m_iChangeSimStepCount = value;
83 public AnimatSerial(AnimatGUI.Framework.DataObject doParent)
86 m_strName =
"Animat Serial";
90 m_bUseRemoteDataTypes =
false;
95 public override AnimatGUI.Framework.DataObject Clone(AnimatGUI.Framework.DataObject doParent,
bool bCutData, AnimatGUI.Framework.DataObject doRoot)
101 protected override void CloneInternal(DataObject doOriginal,
bool bCutData, DataObject doRoot)
103 base.CloneInternal(doOriginal, bCutData, doRoot);
109 m_strPort = doOrig.m_strPort;
110 m_iBaudRate = doOrig.m_iBaudRate;
111 m_iChangeSimStepCount = doOrig.m_iChangeSimStepCount;
115 public override void BuildProperties(ref AnimatGuiCtrls.Controls.PropertyTable propTable)
117 base.BuildProperties(ref propTable);
119 propTable.Properties.Add(
new AnimatGuiCtrls.Controls.PropertySpec(
"Com Port",
this.Port.GetType(),
"Port",
"Properties",
"Com port", this.Port));
120 propTable.Properties.Add(
new AnimatGuiCtrls.Controls.PropertySpec(
"Baud Rate",
this.BaudRate.GetType(),
"BaudRate",
"Properties",
"Baud rate to use for communications", this.BaudRate));
121 propTable.Properties.Add(
new AnimatGuiCtrls.Controls.PropertySpec(
"Pulse Sim Step Count",
this.ChangeSimStepCount.GetType(),
"ChangeSimStepCount",
"Properties",
"Number of simulation step slices to keep a start/stop signal active", this.ChangeSimStepCount));
130 m_strPort = oXml.GetChildString(
"Port", m_strPort);
131 m_iBaudRate = oXml.GetChildInt(
"BaudRate", m_iBaudRate);
132 m_iChangeSimStepCount = oXml.GetChildInt(
"ChangeSimStepCount", m_iChangeSimStepCount);
143 oXml.AddChildElement(
"Port", m_strPort);
144 oXml.AddChildElement(
"BaudRate", m_iBaudRate);
145 oXml.AddChildElement(
"ChangeSimStepCount", m_iChangeSimStepCount);
152 base.SaveSimulationXml(oXml, ref nmParentControl, strName);
156 oXml.AddChildElement(
"Port", m_strPort);
157 oXml.AddChildElement(
"BaudRate", m_iBaudRate);
158 oXml.AddChildElement(
"ChangeSimStepCount", m_iChangeSimStepCount);
int m_iChangeSimStepCount
The number of time slices to keep a start/stop signal active.