Skip to content

Commit

Permalink
Added overloaded Output method for SerialHandler. Added functionality…
Browse files Browse the repository at this point in the history
… for changing motor speed from swl
  • Loading branch information
thmundal committed Mar 4, 2019
1 parent 9df44c7 commit 11f4b16
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 32 deletions.
38 changes: 37 additions & 1 deletion SatStat/Source/SatStatMainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions SatStat/Source/SatStatMainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,5 +232,19 @@ private void UIAutoRotateOffBtn_Click(object sender, EventArgs e)
{
Program.serial.Output(new JObject() { { "request", "auto_rotate" }, { "parameters", new JArray() { false } } });
}

private void UIsetMotorSpeedBtn_Click(object sender, EventArgs e)
{
string motorSpeedInputText = UImotorSpeedInput.Text;

if(Int32.TryParse(motorSpeedInputText, out int motorSpeed))
{
Program.serial.Output(new JObject() { { "request", "set_motor_speed" }, { "parameters", new JArray() { motorSpeed } } });
}
else
{
Debug.Log("Invalid input, must provide an integer");
}
}
}
}
10 changes: 2 additions & 8 deletions SatStat/Source/SatStatMainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,14 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="Key.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Value.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Key.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Value.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>45</value>
Expand Down
7 changes: 7 additions & 0 deletions SatStat/Source/SerialHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,17 @@ public void WriteData(string data)
if(connectionStatus != ConnectionStatus.Disconnected)
{
Debug.Log("writing data...");
Debug.Log(data);
connection.WriteLine(data);
}
}

public new void Output(object data)
{
string data_serialized = JSON.serialize(data);
WriteData(data_serialized);
}

