6 #ifndef IFM3D_DEVICE_O3R_H
7 #define IFM3D_DEVICE_O3R_H
9 #include <ifm3d/common/features.h>
10 #include <ifm3d/device/device.h>
12 #ifdef BUILD_MODULE_CRYPTO
13 # include <ifm3d/crypto/crypto.h>
15 #include <ifm3d/device/pcic_command.h>
16 #include <initializer_list>
21 static const int NET_WAIT_O3R_SET =
22 std::getenv(
"IFM3D_NET_WAIT_O3R_SET") ==
nullptr ?
24 std::stoi(std::getenv(
"IFM3D_NET_WAIT_O3R_SET"));
34 #ifdef BUILD_MODULE_CRYPTO
45 using Ptr = std::shared_ptr<O3R>;
46 O3R(
const std::string& ip = ifm3d::DEFAULT_IP,
47 std::uint16_t xmlrpc_port = ifm3d::DEFAULT_XMLRPC_PORT);
51 O3R& operator=(
O3R&&) =
delete;
53 O3R& operator=(
O3R&) =
delete;
84 std::variant<std::monostate, std::string, std::vector<std::string>>
111 const std::vector<std::string>& path = std::vector<std::string>());
141 void Remove(
const std::string& json_pointer);
152 void Reset(
const std::string& json_pointer);
170 void SaveInit(
const std::vector<std::string>& pointers = {});
179 std::string GetInitStatus();
190 void Lock(
const std::string& password);
199 void Unlock(
const std::string& password);
243 const BootMode& mode = ifm3d::Device::BootMode::PRODUCTIVE)
override;
265 void DownloadServiceReport(
const std::string& out_file);
267 #ifdef BUILD_MODULE_CRYPTO
272 std::shared_ptr<O3RSealedBox>
SealedBox();
277 enum Parameter : uint16_t
279 ODS_OVERHANGING_LOAD = 2003,
281 ODS_MAXIMUM_HEIGHT = 2102,
282 ODS_MOTION_DATA = 2103,
283 PDS_GET_PALLET = 2200,
286 PDS_VOL_CHECK = 2203,
290 std::vector<std::uint8_t> data;
294 std::vector<std::uint8_t> parameter_data)
296 data(std::move(parameter_data))
299 std::vector<std::uint8_t>
302 std::vector<std::uint8_t> payload;
305 payload.push_back(
static_cast<uint8_t
>(
'f'));
308 std::ostringstream param;
309 param << std::setw(5) << std::setfill(
'0')
310 <<
static_cast<uint16_t
>(parameter);
311 const std::string paramStr = param.str();
312 payload.insert(payload.end(), paramStr.begin(), paramStr.end());
315 const std::string reserved =
"#00000";
316 payload.insert(payload.end(), reserved.begin(), reserved.end());
319 payload.insert(payload.end(), data.begin(), data.end());
327 std::shared_ptr<Impl> _impl;
329 #ifdef BUILD_MODULE_CRYPTO
330 friend class O3RSealedBox;
334 #ifdef BUILD_MODULE_CRYPTO
342 class IFM3D_EXPORT O3RSealedBox
345 using Ptr = std::shared_ptr<O3RSealedBox>;
347 O3RSealedBox(
const O3RSealedBox&) =
default;
348 O3RSealedBox(O3RSealedBox&&) =
delete;
349 O3RSealedBox& operator=(
const O3RSealedBox&) =
default;
350 O3RSealedBox& operator=(O3RSealedBox&&) =
delete;
351 O3RSealedBox(std::shared_ptr<O3R::Impl> p_impl);
361 void SetPassword(
const std::string& new_password,
362 std::optional<std::string> old_password = std::nullopt);
369 bool IsPasswordProtected();
376 void RemovePassword(std::string password);
385 void Set(
const std::string& password,
const json& configuration);
393 std::vector<uint8_t> GetPublicKey();
396 std::shared_ptr<O3R::Impl> _impl;
Software interface to an ifm 3D device.
Definition: device.h:134
BootMode
Device boot up modes:
Definition: device.h:145
Device specialization for O3R.
Definition: o3r.h:43
void Reset(const std::string &json_pointer)
Sets the default value of an object inside the JSON.
void Set(const json &j)
Overwrites parts of the temporary JSON configuration which is achieved by merging the provided JSON f...
json GetInit()
Return the initial JSON configuration.
json GetDiagnosticFilterSchema()
Returns the JSON schema for the filter expression provided to the getFiltered() method.
json GetSchema()
Return the current JSON schema configuration.
json GetSchema(std::initializer_list< std::string > pointers)
Returns the current JSON schema configuration or a subset of it.
void SaveInit(const std::vector< std::string > &pointers={})
Save to current temporary JSON configuration as initial JSON configuration, so it will be applied wit...
json ResolveConfig(const json::json_pointer &ptr)
Returns a part of the configuration formatted as JSON based on a JSON pointer.
void Remove(const std::string &json_pointer)
Removes an object from the JSON.
json Get(const std::vector< std::string > &path=std::vector< std::string >())
Returns the configuration formatted as JSON based on a path.
void Reboot(const BootMode &mode=ifm3d::Device::BootMode::PRODUCTIVE) override
Reboot the device.
void RebootToRecovery()
Reboot the device into Recovery Mode.
virtual void FactoryReset(bool keep_network_settings)
Sets the device configuration back to the state in which it shipped from the ifm factory.
json ToJSON() override
Serializes the state of the device to JSON.
DeviceFamily WhoAmI() override
This function can be used to retrieve the family of the connected device.
void FromJSON(const json &j) override
Configures the device based on the parameter values of the passed in JSON.
std::vector< PortInfo > Ports()
Returns a list containing information about all connected physical and application ports.
ifm3d::Device::SWUVersion SwUpdateVersion() override
Checks the swupdater version supported by device.
json GetDiagnosticFiltered(const json &filter)
Returns the content of the diagnostic memory formatted in JSON and filtered according to the JSON fil...
PortInfo Port(const std::string &port)
Returns information about a given physical or application port.
json GetDiagnostic()
Returns the content of the diagnostic memory formatted in JSON.
json GetSchema(std::variant< std::monostate, std::string, std::vector< std::string >> pointers)
Returns the current JSON schema configuration or a subset of it.
Definition: pcic_command.h:11
std::vector< std::uint8_t > SerializeData() const override
Serialize the command into a sequence of bytes for PCIC transmission.
Definition: o3r.h:300