ifm3d
ifm3d::Device Class Reference

#include <ifm3d/device/device.h>

Inheritance diagram for ifm3d::Device:
[legend]

Public Types

enum  boot_mode : int { PRODUCTIVE = 0, RECOVERY = 1 }
 
enum  operating_mode : int { RUN = 0, EDIT = 1 }
 
enum  trigger_mode : int { FREE_RUN = 1, SW = 2 }
 
enum  import_flags : int { GLOBAL = 0x1, NET = 0x2, APPS = 0x10 }
 
enum  spatial_filter : int { OFF = 0x0, MEDIAN = 0x1, MEAN = 0x2, BILATERAL = 0x3 }
 
enum  temporal_filter : int { OFF = 0x0, MEAN = 0x1, ADAPTIVE_EXP = 0x2 }
 
enum  mfilt_mask_size : int { _3x3 = 0, _5x5 = 1 }
 
enum  device_family : int { UNKNOWN = 0, O3D = 1, O3X = 2, O3R = 3 }
 
enum  swu_version : int { SWU_NOT_SUPPORTED = 0, SWU_V1 = 1, SWU_V2 = 2 }
 
using Ptr = std::shared_ptr< Device >
 

Public Member Functions

 Device (const std::string &ip=ifm3d::DEFAULT_IP, const std::uint16_t xmlrpc_port=ifm3d::DEFAULT_XMLRPC_PORT)
 
virtual ~Device ()
 
 Device (Device &&)=delete
 
Deviceoperator= (Device &&)=delete
 
 Device (Device &)=delete
 
Deviceoperator= (Device &)=delete
 
virtual std::string IP ()
 
virtual std::uint16_t XMLRPCPort ()
 
virtual void Reboot (const boot_mode &mode=ifm3d::Device::boot_mode::PRODUCTIVE)
 
virtual void ForceTrigger ()
 
virtual std::string DeviceType (bool use_cached=true)
 
virtual device_family WhoAmI ()
 
virtual bool AmI (device_family family)
 
virtual std::string DeviceParameter (const std::string &key)
 
virtual std::vector< std::string > TraceLogs (int count)
 
virtual json ToJSON ()
 
virtual std::string ToJSONStr ()
 
virtual void FromJSON (const json &j)
 
virtual void FromJSONStr (const std::string &jstr)
 
bool CheckMinimumFirmwareVersion (unsigned int major, unsigned int minor, unsigned int patch)
 
ifm3d::SemVer FirmwareVersion ()
 
virtual ifm3d::Device::swu_version SwUpdateVersion ()
 

Static Public Member Functions

static std::vector< ifm3d::IFMNetworkDeviceDeviceDiscovery ()
 This function Provides a convinent way to find all ifm devices on the network. More...
 
static Ptr MakeShared (const std::string &ip=ifm3d::DEFAULT_IP, const std::uint16_t xmlrpc_port=ifm3d::DEFAULT_XMLRPC_PORT, const std::string &password=ifm3d::DEFAULT_PASSWORD, bool throwIfUnavailable=true)
 

Protected Member Functions

int DeviceID ()
 
bool checkDeviceID (int deviceID, int minID, int maxID)
 
std::shared_ptr< XMLRPCWrapper > XWrapper ()
 

Protected Attributes

std::unique_ptr< Impl > pImpl
 
std::string device_type_
 

Detailed Description

Software interface to an ifm 3D device

The Device class implements the underlying network protocol for communicating with the ifm hardware. Via this communication layer, this class exposes objects that can be used to mutate and tune the device parameters including those of the underlying pmd imager.

Member Enumeration Documentation

◆ boot_mode

enum ifm3d::Device::boot_mode : int
strong

Device boot up modes:

Productive: the normal runtime firmware comes up Recovery: allows you to flash new firmware

◆ import_flags

enum ifm3d::Device::import_flags : int
strong

Import flags used when importing a Vision Assistant configuration

◆ mfilt_mask_size

enum ifm3d::Device::mfilt_mask_size : int
strong

Convenient constants for median filter mask sizes

◆ operating_mode

