Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ChatModule.cs
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Threading;
5using System.Threading.Tasks;
11
13{
14 public class ChatModule : IModule
15 {
16 private ChatServer chatServer = null;
17 private BobClient bobClient = null;
18
19 public ChatModule()
20 {
21 }
22
23 public Task Start()
24 {
27
28 if (Types.TryGetModuleParameter("Concentrator", out object Obj))
30
31 if (Types.TryGetModuleParameter("Provisioning", out Obj))
33
34 this.bobClient = new BobClient(Gateway.XmppClient, Path.Combine(Gateway.AppDataFolder, "BoB"));
35 this.chatServer = new ChatServer(Gateway.XmppClient, this.bobClient, ConcentratorServer, ProvisioningClient);
36
37 return Task.CompletedTask;
38 }
39
40 public Task Stop()
41 {
42 this.chatServer?.Dispose();
43 this.chatServer = null;
44
45 this.bobClient?.Dispose();
46 this.bobClient = null;
47
48 return Task.CompletedTask;
49 }
50 }
51}
Task Stop()
Stops the module.
Definition: ChatModule.cs:40
Task Start()
Starts the module.
Definition: ChatModule.cs:23
Static class managing the runtime environment of the IoT Gateway.
Definition: Gateway.cs:126
static string AppDataFolder
Application data folder.
Definition: Gateway.cs:2369
static XmppClient XmppClient
XMPP Client connection of gateway.
Definition: Gateway.cs:3187
Client managing bits of binary (XEP-0231): https://xmpp.org/extensions/xep-0231.html
Definition: BobClient.cs:18
override void Dispose()
Disposes of the extension.
Definition: BobClient.cs:44
Class managing a chat interface for things.
Definition: ChatServer.cs:49
override void Dispose()
Disposes of the extension.
Definition: ChatServer.cs:212
Implements an XMPP concentrator server interface.
Implements an XMPP provisioning client interface.
Static class that dynamically manages types and interfaces available in the runtime environment.
Definition: Types.cs:14
static bool TryGetModuleParameter(string Name, out object Value)
Tries to get a module parameter value.
Definition: Types.cs:583
Interface for late-bound modules loaded at runtime.
Definition: IModule.cs:9