DeviceRepositoryV4.IsChildOf Method

Determines if the specified device is a child of the given parent device.

Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public bool IsChildOf(
	Guid deviceId,
	Guid parentId,
	bool includeArchived
)

Parameters

deviceId  Guid
The unique identifier of the device.
parentId  Guid
The unique identifier of the parent device.
includeArchived  Boolean
Whether to include archived devices in the check.

Return Value

Boolean
True if the device is a child of the parent; otherwise, false.

Implements

ISimpleClientDeviceRepositoryV4.IsChildOf(Guid, Guid, Boolean)
Example
This example demonstrates how to check if device is child of another device with included archived devices.
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 device
        // create device
        SimpleClientV1.Devices.Create(device);
        SimpleClientV1.Devices.Create(panel);
        client.Devices.Archive(device);

        var result = client.Devices.IsChildOf(panel.Id, device.Id, true);

        // Disconnect from server
        client.Disconnect();
    }
}
This example demonstrates how to check if device is child of another device with excluded archived devices.
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 device
        client.Devices.Create(device);
        client.Devices.Create(panel);
        client.Devices.Create(door);
        client.Devices.Archive(door);

        var result = client.Devices.IsChildOf(panel.Id, device.Id, false);
        var result2 = client.Devices.IsChildOf(door.Id, panel.Id, false);

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

Reference

DeviceRepositoryV4 Class
Gamanet.C4.SDK Namespace