Dreamine.IO.Fastech.Ethernet 1.0.1
Dreamine.IO.Fastech.Ethernet 산업 자동화 및 I/O 기능을 제공합니다.
로딩중...
검색중...
일치하는것 없음
Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController 클래스 참조sealed

더 자세히 ...

Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController에 대한 상속 다이어그램 :
Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController에 대한 협력 다이어그램:

Public 멤버 함수

 FastechEthernetIoController (FastechEthernetIoOptions options)
 FastechEthernetIoController (FastechEthernetIoOptions options, IFastechEthernetIoProtocol protocol)
 FastechEthernetIoController (FastechEthernetIoOptions options, IFastechEthernetIoTransport transport, IFastechEthernetIoProtocol protocol)
async Task< IoResult > ConnectAsync (CancellationToken cancellationToken=default)
async Task< IoResult > DisconnectAsync (CancellationToken cancellationToken=default)
async ValueTask DisposeAsync ()

속성

FastechEthernetIoOptions Options [get]
IoConnectionState State = IoConnectionState.Disconnected [get, private set]
IDigitalInputChannel DigitalInputs [get]
IDigitalOutputChannel DigitalOutputs [get]
IAnalogInputChannel AnalogInputs [get]
IAnalogOutputChannel AnalogOutputs [get]

이벤트

EventHandler< IoConnectionState >? StateChanged

Private 멤버 함수

async Task< IoResult< TValue[]> > SendReadAsync< TPoint, TValue > (IReadOnlyList< TPoint > points, Func< IReadOnlyList< TPoint >, byte[]> buildRequest, Func< IReadOnlyList< byte >, IoResult< TValue[]> > parseResponse, CancellationToken cancellationToken)
async Task< IoResult > SendWriteAsync< TKey, TValue > (IReadOnlyDictionary< TKey, TValue > values, Func< IReadOnlyDictionary< TKey, TValue >, byte[]> buildRequest, Func< IReadOnlyList< byte >, IoResult > parseResponse, CancellationToken cancellationToken)
async Task< IoResult< byte[]> > SendAsync (byte[] request, CancellationToken cancellationToken)
void SetState (IoConnectionState state)
void ThrowIfDisposed ()

정적 Private 멤버 함수

static IFastechEthernetIoTransport CreateTransport (FastechEthernetIoOptions options)

Private 속성

readonly FastechEthernetIoOptions _options
readonly IFastechEthernetIoTransport _transport
readonly IFastechEthernetIoProtocol _protocol
bool _disposed

상세한 설명

전송과 장치 프로토콜을 조합하여 Fastech Ethernet I/O 채널을 제공하는 컨트롤러입니다.

FastechEthernetIoController.cs 파일의 21 번째 라인에서 정의되었습니다.

생성자 & 소멸자 문서화

◆ FastechEthernetIoController() [1/3]

Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.FastechEthernetIoController ( FastechEthernetIoOptions options)
inline

옵션에 맞는 기본 전송과 검증된 16점 DIO 프로토콜로 컨트롤러를 초기화합니다.

매개변수
optionsFastech 연결 옵션입니다.
예외
ArgumentNullExceptionoptionsnull인 경우 발생합니다.
ArgumentOutOfRangeException전송 형식이 지원되지 않는 경우 발생합니다.

FastechEthernetIoController.cs 파일의 92 번째 라인에서 정의되었습니다.

93 : this(
94 options,
95 CreateTransport(options),
96 new FastechPlusE16PointProtocol())
97 {
98 }

다음을 참조함 : CreateTransport().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ FastechEthernetIoController() [2/3]

Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.FastechEthernetIoController ( FastechEthernetIoOptions options,
IFastechEthernetIoProtocol protocol )
inline

옵션에 맞는 기본 전송과 지정한 프로토콜로 컨트롤러를 초기화합니다.