enum ifm3d::Device::operating_mode : int
strong

Device operating modes: run (streaming pixel data), edit (configuring the device/applications).

◆ spatial_filter

enum ifm3d::Device::spatial_filter : int
strong

Convenience constants for spatial filter types

◆ temporal_filter

enum ifm3d::Device::temporal_filter : int
strong

Convenience constants for temporal filter types

◆ trigger_mode

enum ifm3d::Device::trigger_mode : int
strong

Image acquisition trigger modes

Constructor & Destructor Documentation

◆ Device()

ifm3d::Device::Device ( const std::string &  ip = ifm3d::DEFAULT_IP,
const std::uint16_t  xmlrpc_port = ifm3d::DEFAULT_XMLRPC_PORT 
)

Initializes the device interface utilizing library defaults for password, ip, and xmlrpc port unless explicitly passed in.

Parameters
[in]ipThe ip address of the device
[in]xmlrpc_portThe tcp port the sensor's XMLRPC server is listening on
[in]passwordPassword required for establishing an "edit session" with the sensor. Edit sessions allow for mutating device parameters and persisting those changes.

◆ ~Device()

virtual ifm3d::Device::~Device ( )
virtual

The dtor will cancel any open edit sessions with the device.

Member Function Documentation

◆ AmI()

virtual bool ifm3d::Device::AmI ( device_family  family)
virtual

This is a convenience function for checking whether a device is one of the specified device family

Parameters
[in]familyThe family to check for
Returns
true if the device is part of the family

◆ CheckMinimumFirmwareVersion()

bool ifm3d::Device::CheckMinimumFirmwareVersion ( unsigned int  major,
unsigned int  minor,
unsigned int  patch 
)

Checks for a minimum ifm device software version

Parameters
[in]majorMajor version of software
[in]minorMinor Version of software
[in]patchPatch Number of software

return True if current software version is greater or equal to the value passed

◆ DeviceDiscovery()

static std::vector<ifm3d::IFMNetworkDevice> ifm3d::Device::DeviceDiscovery ( )
static

This function Provides a convinent way to find all ifm devices on the network.

Returns
: vector of ip-address all the discovered devices on network.

◆ DeviceID()

int ifm3d::Device::DeviceID ( )
protected

Implements the serialization of the device state to JSON.

Parameters
[in]open_sessionif false function will work on already opened session
Returns
A JSON object representation of the current device state.

◆ DeviceParameter()

virtual std::string ifm3d::Device::DeviceParameter ( const std::string &  key)
virtual

Convenience accessor for extracting a device parameters (i.e., no edit session created on the device)

◆ DeviceType()

virtual std::string ifm3d::Device::DeviceType ( bool  use_cached = true)
virtual

This is a convenience function for extracting out the device type of the connected device. The primary intention of this function is for internal usage (i.e., to trigger conditional logic based on the model hardware we are talking to) however, it will likely be useful in application-level logic as well, so, it is available in the public interface.

Parameters
[in]use_cachedIf set to true, a cached lookup of the device type will be used as the return value. If false, it will make a network call to the device to get the "real" device type. The only reason for setting this to false would be if you expect over the lifetime of your camera instance that you will swap out (for example) an O3D for an O3X (or vice versa) – literally, swapping out the network cables while an object instance is still alive. If that is not something you are worried about, leaving this set to true should result in a signficant performance increase.

◆ FirmwareVersion()

ifm3d::SemVer ifm3d::Device::FirmwareVersion ( )

get the firmware version of the device

◆ ForceTrigger()

virtual void ifm3d::Device::ForceTrigger ( )
virtual

Sends a S/W trigger to the device over XMLRPC.

The O3X does not S/W trigger over PCIC, so, this function has been developed specficially for it. For other sensors, this is a NOOP.

Reimplemented in ifm3d::LegacyDevice.

◆ FromJSON()

virtual void ifm3d::Device::FromJSON ( const json j)
virtual

Configures the device based on the parameter values of the passed in JSON. This function is the way to tune the device/application/imager/etc. parameters.

Parameters
[in]jsonA json object encoding a camera configuration to apply to the hardware.
  • Device parameters are processed and saved persistently
