Device |
Search text in all devices and get only Bus Controller parents.
Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public ISimpleCollection<SimpleDeviceV1> SearchBusControllers( string searchText )
Parameters
- searchText String
- Text to search.
Return Value
ISimpleCollection<SimpleDeviceV1>Collection of devices
Implements
ISimpleClientDeviceRepositoryV3.SearchBusControllers(String)Example
The following example illustrates how SimpleClient gets Bus Controllers parents of a device, based on device name.
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; // Create the Example Device (Bus Controller) var exampleBusController1 = new SimpleDeviceV1( Guid.NewGuid(), "This is the name x5", EntityRoot.Device, exampleBusCategory ); // Create the Example Device (Bus Controller) var exampleBusController2 = new SimpleDeviceV1( Guid.NewGuid(), "Bus Controller", EntityRoot.Device, exampleBusCategory ); client.Devices.Create(exampleBusController1); client.Devices.Create(exampleBusController2); // we are going to be searching for device with 'x5' string in its name var result = SimpleClientV3.Devices.SearchBusControllers(searchString); foreach (var device in result) { Console.WriteLine($"Device name: '{device.Name}'"); } // Disconnect from server client.Disconnect(); } }
See Also