DeviceRepositoryV3.GetAllChildrenAndParents Method

Get all children and parents

Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public ISimpleCollection<SimpleDeviceV1> GetAllChildrenAndParents(
	Guid deviceId
)

Parameters

deviceId  Guid
The device identifier.

Return Value

ISimpleCollection<SimpleDeviceV1>
Collection of devices

Implements

ISimpleClientDeviceRepositoryV3.GetAllChildrenAndParents(Guid)
Example
The following example illustrates how SimpleClient filter device to get all children and 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();

        // Create the Example Device (Bus Controller)
        var exampleBusController = new SimpleDeviceV1(
            Guid.NewGuid(),
            "BUS",
            EntityRoot.Device,
            Guid.Parse("9c2246aa-5d43-414f-85d4-8c3b4e657236")
        );

        // Create the Example Device (Panel)
        var examplePanel = new SimpleDeviceV1(
            Guid.NewGuid(),
            "PANEL",
            exampleBusController.Id,
            Guid.Parse("a7395726-1e7f-4c1e-bdef-ce28a869620a")
        );

        // Create the Example Device (Door)
        var exampleDoor = new SimpleDeviceV1(
            Guid.NewGuid(),
            "DOOR",
            examplePanel.Id,
            Guid.Parse("8b87ea62-9a72-4126-b054-3f8ad0683bf1")
        );
        // Create devices in db
        client.Devices.Create(exampleBusController);
        client.Devices.Create(examplePanel);
        client.Devices.Create(exampleDoor);

        // Get the children and parents of the example device
        var resultExample = client.Devices.GetAllChildrenAndParents(examplePanel.Id);

        // Console Output should contain device names 'DOOR' and 'BUS'
        foreach (var device in resultExample)
        {
            Console.WriteLine(device.Name);
        }

        // Disconnect from server
        client.Disconnect();
    }
}
See Also

Reference

DeviceRepositoryV3 Class
Gamanet.C4.SDK Namespace