매개변수
optionsFastech 연결 옵션입니다.
protocol장치 프로토콜 구현입니다.
예외
ArgumentNullException인수 중 하나가 null인 경우 발생합니다.
ArgumentOutOfRangeException전송 형식이 지원되지 않는 경우 발생합니다.

FastechEthernetIoController.cs 파일의 140 번째 라인에서 정의되었습니다.

143 : this(options, CreateTransport(options), protocol)
144 {
145 }

다음을 참조함 : CreateTransport().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ FastechEthernetIoController() [3/3]

Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.FastechEthernetIoController ( FastechEthernetIoOptions options,
IFastechEthernetIoTransport transport,
IFastechEthernetIoProtocol protocol )
inline

지정한 옵션, 전송 및 프로토콜로 컨트롤러와 네 채널을 초기화합니다.

매개변수
optionsFastech 연결 옵션입니다.
transport요청/응답 전송입니다.
protocol장치 프로토콜 구현입니다.
예외
ArgumentNullException인수 중 하나가 null인 경우 발생합니다.

FastechEthernetIoController.cs 파일의 187 번째 라인에서 정의되었습니다.

191 {
192 _options = options ?? throw new ArgumentNullException(nameof(options));
193 _transport = transport ?? throw new ArgumentNullException(nameof(transport));
194 _protocol = protocol ?? throw new ArgumentNullException(nameof(protocol));
195
196 DigitalInputs = new FastechDigitalInputChannel(this);
197 DigitalOutputs = new FastechDigitalOutputChannel(this);
198 AnalogInputs = new FastechAnalogInputChannel(this);
199 AnalogOutputs = new FastechAnalogOutputChannel(this);
200 }

다음을 참조함 : _options, _protocol, _transport, AnalogInputs, AnalogOutputs, DigitalInputs, DigitalOutputs.

멤버 함수 문서화

◆ ConnectAsync()

async Task< IoResult > Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.ConnectAsync ( CancellationToken cancellationToken = default)
inline

전송을 연결하고 상태를 Connecting에서 Connected 또는 Faulted로 전환합니다.

매개변수
cancellationToken연결 취소 토큰입니다.
반환값
전송 연결 결과입니다.
예외
ObjectDisposedException컨트롤러가 해제된 경우 발생합니다.

FastechEthernetIoController.cs 파일의 304 번째 라인에서 정의되었습니다.

305 {
306 ThrowIfDisposed();
307 SetState(IoConnectionState.Connecting);
308
309 var result = await _transport.ConnectAsync(cancellationToken).ConfigureAwait(false);
310 SetState(result.IsSuccess ? IoConnectionState.Connected : IoConnectionState.Faulted);
311
312 return result;
313 }

다음을 참조함 : _transport, SetState(), ThrowIfDisposed().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ CreateTransport()

IFastechEthernetIoTransport Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.CreateTransport ( FastechEthernetIoOptions options)
inlinestaticprivate

옵션의 전송 형식에 맞는 UDP 또는 TCP 전송을 만듭니다.

매개변수
options전송 구성 옵션입니다.
반환값
새 전송 구현입니다.
예외
ArgumentNullExceptionoptionsnull인 경우 발생합니다.
ArgumentOutOfRangeException전송 형식이 지원되지 않는 경우 발생합니다.

FastechEthernetIoController.cs 파일의 1025 번째 라인에서 정의되었습니다.

1026 {
1027 ArgumentNullException.ThrowIfNull(options);
1028
1029 return options.TransportType switch
1030 {
1031 FastechEthernetIoTransportType.Udp => new UdpFastechEthernetIoTransport(options),
1032 FastechEthernetIoTransportType.Tcp => new TcpFastechEthernetIoTransport(options),
1033 _ => throw new ArgumentOutOfRangeException(nameof(options), options.TransportType, "Unsupported Fastech Ethernet I/O transport type.")
1034 };
1035 }