Exceptions
ifm3d::Errorupon error - if this throws an exception, you are encouraged to check the log file as a best effort is made to be as descriptive as possible as to the specific error that has occured.

Reimplemented in ifm3d::LegacyDevice, and ifm3d::O3R.

◆ FromJSONStr()

virtual void ifm3d::Device::FromJSONStr ( const std::string &  jstr)
virtual

Accepts a string with properly formatted/escaped JSON text, converts it to a json object, and call FromJSON() on it.

See also
FromJSON

◆ IP()

virtual std::string ifm3d::Device::IP ( )
virtual

The IP address associated with this Device instance

◆ MakeShared()

static Ptr ifm3d::Device::MakeShared ( const std::string &  ip = ifm3d::DEFAULT_IP,
const std::uint16_t  xmlrpc_port = ifm3d::DEFAULT_XMLRPC_PORT,
const std::string &  password = ifm3d::DEFAULT_PASSWORD,
bool  throwIfUnavailable = true 
)
static

Factory function for instantiating the proper subclass based on h/w probing.

This function provides a convenient way for users of the library to write hardware independent code. This function probes the connected hardware and returns a proper subclass based upon the returned DeviceType. In the event that the hardware is not connected, the error is trapped and an instance of the base class is returned. The net result of not having an instance of a subclass is: 1) worse performance, 2) errors will come back from the sensor rather than the library – some of which may be hard to debug.

Parameters
[in]ipThe ip address of the device
[in]xmlrpc_portThe tcp port the sensor's XMLRPC server is listening on
[in]passwordPassword required for establishing an "edit session" with the sensor. Edit sessions allow for mutating device parameters and persisting those changes.

◆ Reboot()

virtual void ifm3d::Device::Reboot ( const boot_mode mode = ifm3d::Device::boot_mode::PRODUCTIVE)
virtual

Reboot the device

Parameters
[in]modeThe system mode to boot into upon restart of the device
Exceptions
ifm3d::Errorupon error

Reimplemented in ifm3d::O3R.

◆ SwUpdateVersion()

virtual ifm3d::Device::swu_version ifm3d::Device::SwUpdateVersion ( )
virtual

Checks the swupdater version supported by device

Returns
sw_version supported by device

Reimplemented in ifm3d::O3R.

◆ ToJSON()

virtual json ifm3d::Device::ToJSON ( )
virtual

Serializes the state of the device to JSON.

The JSON interface returned here is the excellent JSON for Modern C++.

This function (along with its std::string equivalent ToJSONStr()) provides the primary gateway into obtaining the current parameter settings for the device and PMD imager. Data returned from this function can be manipulated as a json object, then fed into FromJSON(...) to mutate parameter settings on the device.

Returns
A JSON object representation of the current state of the hardware.
Exceptions
ifm3d::Errorupon error

Reimplemented in ifm3d::LegacyDevice, and ifm3d::O3R.

◆ ToJSONStr()

virtual std::string ifm3d::Device::ToJSONStr ( )
virtual

A stringified version of the JSON object returned by ToJSON().

Returns
A string version of the Camera's JSON representation.
See also
ToJSON

◆ TraceLogs()

virtual std::vector<std::string> ifm3d::Device::TraceLogs ( int  count)
virtual

Delivers the trace log from the device A session is not required to call this function.

Returns
A ‘vector’ of ‘std::string’ for each entry in the tracelog
Exceptions
ifm3d::Errorupon error

◆ WhoAmI()

virtual device_family ifm3d::Device::WhoAmI ( )
virtual

This function can be used to retrieve the family of the connected device

Returns
the device family of the connected device.

Reimplemented in ifm3d::O3R, ifm3d::O3D, and ifm3d::O3X.

◆ XMLRPCPort()

virtual std::uint16_t ifm3d::Device::XMLRPCPort ( )
virtual

The XMLRPC Port associated with this Device instance

Member Data Documentation

◆ device_type_

std::string ifm3d::Device::device_type_
protected

The cached device type of the connected device


The documentation for this class was generated from the following file: