to find the different elements belonging to the SDK in this namespace. They will appear in the intellisense as seen in the
following image:
Enumerating DataMan Devices
In your project, which already uses the SDK, you’ll need the following additional steps:
1. Under
Project
, right-click
References
and choose
Add Reference…
2. In the pop-up window, click the Browse tab and look for the
Cognex.DataMan.Discovery.*.dll
file (where * refers
to the platform you are working on, either PC or CF) in the directory where you installed or copied the binary files.
3. Add the following line to the beginning of your code:
using Cognex.DataMan.Discovery;
to find the different elements belonging to the SDK in these namespaces. They will appear in the intellisense.
From this point on, you can choose to discover devices either via Ethernet or via serial communication (RS232/USB), or
you can choose to do both.
4. Discovering devices via Ethernet:
a. Create a new EthSystemDiscoverer.
EthSystemDiscoverer ethSystemDiscoverer = new
EthSystemDiscoverer();
b. Subscribe to its SystemDiscovered event.
ethSystemDiscoverer.SystemDisc= new
EthSystemDiscoverer.SystemDiscoveredHandler(OnEthSystemDiscovered);
c. Create event handler of type EthSystemDiscoverer.SystemDiscoveredHandler.
d. The event handler argument is an EthSystemDiscoverer.SystemInfo. These SystemInfo objects contain
information required for connecting to a reader. You can store these SystemInfo objects in your own collection.
e. To start device discovery, call the ethSystemDiscoverer.Discover() method.
5. Discovering devices via serial communication (RS232/USB):
21
DataMan Application Development