Skip to content

Commit e5b9354

Browse files
committed
v1.1.0 release
1 parent eb2e951 commit e5b9354

6 files changed

Lines changed: 202 additions & 122 deletions

File tree

GodSharp.SerialPort.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2222
README.md = README.md
2323
EndProjectSection
2424
EndProject
25+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuspec", "nuspec", "{7518D83B-3290-4EB6-89BA-BC1A165A729F}"
26+
ProjectSection(SolutionItems) = preProject
27+
src\GodSharp.SerialPort\GodSharp.SerialPort.nuspec = src\GodSharp.SerialPort\GodSharp.SerialPort.nuspec
28+
EndProjectSection
29+
EndProject
2530
Global
2631
GlobalSection(SharedMSBuildProjectFiles) = preSolution
2732
src\GodSharp.Shared\GodSharp.Shared.projitems*{42d420d1-b004-457d-99a0-913742aa3834}*SharedItemsImports = 13
@@ -52,5 +57,6 @@ Global
5257
{4006DD01-8B21-4246-A7CF-A15421738486} = {A9C28F7F-0F11-4E92-B31A-BF950A54F863}
5358
{64A904FC-399A-4D07-99F5-1B5CCD9FF17A} = {0D3F3351-97B4-4A86-B885-991892A0FAD9}
5459
{DE27FFB1-2029-4FF5-892E-6F4274460CF1} = {0D3F3351-97B4-4A86-B885-991892A0FAD9}
60+
{7518D83B-3290-4EB6-89BA-BC1A165A729F} = {A9C28F7F-0F11-4E92-B31A-BF950A54F863}
5561
EndGlobalSection
5662
EndGlobal

README.md

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# GodSharp.SerialPort
2-
Easy to use SerialPort class.
2+
An easy-to-use .NET SerialPort class.
33

