DeviceRepositoryV3.GetDirectChildren Method

Get Device Direct Childrens

Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public ISimpleCollection<SimpleDeviceV1> GetDirectChildren(
	Guid deviceId,
	Properties properties,
	bool includeNode
)

Parameters

deviceId  Guid
The device identifier.
properties  Properties
The properties.
includeNode  Boolean
if set to true include node.

Return Value

ISimpleCollection<SimpleDeviceV1>
Collection of devices

Implements

ISimpleClientDeviceRepositoryV3.GetDirectChildren(Guid, Properties, Boolean)
Example
The following example illustrates how SimpleClient filter device by direct children with all data, with option to include searched node
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);

        // Here we retrieve direct children of a parent device, without parent (device we using in search) node
        var resultExampleWithoutNode = client.Devices.GetDirectChildren(examplePanel.Id, Properties.All, false);

        foreach (var child in resultExampleWithoutNode)
        {
            Console.WriteLine($"Device name: {child.Name}");
        }

        // Here we retrieve direct children of a parent device, with parent (device we using in search) node
        var resultExampleWithNode = client.Devices.GetDirectChildren(examplePanel.Id, Properties.All, true);

        foreach (var child in resultExampleWithNode)
        {
            Console.WriteLine($"Device name: {child.Name}");
        }

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

Reference

DeviceRepositoryV3 Class
Gamanet.C4.SDK Namespace