6 #ifndef IFM3D_DEVICE_O3R_H
7 #define IFM3D_DEVICE_O3R_H
9 #include <ifm3d/common/features.h>
10 #include <ifm3d/device/device.h>
11 #ifdef BUILD_MODULE_CRYPTO
12 # include <ifm3d/crypto/crypto.h>
17 static const int NET_WAIT_O3R_SET =
18 std::getenv(
"IFM3D_NET_WAIT_O3R_SET") ==
nullptr ?
20 std::stoi(std::getenv(
"IFM3D_NET_WAIT_O3R_SET"));
30 #ifdef BUILD_MODULE_CRYPTO
41 using Ptr = std::shared_ptr<O3R>;
42 O3R(
const std::string& ip = ifm3d::DEFAULT_IP,
43 const std::uint16_t xmlrpc_port = ifm3d::DEFAULT_XMLRPC_PORT);
47 O3R& operator=(
O3R&&) =
delete;
49 O3R& operator=(
O3R&) =
delete;
58 virtual void FactoryReset(
bool keepNetworkSettings);
77 const std::vector<std::string>& path = std::vector<std::string>());
87 json ResolveConfig(
const json::json_pointer& ptr);
96 void Set(
const json& j);
107 void Remove(
const std::string& jsonPointer);
118 void Reset(
const std::string& jsonPointer);
136 void SaveInit(
const std::vector<std::string>& pointers = {});
145 std::string GetInitStatus();
156 void Lock(
const std::string& password);
165 void Unlock(
const std::string& password);
173 std::vector<PortInfo> Ports();
182 PortInfo Port(
const std::string& port);
189 json GetDiagnostic();
197 json GetDiagnosticFilterSchema();
206 json GetDiagnosticFiltered(
json filter);
209 const boot_mode& mode = ifm3d::Device::boot_mode::PRODUCTIVE)
override;
214 void RebootToRecovery();
216 device_family WhoAmI()
override;
217 ifm3d::Device::swu_version SwUpdateVersion()
override;
223 json ToJSON()
override;
229 void FromJSON(
const json& j)
override;
231 void DownloadServiceReport(std::string outFile);
233 #ifdef BUILD_MODULE_CRYPTO
238 std::shared_ptr<O3RSealedBox> SealedBox();
243 std::shared_ptr<Impl> pImpl;
245 #ifdef BUILD_MODULE_CRYPTO
246 friend class O3RSealedBox;
250 #ifdef BUILD_MODULE_CRYPTO
258 class IFM3D_EXPORT O3RSealedBox
261 using Ptr = std::shared_ptr<O3RSealedBox>;
263 O3RSealedBox(std::shared_ptr<O3R::Impl> pImpl);
273 void SetPassword(
const std::string& new_password,
274 std::optional<std::string> old_password = std::nullopt);
281 bool IsPasswordProtected();
288 void RemovePassword(std::string password);
297 void Set(
const std::string& password,
const json& configuration);
305 std::vector<uint8_t> GetPublicKey();
308 std::shared_ptr<O3R::Impl> pImpl;
313 #endif // IFM3D_DEVICE_O3R_H