Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Port.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
4using Waher.Things;
7
9{
13 public class Port : ConfigurationNode
14 {
18 public Port()
19 : base(null, null)
20 {
21 this.Protocol = string.Empty;
22 this.PortNumber = 0;
23 }
24
33 : base(Source, Parent)
34 {
35 this.Protocol = Protocol;
36 this.PortNumber = PortNumber;
37 }
38
42 [Page(7, "Configuration")]
43 [Header(43, "Protocol:")]
44 [ToolTip(44, "Protcol label.")]
45 [Required]
46 public string Protocol { get; set; }
47
51 [Page(7, "Configuration")]
52 [Header(41, "Port Number:")]
53 [ToolTip(42, "Port number broker uses for the given protocol.")]
54 [Range(1, 65535)]
55 [Text(TextPosition.AfterField, 63, "Note: Changes will take effect after broker has been restarted.")]
56 [Required]
57 public int PortNumber { get; set; }
58
62 public override string NodeId => this.PortNumber.ToString();
63
68 public override Task<string> GetTypeNameAsync(Language Language) => Language.GetStringAsync(typeof(GatewayConfigSource), 45, "Port Number");
69
75 public override Task<bool> AcceptsParentAsync(INode Parent)
76 {
77 return Task.FromResult(Parent is Ports);
78 }
79
86 public override async Task<IEnumerable<Parameter>> GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
87 {
88 LinkedList<Parameter> Parameters = new LinkedList<Parameter>();
90
91 Parameters.AddLast(new StringParameter("Protocol", await Namespace.GetStringAsync(46, "Protocol"), this.Protocol));
92
93 return Parameters;
94 }
95 }
96}
Contains information about a language.
Definition: Language.cs:17
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 ...
Definition: Language.cs:209
async Task< Namespace > GetNamespaceAsync(string Name)
Gets the namespace object, given its name, if available.
Definition: Language.cs:99
Contains information about a namespace in a language.
Definition: Namespace.cs:17
Task< LanguageString > GetStringAsync(int Id)
Gets the string object, given its ID, if available.
Definition: Namespace.cs:65
Abstract base class for gateway configuration nodes.
virtual INode Parent
Parent Node, or null if a root node.
GatewayConfigSource Source
Source hosting the node.
override async Task< IEnumerable< Parameter > > GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
Gets displayable parameters.
Definition: Port.cs:86
override string NodeId
ID of node.
Definition: Port.cs:62
override Task< bool > AcceptsParentAsync(INode Parent)
If the node accepts a presumptive parent, i.e. can be added to that parent (if that parent accepts th...
Definition: Port.cs:75
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
Port(GatewayConfigSource Source, Ports Parent, string Protocol, int PortNumber)
References a port number.
Definition: Port.cs:32
Root node of port numbers to use.
Definition: Ports.cs:11
Tokens available in request.
Definition: RequestOrigin.cs:9
Interface for nodes that are published through the concentrator interface.
Definition: INode.cs:49
TextPosition
Where the instructions are to be place.
Definition: TextAttribute.cs:9