다음을 참조함 : Dreamine.IO.Fastech.Ethernet.Options.Tcp, Dreamine.IO.Fastech.Ethernet.Options.FastechEthernetIoOptions.TransportType, Dreamine.IO.Fastech.Ethernet.Options.Udp.

다음에 의해서 참조됨 : FastechEthernetIoController(), FastechEthernetIoController().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ DisconnectAsync()

async Task< IoResult > Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.DisconnectAsync ( CancellationToken cancellationToken = default)
inline

전송 연결을 해제하고 상태를 Disconnecting에서 Disconnected 또는 Faulted로 전환합니다.

매개변수
cancellationToken연결 해제 취소 토큰입니다.
반환값
전송 연결 해제 결과입니다.
예외
ObjectDisposedException컨트롤러가 해제된 경우 발생합니다.

FastechEthernetIoController.cs 파일의 347 번째 라인에서 정의되었습니다.

348 {
349 ThrowIfDisposed();
350 SetState(IoConnectionState.Disconnecting);
351
352 var result = await _transport.DisconnectAsync(cancellationToken).ConfigureAwait(false);
353 SetState(result.IsSuccess ? IoConnectionState.Disconnected : IoConnectionState.Faulted);
354
355 return result;
356 }

다음을 참조함 : _transport, SetState(), ThrowIfDisposed().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DisposeAsync()

async ValueTask Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.DisposeAsync ( )
inline

전송을 비동기 해제하고 컨트롤러를 Disconnected 상태로 전환합니다.

반환값
비동기 해제 작업입니다.

FastechEthernetIoController.cs 파일의 632 번째 라인에서 정의되었습니다.

633 {
634 if (_disposed)
635 {
636 return;
637 }
638
639 await _transport.DisposeAsync().ConfigureAwait(false);
640 _disposed = true;
641 SetState(IoConnectionState.Disconnected);
642
643 GC.SuppressFinalize(this);
644 }

다음을 참조함 : _disposed, _transport, SetState().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ SendAsync()

async Task< IoResult< byte[]> > Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.SendAsync ( byte[] request,
CancellationToken cancellationToken )
inlineprivate

연결 상태를 확인하고 구성된 횟수만큼 요청/응답 교환을 재시도합니다.

매개변수
request전송할 요청 프레임입니다.
cancellationToken교환 취소 토큰입니다.
반환값
첫 성공 응답 또는 마지막 실패 결과입니다.
예외
ObjectDisposedException컨트롤러가 해제된 경우 발생합니다.

FastechEthernetIoController.cs 파일의 909 번째 라인에서 정의되었습니다.

910 {
911 ThrowIfDisposed();
912
913 if (State != IoConnectionState.Connected || !_transport.IsConnected)
914 {
915 return IoResult<byte[]>.Failure("The Fastech Ethernet I/O controller is not connected.");
916 }
917
918 IoResult<byte[]>? lastResult = null;
919
920 for (var attempt = 0; attempt <= _options.RetryCount; attempt++)
921 {
922 lastResult = await _transport.SendAndReceiveAsync(
923 request,
924 _options.ReceiveTimeoutMs,
925 _options.ExpectedResponseLength,
926 cancellationToken).ConfigureAwait(false);
927
928 if (lastResult.IsSuccess)
929 {
930 return lastResult;
931 }
932 }
933
934 return lastResult ?? IoResult<byte[]>.Failure("The Fastech Ethernet I/O request was not sent.");
935 }

다음을 참조함 : _options, _transport, State, ThrowIfDisposed().

다음에 의해서 참조됨 : SendReadAsync< TPoint, TValue >(), SendWriteAsync< TKey, TValue >().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ SendReadAsync< TPoint, TValue >()

async Task< IoResult< TValue[]> > Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.SendReadAsync< TPoint, TValue > ( IReadOnlyList< TPoint > points,
Func< IReadOnlyList< TPoint >, byte[]> buildRequest,
Func< IReadOnlyList< byte >, IoResult< TValue[]> > parseResponse,
CancellationToken cancellationToken )
inlineprivate

읽기 요청 생성·전송·파싱 단계의 예외를 I/O 실패 결과로 변환합니다.

템플릿 파라메터
TPointI/O 지점 형식입니다.
TValue파싱할 값 형식입니다.
매개변수
points요청할 지점입니다.
buildRequest요청 프레임 생성기입니다.
parseResponse응답 파서입니다.
cancellationToken요청 취소 토큰입니다.
반환값
파싱된 값 배열 또는 실패 결과입니다.
예외
ArgumentNullExceptionpointsnull인 경우 발생합니다.

FastechEthernetIoController.cs 파일의 718 번째 라인에서 정의되었습니다.

723 {
724 ArgumentNullException.ThrowIfNull(points);
725
726 if (points.Count == 0)
727 {
728 return IoResult<TValue[]>.Failure("At least one I/O point is required.");
729 }
730
731 byte[] request;
732 try
733 {
734 request = buildRequest(points);
735 }
736 catch (Exception ex)
737 {
738 return IoResult<TValue[]>.Failure(ex.Message);
739 }
740
741 var response = await SendAsync(request, cancellationToken).ConfigureAwait(false);
742 if (!response.IsSuccess || response.Value is null)
743 {
744 return IoResult<TValue[]>.Failure(response.Message ?? "Failed to receive the Fastech Ethernet I/O response.", response.ErrorCode);
745 }
746
747 try
748 {
749 return parseResponse(response.Value);
750 }
751 catch (Exception ex)
752 {
753 return IoResult<TValue[]>.Failure(ex.Message);
754 }
755 }

다음을 참조함 : SendAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ SendWriteAsync< TKey, TValue >()

async Task< IoResult > Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.SendWriteAsync< TKey, TValue > ( IReadOnlyDictionary< TKey, TValue > values,
Func< IReadOnlyDictionary< TKey, TValue >, byte[]> buildRequest,
Func< IReadOnlyList< byte >, IoResult > parseResponse,
CancellationToken cancellationToken )
inlineprivate

쓰기 요청 생성·전송·파싱 단계의 예외를 I/O 실패 결과로 변환합니다.

템플릿 파라메터
TKey출력 키 형식입니다.
TValue출력 값 형식입니다.
매개변수
values쓸 키별 값입니다.
buildRequest요청 프레임 생성기입니다.
parseResponse쓰기 응답 파서입니다.
cancellationToken요청 취소 토큰입니다.
반환값
쓰기 성공 또는 실패 결과입니다.
예외
ArgumentNullExceptionvaluesnull인 경우 발생합니다.
타입 한정자들
TKey :notnull 

FastechEthernetIoController.cs 파일의 829 번째 라인에서 정의되었습니다.

834 : notnull
835 {
836 ArgumentNullException.ThrowIfNull(values);
837
838 if (values.Count == 0)
839 {
840 return IoResult.Failure("At least one I/O value is required.");
841 }
842
843 byte[] request;
844 try
845 {
846 request = buildRequest(values);
847 }
848 catch (Exception ex)
849 {
850 return IoResult.Failure(ex.Message);
851 }
852
853 var response = await SendAsync(request, cancellationToken).ConfigureAwait(false);
854 if (!response.IsSuccess || response.Value is null)
855 {
856 return IoResult.Failure(response.Message ?? "Failed to receive the Fastech Ethernet I/O response.", response.ErrorCode);
857 }
858
859 try
860 {
861 return parseResponse(response.Value);
862 }
863 catch (Exception ex)
864 {
865 return IoResult.Failure(ex.Message);
866 }
867 }

다음을 참조함 : SendAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ SetState()

void Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.SetState ( IoConnectionState state)
inlineprivate

연결 상태가 달라진 경우 갱신하고 상태 변경 이벤트를 발생시킵니다.

매개변수
state새 연결 상태입니다.

FastechEthernetIoController.cs 파일의 953 번째 라인에서 정의되었습니다.