/// <summary>
/// Disconnect the serial port
/// </summary>
Expand Down
37 changes: 33 additions & 4 deletions SatStat/_site/api/SatStat.SerialHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ <h5>Inherited Members</h5>
<div>
<a class="xref" href="SatStat.DataStream.html#SatStat_DataStream_AddSubscriber_SatStat_DataSubscription_">DataStream.AddSubscriber(DataSubscription)</a>
</div>
<div>
<a class="xref" href="SatStat.DataStream.html#SatStat_DataStream_Output_System_Object_">DataStream.Output(Object)</a>
</div>
<div>
<a class="xref" href="SatStat.DataStream.html#SatStat_DataStream_OnOutputReceived_System_Action_System_String__">DataStream.OnOutputReceived(Action&lt;String&gt;)</a>
</div>
Expand Down Expand Up @@ -296,7 +293,7 @@ <h5 class="parameters">Parameters</h5>
<a href="https://github.com/thmundal/SatStat/new/Alpha2/apiSpec/new?filename=SatStat_SerialHandler_Disconnect.md&amp;value=---%0Auid%3A%20SatStat.SerialHandler.Disconnect%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L274">View Source</a>
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L281">View Source</a>
</span>
<a id="SatStat_SerialHandler_Disconnect_" data-uid="SatStat.SerialHandler.Disconnect*"></a>
<h4 id="SatStat_SerialHandler_Disconnect" data-uid="SatStat.SerialHandler.Disconnect">Disconnect()</h4>
Expand Down Expand Up @@ -405,6 +402,38 @@ <h5 class="parameters">Parameters</h5>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/thmundal/SatStat/new/Alpha2/apiSpec/new?filename=SatStat_SerialHandler_Output_System_Object_.md&amp;value=---%0Auid%3A%20SatStat.SerialHandler.Output(System.Object)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L272">View Source</a>
</span>
<a id="SatStat_SerialHandler_Output_" data-uid="SatStat.SerialHandler.Output*"></a>
<h4 id="SatStat_SerialHandler_Output_System_Object_" data-uid="SatStat.SerialHandler.Output(System.Object)">Output(Object)</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void Output(object data)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Object</span></td>
<td><span class="parametername">data</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/thmundal/SatStat/new/Alpha2/apiSpec/new?filename=SatStat_SerialHandler_SetComPort_System_String_.md&amp;value=---%0Auid%3A%20SatStat.SerialHandler.SetComPort(System.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
Expand Down
8 changes: 4 additions & 4 deletions SatStat/_site/api/SatStat.SerialSettingsCollection.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ <h3 id="fields">Fields
<a href="https://github.com/thmundal/SatStat/new/Alpha2/apiSpec/new?filename=SatStat_SerialSettingsCollection_baud_rates.md&amp;value=---%0Auid%3A%20SatStat.SerialSettingsCollection.baud_rates%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L293">View Source</a>
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L300">View Source</a>
</span>
<h4 id="SatStat_SerialSettingsCollection_baud_rates" data-uid="SatStat.SerialSettingsCollection.baud_rates">baud_rates</h4>
<div class="markdown level1 summary"></div>
Expand Down Expand Up @@ -139,7 +139,7 @@ <h5 class="fieldValue">Field Value</h5>
<a href="https://github.com/thmundal/SatStat/new/Alpha2/apiSpec/new?filename=SatStat_SerialSettingsCollection_configs.md&amp;value=---%0Auid%3A%20SatStat.SerialSettingsCollection.configs%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L294">View Source</a>
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L301">View Source</a>
</span>
<h4 id="SatStat_SerialSettingsCollection_configs" data-uid="SatStat.SerialSettingsCollection.configs">configs</h4>
<div class="markdown level1 summary"></div>
Expand Down Expand Up @@ -168,7 +168,7 @@ <h5 class="fieldValue">Field Value</h5>
<a href="https://github.com/thmundal/SatStat/new/Alpha2/apiSpec/new?filename=SatStat_SerialSettingsCollection_newlines.md&amp;value=---%0Auid%3A%20SatStat.SerialSettingsCollection.newlines%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L295">View Source</a>
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L302">View Source</a>
</span>
<h4 id="SatStat_SerialSettingsCollection_newlines" data-uid="SatStat.SerialSettingsCollection.newlines">newlines</h4>
<div class="markdown level1 summary"></div>
Expand Down Expand Up @@ -203,7 +203,7 @@ <h5 class="fieldValue">Field Value</h5>
<a href="https://github.com/thmundal/SatStat/new/Alpha2/apiSpec/new?filename=SatStat_SerialSettingsCollection.md&amp;value=---%0Auid%3A%20SatStat.SerialSettingsCollection%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
</li>
<li>
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L291" class="contribution-link">View Source</a>
<a href="https://github.com/thmundal/SatStat/blob/Alpha2/SatStat/Source/SerialHandler.cs/#L298" class="contribution-link">View Source</a>
</li>
</ul>
</div>
Expand Down
30 changes: 15 additions & 15 deletions SatStat/_site/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"hash": "AkqqsTgaoucGZt2H+5LTwg=="
}
},
"is_incremental": true,
"is_incremental": false,
"version": ""
},
{
Expand Down Expand Up @@ -165,10 +165,10 @@
"output": {
".html": {
"relative_path": "api/SatStat.SerialHandler.html",
"hash": "P4bwM2Vh9XU4u+nMqU50FA=="
"hash": "1VLCveaUhubV7nmRC/yZzg=="
}
},
"is_incremental": true,
"is_incremental": false,
"version": ""
},
{
Expand All @@ -177,10 +177,10 @@
"output": {
".html": {
"relative_path": "api/SatStat.SerialSettingsCollection.html",
"hash": "pLJvYDS27d7ACt8TpD9iBQ=="
"hash": "cwFNge+KYrHYreK6KSdcnA=="
}
},
"is_incremental": true,
"is_incremental": false,
"version": ""
},
{
Expand All @@ -192,7 +192,7 @@
"hash": "PCggEP8pK9CNia+Huqv0zg=="
}
},
"is_incremental": true,
"is_incremental": false,
"version": ""
},
{
Expand All @@ -216,7 +216,7 @@
"hash": "EwCFRqJ+7oP3Ub0IGifsYw=="
}
},
"is_incremental": true,
"is_incremental": false,
"version": ""
},
{
Expand All @@ -228,7 +228,7 @@
"hash": "pFCQIN0gCz1nVJVUQW+hog=="
}
},
"is_incremental": true,
"is_incremental": false,
"version": ""
},
{
Expand All @@ -240,7 +240,7 @@
"hash": "Bwpi3fcSxDomOS3uaLnTQg=="
}
},
"is_incremental": true,
"is_incremental": false,
"version": ""
},
{
Expand Down Expand Up @@ -284,17 +284,17 @@
"total_file_count": 0,
"skipped_file_count": 0
},
"ManagedReferenceDocumentProcessor": {
"can_incremental": true,
"incrementalPhase": "build",
"total_file_count": 16,
"skipped_file_count": 16
},
"ConceptualDocumentProcessor": {
"can_incremental": true,
"incrementalPhase": "build",
"total_file_count": 3,
"skipped_file_count": 3
},
"ManagedReferenceDocumentProcessor": {
"can_incremental": true,
"incrementalPhase": "build",
"total_file_count": 16,
"skipped_file_count": 14
}
}
},
Expand Down
13 changes: 13 additions & 0 deletions SatStat/_site/xrefmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,19 @@ references:
isSpec: "True"
fullName: SatStat.SerialHandler.OnHandshakeResponse
nameWithType: SerialHandler.OnHandshakeResponse
- uid: SatStat.SerialHandler.Output(System.Object)
name: Output(Object)
href: api/SatStat.SerialHandler.html#SatStat_SerialHandler_Output_System_Object_
commentId: M:SatStat.SerialHandler.Output(System.Object)
fullName: SatStat.SerialHandler.Output(System.Object)
nameWithType: SerialHandler.Output(Object)
- uid: SatStat.SerialHandler.Output*
name: Output
href: api/SatStat.SerialHandler.html#SatStat_SerialHandler_Output_
commentId: Overload:SatStat.SerialHandler.Output
isSpec: "True"
fullName: SatStat.SerialHandler.Output
nameWithType: SerialHandler.Output
- uid: SatStat.SerialHandler.SetComPort(System.String)
name: SetComPort(String)
href: api/SatStat.SerialHandler.html#SatStat_SerialHandler_SetComPort_System_String_
Expand Down

0 comments on commit 11f4b16

Please sign in to comment.