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 
15  struct IFM3D_DEVICE_EXPORT PortInfo
16  {
17  std::string port;
18  uint16_t pcic_port;
19  std::string type;
20  };
21 
25  class IFM3D_DEVICE_EXPORT O3R : public Device
26  {
27  public:
28  using Ptr = std::shared_ptr<O3R>;
29  O3R(const std::string& ip = ifm3d::DEFAULT_IP,
30  const std::uint16_t xmlrpc_port = ifm3d::DEFAULT_XMLRPC_PORT);
31 
32  virtual ~O3R();
33  O3R(O3R&&) = delete;
34  O3R& operator=(O3R&&) = delete;
35  O3R(O3R&) = delete;
36  O3R& operator=(O3R&) = delete;
37 
45  virtual void FactoryReset(bool keepNetworkSettings);
46 
52  json GetSchema();
53 
63  json Get(
64  const std::vector<std::string>& path = std::vector<std::string>());
65 
74  json ResolveConfig(const json::json_pointer& ptr);
75 
82  void Set(const json& j);
83 
93  void Remove(const std::string& jsonPointer);
94 
103  void Reset(const std::string& jsonPointer);
104 
110  json GetInit();
111 
116  void SaveInit();
117 
123  std::string GetInitStatus();
124 
130  void Lock(const std::string& password);
131 
139  void Unlock(const std::string& password);
140 
146  std::vector<PortInfo> Ports();
147 
155  PortInfo Port(const std::string& port);
156 
162  json GetDiagnostic();
163 
170  json GetDiagnosticFilterSchema();
171 
179  json GetDiagnosticFiltered(json filter);
180 
181  void Reboot(
182  const boot_mode& mode = ifm3d::Device::boot_mode::PRODUCTIVE) override;
183 
187  void RebootToRecovery();
188 
189  device_family WhoAmI() override;
190  ifm3d::Device::swu_version SwUpdateVersion() override;
191 
196  json ToJSON() override;
197 
202  void FromJSON(const json& j) override;
203 
204  private:
205  class Impl;
206  std::unique_ptr<Impl> pImpl;
207  }; // end: class O3R
208 }
209 #endif // IFM3D_DEVICE_O3R_H
ifm3d::json
Definition: json.hpp:126
ifm3d::Device::boot_mode
boot_mode
Definition: device.h:140
ifm3d::Device
Definition: device.h:129
ifm3d::PortInfo
Definition: o3r.h:15
ifm3d::O3R
Definition: o3r.h:25