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>
23 static const int NET_WAIT_O3R_SET =
24 std::getenv(
"IFM3D_NET_WAIT_O3R_SET") ==
nullptr ?
26 std::stoi(std::getenv(
"IFM3D_NET_WAIT_O3R_SET"));
70 std::optional<RtspInfo>
rtsp;
73 #ifdef BUILD_MODULE_CRYPTO
84 using Ptr = std::shared_ptr<O3R>;
85 O3R(
const std::string& ip = ifm3d::DEFAULT_IP,
86 std::uint16_t xmlrpc_port = ifm3d::DEFAULT_XMLRPC_PORT);
90 O3R& operator=(
O3R&&) =
delete;
92 O3R& operator=(
O3R&) =
delete;
123 std::variant<std::monostate, std::string, std::vector<std::string>>
150 const std::vector<std::string>& path = std::vector<std::string>());
180 void Remove(
const std::string& json_pointer);
191 void Reset(
const std::string& json_pointer);
209 void SaveInit(
const std::vector<std::string>& pointers = {});
218 std::string GetInitStatus();
229 void Lock(
const std::string& password);
238 void Unlock(
const std::string& password);
282 const BootMode& mode = ifm3d::Device::BootMode::PRODUCTIVE)
override;
304 void DownloadServiceReport(
const std::string& out_file);
306 #ifdef BUILD_MODULE_CRYPTO
311 std::shared_ptr<O3RSealedBox>
SealedBox();
316 enum Parameter : uint16_t
318 ODS_OVERHANGING_LOAD = 2003,
320 ODS_MAXIMUM_HEIGHT = 2102,
321 ODS_MOTION_DATA = 2103,
322 PDS_GET_PALLET = 2200,
325 PDS_VOL_CHECK = 2203,
329 std::vector<std::uint8_t> data;
333 std::vector<std::uint8_t> parameter_data)
335 data(std::move(parameter_data))
338 std::vector<std::uint8_t>
341 std::vector<std::uint8_t> payload;
344 payload.push_back(
static_cast<uint8_t
>(
'f'));
347 std::ostringstream param;
348 param << std::setw(5) << std::setfill(
'0')
349 <<
static_cast<uint16_t
>(parameter);
350 const std::string paramStr = param.str();
351 payload.insert(payload.end(), paramStr.begin(), paramStr.end());
354 const std::string reserved =
"#00000";
355 payload.insert(payload.end(), reserved.begin(), reserved.end());
358 payload.insert(payload.end(), data.begin(), data.end());
366 std::shared_ptr<Impl> _impl;
368 #ifdef BUILD_MODULE_CRYPTO
369 friend class O3RSealedBox;
373 #ifdef BUILD_MODULE_CRYPTO
381 class IFM3D_EXPORT O3RSealedBox
384 using Ptr = std::shared_ptr<O3RSealedBox>;
386 O3RSealedBox(
const O3RSealedBox&) =
default;
387 O3RSealedBox(O3RSealedBox&&) =
delete;
388 O3RSealedBox& operator=(
const O3RSealedBox&) =
default;
389 O3RSealedBox& operator=(O3RSealedBox&&) =
delete;
390 O3RSealedBox(std::shared_ptr<O3R::Impl> p_impl);
400 void SetPassword(
const std::string& new_password,
401 std::optional<std::string> old_password = std::nullopt);
408 bool IsPasswordProtected();
415 void RemovePassword(std::string password);
424 void Set(
const std::string& password,
const json& configuration);
432 std::vector<uint8_t> GetPublicKey();
435 std::shared_ptr<O3R::Impl> _impl;
Software interface to an ifm 3D device.
Definition: device.h:136
BootMode
Device boot up modes:
Definition: device.h:147
Device specialization for O3R.
Definition: o3r.h:82
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:339
std::optional< RtspInfo > rtsp
RTSP streaming information, present when the port advertises it.
Definition: o3r.h:70
RTSP control endpoint information for a port.
Definition: o3r.h:33
uint16_t tcp_port
TCP port the RTSP control channel is served on.
Definition: o3r.h:35
RTSP streaming information advertised by a port.
Definition: o3r.h:53
std::vector< RtspMediaEndpoint > media_endpoints
Media endpoints exposed by the port.
Definition: o3r.h:57
RtspControlInfo control
RTSP control channel information.
Definition: o3r.h:55
std::vector< std::string > supported_transports
Transports supported by the RTSP server (e.g.
Definition: o3r.h:60