2 using System.Collections.Generic;
5 using AnimatGUI.Framework;
9 namespace RobotIOControls
16 #region " Attributes "
18 protected string m_strComPort =
"COM4";
19 protected int m_iBaudRate = 115200;
23 #region " Attributes "
25 public override string Description {
get {
return "Performs IO with a microcontroller like the Arduino that implements the Firmata protocols.";} set { }}
26 public override string ButtonImageName {
get {
return "RoboticsGUI.Graphics.Firmata.gif";}}
27 public override string WorkspaceImageName {
get {
return "RoboticsGUI.Graphics.FirmataSmall.gif";}}
28 public override string PartType {
get {
return "FirmataController"; }}
29 public override string ModuleName {
get {
return "RoboticsAnimatSim"; } }
31 public virtual string ComPort
39 SetSimData(
"ComPort", m_strComPort,
true);
44 public virtual int BaudRate
53 throw new System.Exception(
"Invalid baud rate specified. Rate: " + value.ToString());
55 SetSimData(
"BaudRate", value.ToString(),
true);
67 m_strName =
"Firmata Controller";
80 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"MotorSendTime",
"Motor Send Time",
"Seconds",
"s", 0, 1));
83 public override AnimatGUI.Framework.DataObject Clone(AnimatGUI.Framework.DataObject doParent,
bool bCutData, AnimatGUI.Framework.DataObject doRoot)
89 protected override void CloneInternal(DataObject doOriginal,
bool bCutData, DataObject doRoot)
91 base.CloneInternal(doOriginal, bCutData, doRoot);
97 m_strComPort = doOrig.m_strComPort;
98 m_iBaudRate = doOrig.m_iBaudRate;
102 public override void BuildProperties(ref AnimatGuiCtrls.Controls.PropertyTable propTable)
104 base.BuildProperties(ref propTable);
106 propTable.Properties.Add(
new AnimatGuiCtrls.Controls.PropertySpec(
"Com Port",
this.ComPort.GetType(),
"ComPort",
"Properties",
"Com port number", this.ComPort));
107 propTable.Properties.Add(
new AnimatGuiCtrls.Controls.PropertySpec(
"Baud Rate",
this.BaudRate.GetType(),
"BaudRate",
"Properties",
"Baud rate to use for communications", this.BaudRate));
116 m_strComPort = oXml.GetChildString(
"ComPort", m_strComPort);
117 m_iBaudRate = oXml.GetChildInt(
"BaudRate", m_iBaudRate);
128 oXml.AddChildElement(
"ComPort", m_strComPort);
129 oXml.AddChildElement(
"BaudRate", m_iBaudRate);
136 base.SaveSimulationXml(oXml, ref nmParentControl, strName);
140 oXml.AddChildElement(
"ComPort", m_strComPort);
141 oXml.AddChildElement(
"BaudRate", m_iBaudRate);