44
[![AppVeyor build status](https://img.shields.io/appveyor/ci/seayxu/godsharp-serialport.svg?label=appveyor&style=flat-square)](https://ci.appveyor.com/project/seayxu/godsharp-serialport/) [![NuGet](https://img.shields.io/nuget/v/GodSharp.SerialPort.svg?label=nuget&style=flat-square)](https://www.nuget.org/packages/GodSharp.SerialPort/) [![MyGet](https://img.shields.io/myget/seay/v/GodSharp.SerialPort.svg?label=myget&style=flat-square)](https://www.myget.org/Package/Details/seay?packageType=nuget&packageId=GodSharp.SerialPort)
55

6+
7+
# Requirement
8+
.NET Framework >= 3.5
9+
610
# Getting Started
711

812
1. New instance GodSerialPort.
@@ -11,10 +15,35 @@ Easy to use SerialPort class.
1115
GodSerialPort serial = new GodSerialPort("COM1", 9600);
1216
```
1317

14-
2. Initialize the GodSerialPort instance with received data action: `Action<byte[]>`.
18+
About params:
19+
20+
- Parity value.
21+
22+
- Parity.Space:0|s|space
23+
- Parity.Mark:1|m|mark
24+
- Parity.Even:2|e|even
25+
- Parity.Odd:3|o|odd
26+
- Parity.None:4|n|none
27+
28+
- StopBits value.
29+
30+
- StopBits.None:0|n|none
31+
- StopBits.One:1|o|one
32+
- StopBits.OnePointFive:3|opf|of|f
33+
- StopBits.Two:2|t|two
1534

35+
- Handshake value.
36+
37+
- Handshake.None:0|n|none
38+
- Handshake.RequestToSend:1|r|rst
39+
- Handshake.RequestToSendXOnXOff:2|rtsxx|rsxx|rtsx|rsx|rx
40+
- Handshake.XOnXOff:3|x|xx
41+
42+
2. Use `DataReceived` event with received data action: `Action<byte[]>`.
43+
44+
**Notice**:*This is not need when you read data by read method.*
1645
```
17-
serial.Init((bytes)=>{});
46+
serial.UseDataReceived((bytes)=>{});
1847
```
1948

2049
3. Open SerialPort object.
@@ -28,31 +57,16 @@ serial.Open();
2857
```
2958
byte[] bytes = new byte[]{31,32,33,34};
3059
serial.Write(bytes);
31-
serial.WriteAsciiString("ascii string");
60+
serial.Write(bytes,offset:1,count:2);
3261
serial.WriteHexString("7E 48 53 44");
62+
serial.WriteAsciiString("ascii string");
3363
```
3464

35-
5. Parity value.
36-
37-
- Parity.Space:0|s|space
38-
- Parity.Mark:1|m|mark
39-
- Parity.Even:2|e|even
40-
- Parity.Odd:3|o|odd
41-
- Parity.None:4|n|none
42-
43-
6. StopBits value.
44-
45-
- StopBits.None:0|n|none
46-
- StopBits.One:1|o|one
47-
- StopBits.OnePointFive:3|opf|of|f
48-
- StopBits.Two:2|t|two
49-
50-
7. Handshake value.
51-
52-
- Handshake.None:0|n|none
53-
- Handshake.RequestToSend:1|r|rst
54-
- Handshake.RequestToSendXOnXOff:2|rtsxx|rsxx|rtsx|rsx|rx
55-
- Handshake.XOnXOff:3|x|xx
65+
5. Read data.
66+
```
67+
byte[] bytes = serial.Read();
68+
string stringAsciiOrHex = serial.ReadString();
69+
```
5670

5771
# Sample
5872

@@ -70,7 +84,7 @@ class Program
7084
}
7185
7286
GodSerialPort gsp = new GodSerialPort("COM"+num, 9600);
73-
gsp.Init((bytes) => {
87+
gsp.UseDataReceived((bytes) => {
7488
string buffer = string.Join(" ", bytes);
7589
Console.WriteLine("receive data:" + buffer);
7690
});
@@ -105,3 +119,16 @@ class Program
105119
}
106120
}
107121
```
122+
123+
# Notes
124+
125+
## 1.0.0
126+
- The first version release.
127+
128+
## 1.0.1
129+
- Fix ctor and comments.
130+
131+
## 1.1.0
132+
- 1.Add UseDataReceived method use to trigger DataReceived event.
133+
- 2.The read metnod can be used to end character.
134+
- 3.Add sleep time when try read data.

src/GodSharp.SerialPort/GodSharp.SerialPort.nuspec

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>GodSharp.SerialPort</id>
5-
<version>1.0.1</version>
5+
<version>1.1.0</version>
66
<title>GodSharp.SerialPort</title>
77
<authors>seayxu</authors>
88
<owners>seayxu</owners>
@@ -11,7 +11,20 @@
1111
<iconUrl>https://avatars3.githubusercontent.com/u/26563296</iconUrl>
1212
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1313
<description>An easy-to-use .NET SerialPort class.</description>
14-
<releaseNotes>An easy-to-use .NET SerialPort class.</releaseNotes>
14+
<releaseNotes>
15+
An easy-to-use .NET SerialPort class.(.NET Framework >= 3.5)
16+
17+
1.1.0
18+
- 1.Add UseDataReceived method use to trigger DataReceived event.
19+
- 2.The read metnod can be used to end character.
20+
- 3.Add sleep time when try read data.
21+
22+
1.0.1
23+
- 1.Fix ctor and comments.
24+
25+
1.0.0
26+
- 1.The first version release.
27+
</releaseNotes>
1528
<copyright>Copyright GodSharp 2017</copyright>
1629
<tags>GodSharp.SerialPort,GodSerialPort,SerialPort,GodSharp</tags>
1730
</metadata>

src/GodSharp.SerialPort/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.0.*")]
34+
[assembly: AssemblyVersion("1.1.*")]
3535
//[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)