This documentation is archived and is not being maintained.

IrDAClient.DiscoverDevices Method (Int32)

Obtains information about a specified number of devices.

Namespace: System.Net.Sockets
Assembly: System.Net.IrDA (in system.net.irda.dll)

public IrDADeviceInfo[] DiscoverDevices (
	int maxDevices
)
public IrDADeviceInfo[] DiscoverDevices (
	int maxDevices
)
public function DiscoverDevices (
	maxDevices : int
) : IrDADeviceInfo[]
Not applicable.

Parameters

maxDevices

The maximum number of devices to get information about.

Return Value

An IrDADeviceInfo interface.

The following code example creates a collection of a maximum of three devices. This code example is part of a larger example provided for the IrDAClient class.

// Create a collection of a maximum of three devices.
irDevices = irClient.DiscoverDevices(2);

// Show a message if no devices are found.
if (irDevices.Length == 0)
{
    MessageBox.Show("No remote infrared devices found!");
    return;
}

// Enumerate the IrDADeviceInfo
// array and list device information
// for each device in the list box.
string device;
int ID;
listBox1.Items.Clear();
foreach(IrDADeviceInfo irDevice in irDevices)
{
    ID = BitConverter.ToInt32(irDevice.DeviceID, 0);
    device = ID.ToString() + " " + irDevice.DeviceName + " "
        +  irDevice.CharacterSet + " " + irDevice.Hints;
    listBox1.Items.Add(device);
}

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Compact Framework

Supported in: 2.0, 1.0
Show: