Status |
Starts this instance.
Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
Example
The following example illustrates how to start status map to be able to receive statuses.
C#
using System; using Gamanet.C4.SimpleInterfaces; using Gamanet.C4.SDK; public class RestClientConfiguration { static void Main() { // Create instance of simple client with configuration for RestClient (connection to C4 server) var client = new SimpleClient(ConnectorConfiguration.HttpClient); var client2 = new SimpleClient(ConnectorConfiguration.HttpClient); ConnectionInfo token; var connectionResult1 = client.Connect(new Uri("https://localhost/"), "Support", "support", out token); Console.WriteLine("Connection result: {0}", connectionResult1); var connectionResult2 = client2.Connect(new Uri("https://localhost/"), "Support", "support", out token); Console.WriteLine("Connection result: {0}", connectionResult2); client.StatusMap.OnStatusChanged += StatusMapOnOnStatusChanged; client.MessagePump.Start(); client.StatusMap.Start(); var status = new SimpleStatus(Guid.NewGuid(), "", Guid.Empty, Guid.Empty) { EntityId = EntityRoot.Device, Statuses = new SimpleCollection<StatusInfo>() { new StatusInfo(Guid.Parse("6F218295-37AD-42F5-9104-041FC468471D")) // armed } }; var message = new Message(Guid.Empty, EntityRoot.Device, status); client2.MessagePump.Send(message); // The example displays the following output: // Connection result: Successful // Connection result: Successful // Status of entity 20000000-0000-0000-0000-000000000000 changed to 6f218295-37ad-42f5-9104-041fc468471d } private static void StatusMapOnOnStatusChanged(object sender, StatusArgs e) { foreach (var change in e.Changes) { foreach (var statusInfo in change.Value) { Console.WriteLine($"Status of entity {change.Key} changed to {statusInfo.Status}"); } } } }
See Also