Skip to content

Commit

Permalink
Support for serial gps devices on mono. (DotSpatial#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjm00 authored and jany-tenaj committed Jul 19, 2017
1 parent aa015fc commit 8ff414c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,5 @@ Be aware that code written for 1.9 will not work out of the box because DotSpati
- Legend drag line so it doesn't look as if you can move a layer in between categories (#1008)
- Legend selection to be able to select features of a category (#1008)
- Some errors in SetSelectable plugin (#1008)
- Crash when attempting to use a serial GPS device on Mono
- Clear the selection inside FeatureLayer.RemoveSelectedFeatures so the removed features are no longer contained when IFeatureSet.FeatureRemoved is raised
3 changes: 2 additions & 1 deletion Contributors
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ Tomaso Tonelli <[email protected]>
Teva Veluppillai
Peder Wikstrom <[email protected]>
Chris Wilson
Ping Yang
Ping Yang
Trent Muhr
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ internal class SerialPort
#endif

private StreamReader _Reader;
private bool onMono = Type.GetType("Mono.Runtime") != null;

#region Constructors

Expand Down Expand Up @@ -59,7 +60,8 @@ public SerialPort(string portName, int baudRate, Parity parity, int dataBits, St
NewLine = "\r\n";
WriteBufferSize = NmeaReader.IdealNmeaBufferSize;
ReadBufferSize = NmeaReader.IdealNmeaBufferSize;
ReceivedBytesThreshold = 65535; // We don't need this event, so max out the threshold
if (!onMono) // ReceivedBytesThreshold is not implemented on mono, thus throwing an exception.
ReceivedBytesThreshold = 65535; // We don't need this event, so max out the threshold
Encoding = Encoding.ASCII;
}
#endif
Expand Down
4 changes: 3 additions & 1 deletion Source/DotSpatial.Positioning/SerialPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ internal class SerialPort
///
/// </summary>
private StreamReader _reader;
private bool onMono = Type.GetType("Mono.Runtime") != null;

#region Constructors

Expand Down Expand Up @@ -97,7 +98,8 @@ public SerialPort(string portName, int baudRate, Parity parity, int dataBits, St
NewLine = "\r\n";
WriteBufferSize = NmeaReader.IDEAL_NMEA_BUFFER_SIZE;
ReadBufferSize = NmeaReader.IDEAL_NMEA_BUFFER_SIZE;
ReceivedBytesThreshold = 65535; // We don't need this event, so max out the threshold
if (!onMono) // ReceivedBytesThreshold is not implemented on mono, thus throwing an exception.
ReceivedBytesThreshold = 65535; // We don't need this event, so max out the threshold
Encoding = Encoding.ASCII;
}

Expand Down

0 comments on commit 8ff414c

Please sign in to comment.