2using System.Collections.Generic;
3using System.Security.Cryptography.X509Certificates;
5using System.Threading.Tasks;
23 private bool tls =
false;
32 return Task.FromResult(
false);
49 [Header(4,
"Port Number:", 60)]
50 [ToolTip(5,
"Port number to use when communicating with device.")]
57 set => this.port = value;
64 [Header(11,
"Encrypted (TLS)", 70)]
65 [ToolTip(12,
"Check if Transport Layer Encryption (TLS) should be used.")]
69 set => this.tls = value;
100 public async Task<TextTcpClient>
ConnectTcp(Encoding Encoding,
bool DecoupledEvents, params
ISniffer[] Sniffers)
119 LinkedList<Parameter> Result = await base.GetDisplayableParametersAsync(
Language, Caller) as LinkedList<Parameter>;
134 DateTime Now = DateTime.Now;
135 string Module = typeof(
IpHost).Namespace;
139 List<Field> Fields =
new List<Field>()
141 new QuantityField(
this, Now,
"Connect", (DateTime.Now-Now).TotalMilliseconds, 0,
"ms",
FieldType.Momentary,
FieldQoS.AutomaticReadout, Module, 13)
157 Fields.Add(
new StringField(
this, Now,
"Public Key", Cert.GetPublicKeyString(),
FieldType.Identity,
FieldQoS.AutomaticReadout, Module, 22));
167 Fields.Add(
new StringField(
this, Now,
"Expires", Cert.GetExpirationDateString(),
FieldType.Identity,
FieldQoS.AutomaticReadout, Module, 19));
179 await base.StartReadout(Request);
Helps with parsing of commong data types.
static bool TryParseRfc822(string s, out DateTimeOffset Value)
Parses a date and time value encoded according to RFC 822, §5.
Implements a binary TCP Client, by encapsulating a TcpClient. It also makes the use of TcpClient safe...
Task UpgradeToTlsAsClient(SslProtocols Protocols)
Upgrades a client connection to TLS.
bool RemoteCertificateValid
If the remote certificate is valid.
X509Certificate RemoteCertificate
Certificate used by the remote endpoint.
Task< bool > ConnectAsync(string Host, int Port)
Connects to a host using TCP.
Implements a text-based TCP Client, by using the thread-safe full-duplex BinaryTcpClient.
Contains information about a language.
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Node representing an IP Host machine.
string Host
Host name or IP address.
Node representing a port on an IP Host machine.
async Task< BinaryTcpClient > ConnectTcp(bool DecoupledEvents, params ISniffer[] Sniffers)
Connect to the remote host and port using a binary protocol over TCP.
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
async override Task< IEnumerable< Parameter > > GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
Gets displayable parameters.
override Task< bool > AcceptsChildAsync(INode Child)
If the node accepts a presumptive child, i.e. can receive as a child (if that child accepts the node ...
bool Tls
If connection is encrypted using TLS or not.
async Task< TextTcpClient > ConnectTcp(Encoding Encoding, bool DecoupledEvents, params ISniffer[] Sniffers)
Connect to the remote host and port using a text-based protocol over TCP.
async override Task StartReadout(ISensorReadout Request)
Starts the readout of the sensor.
Tokens available in request.
Represents a boolean value that can be either true or false.
Represents a date and optional time value.
Represents a physical quantity value.
Represents a string value.
Contains information about an error on a thing
Interface for sniffers. Sniffers can be added to ICommunicationLayer classes to eavesdrop on communic...
Interface for nodes that are published through the concentrator interface.
Interface for classes managing sensor data readouts.
bool IsIncluded(string FieldName)
Checks if a field with the given parameters is included in the readout.
Task ReportErrors(bool Done, params ThingError[] Errors)
Report error states to the client.
Task ReportFields(bool Done, params Field[] Fields)
Report read fields to the client.
FieldQoS
Field Quality of Service flags
FieldType
Field Type flags