954 {
955 if (State == state)
956 {
957 return;
958 }
959
960 State = state;
961 StateChanged?.Invoke(this, state);
962 }

다음을 참조함 : State, StateChanged.

다음에 의해서 참조됨 : ConnectAsync(), DisconnectAsync(), DisposeAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ThrowIfDisposed()

void Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.ThrowIfDisposed ( )
inlineprivate

컨트롤러가 이미 해제되었으면 예외를 발생시킵니다.

예외
ObjectDisposedException컨트롤러가 해제된 경우 발생합니다.

FastechEthernetIoController.cs 파일의 980 번째 라인에서 정의되었습니다.

981 {
982 ObjectDisposedException.ThrowIf(_disposed, this);
983 }

다음을 참조함 : _disposed.

다음에 의해서 참조됨 : ConnectAsync(), DisconnectAsync(), SendAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ _disposed

bool Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController._disposed
private

disposed 값을 보관합니다.

FastechEthernetIoController.cs 파일의 58 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : DisposeAsync(), ThrowIfDisposed().

◆ _options

readonly FastechEthernetIoOptions Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController._options
private

options 값을 보관합니다.

FastechEthernetIoController.cs 파일의 31 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : FastechEthernetIoController(), SendAsync().

◆ _protocol

readonly IFastechEthernetIoProtocol Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController._protocol
private

protocol 값을 보관합니다.

FastechEthernetIoController.cs 파일의 49 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : FastechEthernetIoController().

◆ _transport

readonly IFastechEthernetIoTransport Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController._transport
private

transport 값을 보관합니다.

FastechEthernetIoController.cs 파일의 40 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : ConnectAsync(), DisconnectAsync(), DisposeAsync(), FastechEthernetIoController(), SendAsync().

속성 문서화

◆ AnalogInputs

IAnalogInputChannel Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.AnalogInputs
get

아날로그 입력 채널을 가져옵니다.

FastechEthernetIoController.cs 파일의 260 번째 라인에서 정의되었습니다.

260{ get; }

다음에 의해서 참조됨 : FastechEthernetIoController().

◆ AnalogOutputs

IAnalogOutputChannel Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.AnalogOutputs
get

아날로그 출력 채널을 가져옵니다.

FastechEthernetIoController.cs 파일의 270 번째 라인에서 정의되었습니다.

270{ get; }

다음에 의해서 참조됨 : FastechEthernetIoController().

◆ DigitalInputs

IDigitalInputChannel Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.DigitalInputs
get

디지털 입력 채널을 가져옵니다.

FastechEthernetIoController.cs 파일의 240 번째 라인에서 정의되었습니다.

240{ get; }

다음에 의해서 참조됨 : FastechEthernetIoController().

◆ DigitalOutputs

IDigitalOutputChannel Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.DigitalOutputs
get

디지털 출력 채널을 가져옵니다.

FastechEthernetIoController.cs 파일의 250 번째 라인에서 정의되었습니다.

250{ get; }

다음에 의해서 참조됨 : FastechEthernetIoController().

◆ Options

FastechEthernetIoOptions Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.Options
get

현재 Fastech Ethernet I/O 옵션을 가져옵니다.

FastechEthernetIoController.cs 파일의 210 번째 라인에서 정의되었습니다.

◆ State

IoConnectionState Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.State = IoConnectionState.Disconnected
getprivate set

현재 연결 상태를 가져옵니다.

FastechEthernetIoController.cs 파일의 220 번째 라인에서 정의되었습니다.

220{ get; private set; } = IoConnectionState.Disconnected;

다음에 의해서 참조됨 : SendAsync(), SetState().

이벤트 문서화

◆ StateChanged

EventHandler<IoConnectionState>? Dreamine.IO.Fastech.Ethernet.Controllers.FastechEthernetIoController.StateChanged

연결 상태가 변경될 때 발생합니다.

FastechEthernetIoController.cs 파일의 230 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : SetState().


이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: