Class EthernetDiscoverer

java.lang.Object
com.cognex.cmbsdk.discovery.EthernetDiscoverer

public class EthernetDiscoverer extends Object
Discovers available DataMan devices on the specified network interface.
  • Constructor Details

  • Method Details

    • wifiInterfaceDiscoverer

      public static EthernetDiscoverer wifiInterfaceDiscoverer(android.content.Context context, android.os.Handler handler, EthernetDiscoverer.OnDataManDeviceDetectedListener listener)
      Discovers available DataMan devices on the WiFi network, if available. Please specify android.permission.ACCESS_WIFI_STATE permission in manifest to use this method.
      Parameters:
      context - The Context object to use.
      handler - The Handler object to be used to execute the listeners on its thread. (specify null for main looper Handler)
      listener - The EthernetDiscoverer.OnDataManDeviceDetectedListener listener to invoke if a device is found.
      Returns:
      an EthernetDiscoverer instance configured for the device Wifi connection, or null if the Wifi is not available.
    • wifiInterfaceDiscoverer

      public static EthernetDiscoverer wifiInterfaceDiscoverer(android.content.Context context, EthernetDiscoverer.OnDataManDeviceDetectedListener listener)
      Discovers available DataMan devices on the WiFi network, if available, and executes the listener on the main looper Handler.
      Parameters:
      context - The Context object to use.
      listener - The EthernetDiscoverer.OnDataManDeviceDetectedListener listener to invoke if a device is found.
      Returns:
      an EthernetDiscoverer instance configured for the device Wifi connection, or null if the Wifi is not available.
    • getDeviceFilter

      public int getDeviceFilter()
    • setDeviceFilter

      public void setDeviceFilter(int deviceFilter)
    • startDeviceDiscovery

      public void startDeviceDiscovery() throws IllegalArgumentException
      Starts the device discovery process.
      Throws:
      IllegalArgumentException - if the interface can not be opened.
    • startDeviceDiscovery

      public void startDeviceDiscovery(boolean treatBootupAsHello) throws IllegalArgumentException
      Starts the device discovery process.
      Parameters:
      treatBootupAsHello - If true, the listener will treat Bootup packets as Hello packets when processing incoming cognamer packets.
      Throws:
      IllegalArgumentException - if the interface can not be opened.
    • sendIdentifier

      public void sendIdentifier()
      Send identifier packet on the network. Useful to reuse existing instance.
    • stopDeviceDiscovery

      public void stopDeviceDiscovery()
      Cancels the currently running device discovery.
    • setLogger

      public void setLogger(Logger logger)
      Sets the optional logger which can be used for debugging purposes.
      Parameters:
      logger - The logger object to be used for logging.