ifm3d
legacy_device.h
1 /*
2  * Copyright 2021-present ifm electronic, gmbh
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #ifndef IFM3D_DEVICE_LEGACY_DEVICE_H
7 #define IFM3D_DEVICE_LEGACY_DEVICE_H
8 
9 #include <ifm3d/device/device.h>
10 
11 namespace ifm3d
12 {
13  class IFM3D_DEVICE_EXPORT LegacyDevice : public Device
14  {
15  public:
16  using Ptr = std::shared_ptr<LegacyDevice>;
17 
25  using device_family = ifm3d::Device::device_family;
26 
47  static Ptr MakeShared(
48  const std::string& ip = ifm3d::DEFAULT_IP,
49  const std::uint16_t xmlrpc_port = ifm3d::DEFAULT_XMLRPC_PORT,
50  const std::string& password = ifm3d::DEFAULT_PASSWORD);
51 
63  LegacyDevice(const std::string& ip = ifm3d::DEFAULT_IP,
64  const std::uint16_t xmlrpc_port = ifm3d::DEFAULT_XMLRPC_PORT,
65  const std::string& password = ifm3d::DEFAULT_PASSWORD);
66 
67  virtual ~LegacyDevice();
68 
70  virtual std::string Password();
71 
73  virtual std::string SessionID();
74 
79  virtual void FactoryReset();
80 
107  virtual std::string RequestSession();
108 
121  virtual bool CancelSession();
122 
130  virtual bool CancelSession(const std::string& sid);
131 
144  virtual int Heartbeat(int hb);
145 
146  virtual std::unordered_map<std::string, std::string> NetInfo();
147  virtual std::unordered_map<std::string, std::string> TimeInfo();
148 
166  virtual void SetTemporaryApplicationParameters(
167  const std::unordered_map<std::string, std::string>& params);
168 
173  virtual int ActiveApplication();
174 
187  virtual json ApplicationList();
188 
198  virtual std::vector<std::string> ApplicationTypes();
199 
208  virtual std::vector<std::string> ImagerTypes();
209 
221  virtual int CopyApplication(int idx);
222 
240  virtual int CreateApplication(
241  const std::string& type = DEFAULT_APPLICATION_TYPE);
242 
249  virtual void DeleteApplication(int idx);
250 
258  virtual void SetCurrentTime(int epoch_secs = -1);
259 
264  virtual std::vector<std::uint8_t> UnitVectors();
265 
270  virtual std::vector<std::uint8_t> ExportIFMConfig();
271 
287  virtual std::vector<std::uint8_t> ExportIFMApp(int idx);
288 
293  virtual void ImportIFMConfig(const std::vector<std::uint8_t>& bytes,
294  std::uint16_t flags = 0x0);
295 
309  virtual int ImportIFMApp(const std::vector<std::uint8_t>& bytes);
310 
319  virtual void SetPassword(std::string password = "");
320 
321  json ToJSON() override;
322  void FromJSON(const json& j) override;
323  void ForceTrigger() override;
324 
325  protected:
326  class Impl;
327  std::unique_ptr<Impl> pImpl;
328 
343  void FromJSON_(
344  const json& j_curr,
345  const json& j_new,
346  std::function<void(const std::string&, const std::string&)> SetFunc,
347  std::function<void()> SaveFunc,
348  const std::string& name,
349  int idx = -1);
350 
359  static bool getAppJSON(int index, const json& j, json& app);
360 
361  json ToJSON_(const bool open_session = true);
362 
363  json getApplicationInfosToJSON();
364  };
365 }
366 
367 #endif // IFM3D_DEVICE_LEGACY_DEVICE_H
ifm3d::Device::spatial_filter
spatial_filter
Convenience constants for spatial filter types.
Definition: device.h:182
ifm3d::json
Definition: json.hpp:128
ifm3d::Device::temporal_filter
temporal_filter
Convenience constants for temporal filter types.
Definition: device.h:193
ifm3d::Device::mfilt_mask_size
mfilt_mask_size
Convenient constants for median filter mask sizes.
Definition: device.h:203
ifm3d::Device::boot_mode
boot_mode
Device boot up modes:
Definition: device.h:144
ifm3d::Device
Definition: device.h:133
ifm3d::Device::operating_mode
operating_mode
Device operating modes: run (streaming pixel data), edit (configuring the device/applications).
Definition: device.h:154
ifm3d::LegacyDevice
Definition: legacy_device.h:13
ifm3d::Device::trigger_mode
trigger_mode
Image acquisition trigger modes.
Definition: device.h:163
ifm3d::Device::import_flags
import_flags
Import flags used when importing a Vision Assistant configuration.
Definition: device.h:172