2using System.Collections.Generic;
4using System.Threading.Tasks;
19 private readonly
string nodeId;
20 private readonly
string sourceId;
21 private readonly
string paritionId;
35 this.paritionId = ParitionId;
51 StringBuilder sb =
new StringBuilder();
53 sb.Append(this.nodeId);
55 if (!
string.IsNullOrEmpty(this.sourceId) || !
string.IsNullOrEmpty(this.paritionId))
58 sb.Append(this.sourceId);
60 if (!
string.IsNullOrEmpty(this.paritionId))
63 sb.Append(this.paritionId);
70 sb.Append(this.jid.Value);
120 public Task<IEnumerable<INode>>
ChildNodes => Task.FromResult<IEnumerable<INode>>(
null);
149 return Task.FromResult(
false);
159 return Task.FromResult(
false);
168 throw new NotSupportedException(
"This node cannot accept child nodes.");
178 return Task.FromResult(
false);
188 return Task.FromResult(
false);
198 return Task.FromResult(
false);
208 return Task.FromResult(
true);
216 return Task.CompletedTask;
227 return Task.FromResult<IEnumerable<Parameter>>(
new Parameter[0]);
236 return Task.FromResult<IEnumerable<Message>>(
new Message[0]);
245 return Task.FromResult(
string.Empty);
255 return Task.FromResult(
false);
265 return Task.FromResult(
false);
275 return Task.FromResult(
false);
283 return Task.CompletedTask;
289 public Task<IEnumerable<ICommand>>
Commands => Task.FromResult<IEnumerable<ICommand>>(
null);
304 await Request.
ReportErrors(
true,
new ThingError(
this,
"No presence subscription approved by " + this.jid.Value +
". New subscription request sent."));
316 if (
string.IsNullOrEmpty(this.nodeId))
319 Nodes =
new INode[] {
this };
325 SensorDataRequest.OnFieldsReceived += (sender, Fields) =>
328 return Task.CompletedTask;
331 SensorDataRequest.OnErrorsReceived += (sender, Errors) =>
334 return Task.CompletedTask;
337 SensorDataRequest.OnStateChanged += (sender,
State) =>
354 return Task.CompletedTask;
Static class managing the runtime environment of the IoT Gateway.
static SensorClient SensorClient
XMPP Sensor Client.
static XmppClient XmppClient
XMPP Client connection of gateway.
Represents an external node.
Task< bool > CanEditAsync(RequestOrigin Caller)
If the node can be edited by the caller.
NodeState State
Current overall state of the node.
bool HasChildren
If the source has any child sources.
string LocalId
If provided, an ID for the node, but unique locally between siblings. Can be null,...
Task< bool > CanViewAsync(RequestOrigin Caller)
If the node is visible to the caller.
Task< bool > MoveDownAsync(RequestOrigin Caller)
Tries to move the node down.
bool ChildrenOrdered
If the children of the node have an intrinsic order (true), or if the order is not important (false).
Task UpdateAsync()
Updates the node (in persisted storage).
string LogId
If provided, an ID for the node, as it would appear or be used in system logs. Can be null,...
bool HasCommands
If the node has registered commands or not.
DateTime LastChanged
When the node was last updated.
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 ...
Task< bool > RemoveAsync(INode Child)
Removes a child from the node.
Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
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...
Task< bool > MoveUpAsync(RequestOrigin Caller)
Tries to move the node up.
Task< IEnumerable< INode > > ChildNodes
Child nodes. If no child nodes are available, null is returned.
bool IsControllable
If the node can be controlled.
string SourceId
Optional ID of source containing node.
ExternalNode(string NodeId, string SourceId, string ParitionId, CaseInsensitiveString Jid)
Represents an external node.
Task< IEnumerable< Parameter > > GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
Gets displayable parameters.
string Partition
Optional partition in which the Node ID is unique.
Task AddAsync(INode Child)
Adds a new child to the node.
Task< bool > CanDestroyAsync(RequestOrigin Caller)
If the node can be destroyed to by the caller.
CaseInsensitiveString Jid
JID of remote entity.
bool IsReadable
If the node can be read.
Task< IEnumerable< ICommand > > Commands
Available command objects. If no commands are available, null is returned.
INode Parent
Parent Node, or null if a root node.
Task DestroyAsync()
Destroys the node. If it is a child to a parent node, it is removed from the parent first.
Task< IEnumerable< Message > > GetMessagesAsync(RequestOrigin Caller)
Gets messages logged on the node.
async Task StartReadout(ISensorReadout Request)
Starts the readout of the sensor.
Task< bool > CanAddAsync(RequestOrigin Caller)
If the node can be added to by the caller.
Maintains information about an item in the roster.
SubscriptionState State
roup Current subscription state.
bool HasLastPresence
If the roster item has received presence from an online resource having the given bare JID.
string LastPresenceFullJid
Full JID of last resource sending online presence.
PresenceEventArgs LastPresence
Last presence received from a resource having this bare JID.
Task< SensorDataClientRequest > RequestReadout(string Destination, FieldType Types)
Requests a sensor data readout.
Manages a sensor data client request.
Base class for sensor data requests.
Task RequestPresenceSubscription(string BareJid)
Requests subscription of presence information from a contact.
Represents a case-insensitive string.
static bool IsNullOrEmpty(CaseInsensitiveString value)
Indicates whether the specified string is null or an CaseInsensitiveString.Empty string.
Contains information about a language.
Contains information about a message logged on a node.
Base class for all node parameters.
Tokens available in request.
Contains information about an error on a thing
Interface for nodes that are published through the concentrator interface.
Interface for sensor nodes.
Interface for classes managing sensor data readouts.
string ServiceToken
Optional service token.
DateTime When
When the readout is to be made. Use DateTime.MinValue to start the readout immediately.
string[] FieldNames
Names of fields to read.
Task ReportErrors(bool Done, params ThingError[] Errors)
Report error states to the client.
FieldType Types
Field Types to read.
DateTime To
To what time readout is to be made. Use DateTime.MaxValue to specify no upper limit.
string DeviceToken
Optional device token.
Task ReportFields(bool Done, params Field[] Fields)
Report read fields to the client.
DateTime From
From what time readout is to be made. Use DateTime.MinValue to specify no lower limit.
string UserToken
Optional user token.
SensorDataReadoutState
Sensor Data Readout States.
SubscriptionState
State of a presence subscription.
NodeState
State of a node.