This repository has been archived by the owner on Sep 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add features: add new SendASdu function to client SAP, add NewASdu ev…
…ent property to server SAP
- Loading branch information
Showing
10 changed files
with
119 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 31 additions & 31 deletions
62
IEC60870/Util/CountDownLatch.cs → IEC60870/Utils/CountDownLatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
using System.Threading; | ||
|
||
namespace IEC60870.Util | ||
{ | ||
public class CountDownLatch | ||
{ | ||
private readonly EventWaitHandle _event; | ||
private int _remain; | ||
|
||
public CountDownLatch(int count) | ||
{ | ||
_remain = count; | ||
_event = new ManualResetEvent(false); | ||
} | ||
|
||
public void CountDown() | ||
{ | ||
if (Interlocked.Decrement(ref _remain) == 0) | ||
_event.Set(); | ||
} | ||
|
||
public void Wait(int timeout) | ||
{ | ||
_event.WaitOne(timeout); | ||
} | ||
|
||
public void Wait() | ||
{ | ||
_event.WaitOne(); | ||
} | ||
} | ||
using System.Threading; | ||
|
||
namespace IEC60870.Utils | ||
{ | ||
public class CountDownLatch | ||
{ | ||
private readonly EventWaitHandle _event; | ||
private int _remain; | ||
|
||
public CountDownLatch(int count) | ||
{ | ||
_remain = count; | ||
_event = new ManualResetEvent(false); | ||
} | ||
|
||
public void CountDown() | ||
{ | ||
if (Interlocked.Decrement(ref _remain) == 0) | ||
_event.Set(); | ||
} | ||
|
||
public void Wait(int timeout) | ||
{ | ||
_event.WaitOne(timeout); | ||
} | ||
|
||
public void Wait() | ||
{ | ||
_event.WaitOne(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
IEC60870/Util/PubSubExtensions.cs → IEC60870/Utils/PubSubExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
using System; | ||
|
||
namespace IEC60870.Util | ||
namespace IEC60870.Utils | ||
{ | ||
static public class PubSubExtensions | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 35 additions & 35 deletions
70
IEC60870/Util/ThreadBase.cs → IEC60870/Utils/ThreadBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
using System.Threading; | ||
|
||
namespace IEC60870.Util | ||
{ | ||
public abstract class ThreadBase | ||
{ | ||
private readonly Thread thread; | ||
|
||
protected ThreadBase() | ||
{ | ||
thread = new Thread(Run); | ||
} | ||
|
||
public bool IsAlive | ||
{ | ||
get { return thread.IsAlive; } | ||
} | ||
|
||
public void Start() | ||
{ | ||
thread.Start(); | ||
} | ||
|
||
public void Join() | ||
{ | ||
thread.Join(); | ||
} | ||
|
||
public void Abort() | ||
{ | ||
thread.Abort(); | ||
} | ||
|
||
public abstract void Run(); | ||
} | ||
using System.Threading; | ||
|
||
namespace IEC60870.Utils | ||
{ | ||
public abstract class ThreadBase | ||
{ | ||
private readonly Thread thread; | ||
|
||
protected ThreadBase() | ||
{ | ||
thread = new Thread(Run); | ||
} | ||
|
||
public bool IsAlive | ||
{ | ||
get { return thread.IsAlive; } | ||
} | ||
|
||
public void Start() | ||
{ | ||
thread.Start(); | ||
} | ||
|
||
public void Join() | ||
{ | ||
thread.Join(); | ||
} | ||
|
||
public void Abort() | ||
{ | ||
thread.Abort(); | ||
} | ||
|
||
public abstract void Run(); | ||
} | ||
} |
Oops, something went wrong.