Skip to content

Commit

Permalink
CommsStream: create stream
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Dec 15, 2017
1 parent a82679c commit 41e634b
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 119 deletions.
58 changes: 58 additions & 0 deletions ExtLibs/Comms/CommsStream.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Ports;
using System.Text;

namespace MissionPlanner.Comms
{
public class CommsStream : Stream
{
public ICommsSerial CommsSerial { get; set; }

long _len = 0;

public CommsStream(ICommsSerial comm, long len)
{
CommsSerial = comm;
SetLength(len);
}

public override void Flush()
{
}

public override int Read(byte[] buffer, int offset, int count)
{
var read = CommsSerial.Read(buffer, offset, count);
Position += read;
return read;
}

public override long Seek(long offset, SeekOrigin origin)
{
return Position;
}

public override void SetLength(long value)
{
_len = value;
}

public override void Write(byte[] buffer, int offset, int count)
{
CommsSerial.Write(buffer,offset,count);
}

public override bool CanRead { get; } = true;
public override bool CanSeek { get; } = false;
public override bool CanWrite { get; } = true;

public override long Length
{
get { return _len; }
}

public override long Position { get; set; }
}
}
119 changes: 0 additions & 119 deletions MAVLink.xml

This file was deleted.

27 changes: 27 additions & 0 deletions MissionPlanner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,9 @@
<Compile Include="Wizard\Wizard.Designer.cs"><DependentUpon>Wizard.cs</DependentUpon> </Compile>
</ItemGroup>
<ItemGroup>
<Content Include="acsimplepids.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="aircraft.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand All @@ -669,6 +672,9 @@
<Content Include="camerasBuiltin.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="ChangeLog.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="checklistDefault.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand All @@ -693,6 +699,15 @@
<Content Include="mavgraphs.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="mpdesktop.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="mpdesktop150.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="mpdesktop44.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="ParameterFactMetaData.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -1718,10 +1733,22 @@
<EmbeddedResource Include="Wizard\Wizard.zh-TW.resx"><DependentUpon>Wizard.cs</DependentUpon> </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="adb.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="AdbWinApi.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="airports.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="aot.sh">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="app.config" />
<None Include="block_plane_0.dae">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DLLs\fftpack_lite.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Binary file removed compile1.jpg
Binary file not shown.

0 comments on commit 41e634b

Please sign in to comment.