Device |
Get all parents with references, node is always included.
Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public ISimpleCollection<SimpleDeviceV1> GetAllParentsWithReferences( Guid deviceId, Properties properties )
Parameters
- deviceId Guid
- Text person identifier.
- properties Properties
- The properties.
Return Value
ISimpleCollection<SimpleDeviceV1>Persons
Implements
ISimpleClientDeviceRepositoryV3.GetAllParentsWithReferences(Guid, Properties)Example
The following example illustrates how SimpleClient filter all devices parents
C#
using System; using Gamanet.C4.SDK; using Gamanet.C4.SimpleInterfaces; public class Example { static void Main() { // Create instance of simple client var client = new SimpleClient(ConnectorConfiguration.HttpClient); ConnectionInfoV1 token; // Connect to local server var connectionResult = client.Connect(new Uri("https://localhost/"), "Support", "support", out token); if (connectionResult != ConnectionResult.Successful) { Console.WriteLine("Connection unsuccessful, result: {0}", connectionResult); return; } Console.WriteLine("Connection result: {0}", connectionResult); Console.WriteLine(); // You need to have installed the Demo Access Device package from https://my.c4portal.com/plugins/ var exampleBusCategory = client.EntityDefinitions.Get(Guid.Parse("4810e0c6-9391-490c-a646-ca9643dd1ca5")).Id; var examplePanelCategory = client.EntityDefinitions.Get(Guid.Parse("822caeea-b66b-4f60-ab43-bc14240cb6ec")).Id; var exampleDoorCategory = client.EntityDefinitions.Get(Guid.Parse("dcd0cea7-8de9-4458-afa7-cd1e94b56028")).Id; // Create the Example Device (Bus Controller) var exampleBusController = new SimpleDeviceV1( Guid.NewGuid(), "BUS", EntityRoot.Device, exampleBusCategory ); // Create the Example Device (Panel) var examplePanel = new SimpleDeviceV1( Guid.NewGuid(), "PANEL", exampleBusController.Id, examplePanelCategory ); // Create the Example Device (Door) var exampleDoor = new SimpleDeviceV1( Guid.NewGuid(), "DOOR", examplePanel.Id, exampleDoorCategory ); // Create devices in db client.Devices.Create(exampleBusController); client.Devices.Create(examplePanel); client.Devices.Create(exampleDoor); var resultExample = client.Devices.GetAllParentsWithReferences(exampleDoor.Id, Properties.None); foreach(var device in resultExample) { Console.WriteLine(device.Name); } // Disconnect from server client.Disconnect(); } }
See Also