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 =
14  std::getenv("IFM3D_NET_WAIT_O3R_SET") == nullptr ?
15  15000 :
16  std::stoi(std::getenv("IFM3D_NET_WAIT_O3R_SET"));
17 
19  struct IFM3D_EXPORT PortInfo
20  {
21  std::string port;
22  uint16_t pcic_port;
23  std::string type;
24  };
25 
30  class IFM3D_EXPORT O3R : public Device
31  {
32  public:
33  using Ptr = std::shared_ptr<O3R>;
34  O3R(const std::string& ip = ifm3d::DEFAULT_IP,
35  const std::uint16_t xmlrpc_port = ifm3d::DEFAULT_XMLRPC_PORT);
36 
37  virtual ~O3R();
38  O3R(O3R&&) = delete;
39  O3R& operator=(O3R&&) = delete;
40  O3R(O3R&) = delete;
41  O3R& operator=(O3R&) = delete;
42 
50  virtual void FactoryReset(bool keepNetworkSettings);
51 
57  json GetSchema();
58 
68  json Get(
69  const std::vector<std::string>& path = std::vector<std::string>());
70 
79  json ResolveConfig(const json::json_pointer& ptr);
80 
88  void Set(const json& j);
89 
99  void Remove(const std::string& jsonPointer);
100 
110  void Reset(const std::string& jsonPointer);
111 
117  json GetInit();
118 
128  void SaveInit(const std::vector<std::string>& pointers = {});
129 
137  std::string GetInitStatus();
138 
148  void Lock(const std::string& password);
149 
157  void Unlock(const std::string& password);
158 
165  std::vector<PortInfo> Ports();
166 
174  PortInfo Port(const std::string& port);
175 
181  json GetDiagnostic();
182 
189  json GetDiagnosticFilterSchema();
190 
198  json GetDiagnosticFiltered(json filter);
199 
200  void Reboot(
201  const boot_mode& mode = ifm3d::Device::boot_mode::PRODUCTIVE) override;
202 
206  void RebootToRecovery();
207 
208  device_family WhoAmI() override;
209  ifm3d::Device::swu_version SwUpdateVersion() override;
210 
215  json ToJSON() override;
216 
221  void FromJSON(const json& j) override;
222 
223  void DownloadServiceReport();
224 
225  private:
226  class Impl;
227  std::unique_ptr<Impl> pImpl;
228  }; // end: class O3R
229 }
230 #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:19
ifm3d::O3R
Definition: o3r.h:30