ifm3d
o3r.h
1 /*
2  * Copyright 2021-present ifm electronic, gmbh
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #ifndef IFM3D_DEVICE_O3R_H
7 #define IFM3D_DEVICE_O3R_H
8 
9 #include <ifm3d/device/device.h>
10 
11 namespace ifm3d
12 {
13  static const int NET_WAIT_O3R_SET = 10000;
14 
16  struct IFM3D_DEVICE_EXPORT PortInfo
17  {
18  std::string port;
19  uint16_t pcic_port;
20  std::string type;
21  };
22 
27  class IFM3D_DEVICE_EXPORT O3R : public Device
28  {
29  public:
30  using Ptr = std::shared_ptr<O3R>;
31  O3R(const std::string& ip = ifm3d::DEFAULT_IP,
32  const std::uint16_t xmlrpc_port = ifm3d::DEFAULT_XMLRPC_PORT);
33 
34  virtual ~O3R();
35  O3R(O3R&&) = delete;
36  O3R& operator=(O3R&&) = delete;
37  O3R(O3R&) = delete;
38  O3R& operator=(O3R&) = delete;
39 
47  virtual void FactoryReset(bool keepNetworkSettings);
48 
54  json GetSchema();
55 
65  json Get(
66  const std::vector<std::string>& path = std::vector<std::string>());
67 
76  json ResolveConfig(const json::json_pointer& ptr);
77 
85  void Set(const json& j);
86 
96  void Remove(const std::string& jsonPointer);
97 
107  void Reset(const std::string& jsonPointer);
108 
114  json GetInit();
115 
125  void SaveInit(const std::vector<std::string>& pointers = {});
126 
134  std::string GetInitStatus();
135 
145  void Lock(const std::string& password);
146 
154  void Unlock(const std::string& password);
155 
162  std::vector<PortInfo> Ports();
163 
171  PortInfo Port(const std::string& port);
172 
178  json GetDiagnostic();
179 
186  json GetDiagnosticFilterSchema();
187 
195  json GetDiagnosticFiltered(json filter);
196 
197  void Reboot(
198  const boot_mode& mode = ifm3d::Device::boot_mode::PRODUCTIVE) override;
199 
203  void RebootToRecovery();
204 
205  device_family WhoAmI() override;
206  ifm3d::Device::swu_version SwUpdateVersion() override;
207 
212  json ToJSON() override;
213 
218  void FromJSON(const json& j) override;
219 
220  private:
221  class Impl;
222  std::unique_ptr<Impl> pImpl;
223  }; // end: class O3R
224 }
225 #endif // IFM3D_DEVICE_O3R_H
ifm3d::json
Definition: json.hpp:128
ifm3d::Device::boot_mode
boot_mode
Device boot up modes:
Definition: device.h:141
ifm3d::Device
Definition: device.h:130
ifm3d::PortInfo
Definition: o3r.h:16
ifm3d::O3R
Definition: o3r.h:27