minute read
Devices
You are reading our Automation1 API documentation for the .NET programming language.
In the .NET API, Devices lets you see the electrical devices on your Automation1 controller.
The Basics
Electrical devices include the electrical HyperWire devices that connect to mechanical devices and the HyperWire PCIe card required by PC-based controllers.
How to Use
In the .NET API, Devices is part of the Controller.Runtime property. For all the APIs that operate under this property, the Automation1 controller must be running before you can see the electrical devices on your controller. For more information about this property, see the Controller page.
The Controller.Runtime.Devices property gives you access to see the attached electrical HyperWire devices. The Controller.Runtime.Devices.HyperWireDevices property is an enumerable collection of the electrical HyperWire devices on the Automation1 controller. You can iterate over this collection or index into it. The index for this collection is the device index, not the axis index. The main use of this collection is to determine what type of devices you have with the HyperWireDeviceType enum and to determine which physical axes are controlled by each device. Refer to the example that follows.
controller.Runtime.Devices.HyperWireDevices[int deviceIndex].DeviceType
The combination of an electrical HyperWire device and a connected mechanical device makes a physical axis on your Automation1 controller. See the Axes page. The Axes property is an enumerable collection of the physical axes controlled by the device. The index for this collection is a simple array-like collection that always starts at 0. It is not the axis index. Refer to the example that follows.
controller.Runtime.Devices.HyperWireDevices[int deviceIndex].Axes[int index]
The Controller.Runtime.Devices property also gives you access to see the installed HyperWire PCIe card with the Controller.Runtime.Device.HyperWireCard property. This property will be null if there is no HyperWire PCIe card. PC-based controllers might not have a HyperWire PCIe card if they are running virtually. Drive-based controllers never have a HyperWire PCIe card. Refer to the example that follows.
controller.Runtime.Devices.HyperWireCard
Example Code
bool hasHyperWireCard = controller.Runtime.Devices.HyperWireCard != null;
Console.WriteLine(controller.Runtime.Devices.HyperWireDevices.FirstOrDefault()?.DeviceType);
Thread Safety
All the methods and properties that operate under the Controller.Runtime.Devices property are thread safe. You can call them from two or more threads without interference.
Full Reference
For more information about the properties that are available for Devices, refer to the lists that follow.
Controller.Runtime.Devices.HyperWireCard Properties
Gets the active PCIe HyperWire card used by a PC-Based Automation1 controller to communicate with connected HyperWire devices (Controller.Runtime.Devices.HyperWireDevices property), or null if a PCIe HyperWire card is not in use.
There might be more than one PCIe HyperWire card installed in the PC, but this property is the single PCIe HyperWire card currently being used by the Automation1 controller. This property will be null if the Automation1 controller is operating without a HyperWire card (that is, in virtual mode or if it is a drive-based controller).
Gets the PCI bus number this PCIe HyperWire card is on. This is used along with DeviceNumber and FunctionNumber to uniquely identify the PCIe card in the PC.
Gets the device ID of this PCIe HyperWire card.
Gets the PCI device number for this PCIe HyperWire card. This is used along with BusNumber and FunctionNumber to uniquely identify the PCIe card in the PC.
Gets the version of firmware that is running on this PCIe HyperWire card.
Gets the PCI function number for this PCIe HyperWire card. This is used along with BusNumber and DeviceNumber to uniquely identify the PCIe card in the PC.
Gets the vendor ID of this PCIe HyperWire card.
Controller.Runtime.Devices.HyperWireDevices Properties
Gets the collection of HyperWire devices connected to the Automation1 controller over the HyperWire motion bus.
Gets the HyperWireDevice object for a specific device index.
Gets the collection of axes that this HyperWire device has, if any.
If this HyperWire device has no axes, then this collection will be empty. HyperWire devices with axes are known as HyperWire drives. This collection is not indexed by axis index or by axis name, instead it is simply an array-like collection that always starts at index 0.
Gets the numeric index of this HyperWire device as it is connected to the Automation1 controller over the HyperWire motion bus.
Gets the type of device this HyperWireDevice object represents.
Gets the version of firmware that is running on this HyperWire device.
Gets which communication port this HyperWire device is connected to on a PCIe HyperWire card, if any.
This will be equal to the HyperWireCardPort.None property if the HyperWire device is not connected to a HyperWire card (that is, if it is a drive-based controller).