-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The blob #12661
Merged
Merged
The blob #12661
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6af960e
add blob, blob-msg
maloel c9119c7
add py blob
maloel 317e4bf
topic-send --blob
maloel 7953d1a
add dfu to dds-topic-names.h
maloel a9c0e1f
add rs-fw-update --sw-only, --debug, --dds-domain
maloel 3246940
add last FW version to update_device
maloel 928c435
add recovery info to dds-adapter device-info
maloel c4d9259
use FW-UPDATE-ID in rs2::device::operator<() to support update devices
maloel 23403ba
add dfu messages to topic-names
maloel b2dc008
centralize device_info key names inside class
maloel e6367bd
make fw-update interfaces actual interfaces
maloel e830af4
rs2_check_firmware_compatibility now works on update_device, too
maloel a316159
add device-server::broadcast-disconnect()
maloel b6536fa
fw-update-capable dds devices (signed only)
maloel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2023 Intel Corporation. All Rights Reserved. | ||
#pragma once | ||
|
||
#include "blob/blob.h" | ||
#include <realdds/dds-defines.h> | ||
|
||
#include <string> | ||
#include <memory> | ||
#include <vector> | ||
|
||
|
||
namespace eprosima { | ||
namespace fastdds { | ||
namespace dds { | ||
struct SampleInfo; | ||
} | ||
} // namespace fastdds | ||
} // namespace eprosima | ||
|
||
|
||
namespace udds { | ||
class blobPubSubType; | ||
} // namespace raw | ||
|
||
|
||
namespace realdds { | ||
|
||
|
||
class dds_participant; | ||
class dds_topic; | ||
class dds_topic_reader; | ||
class dds_topic_writer; | ||
|
||
|
||
namespace topics { | ||
|
||
|
||
class blob_msg : public udds::blob | ||
{ | ||
public: | ||
using type = udds::blobPubSubType; | ||
|
||
blob_msg() = default; | ||
blob_msg( std::vector< uint8_t > && data_ ) { data( std::move( data_ ) ); } | ||
|
||
bool is_valid() const { return ! data().empty(); } | ||
void invalidate() { data().clear(); } | ||
|
||
static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, | ||
char const * topic_name ); | ||
static std::shared_ptr< dds_topic > create_topic( std::shared_ptr< dds_participant > const & participant, | ||
std::string const & topic_name ) | ||
{ | ||
return create_topic( participant, topic_name.c_str() ); | ||
} | ||
|
||
// This helper method will take the next sample from a reader. | ||
// | ||
// Returns true if successful. Make sure you still check is_valid() in case the sample info isn't! | ||
// Returns false if no more data is available. | ||
// Will throw if an unexpected error occurs. | ||
// | ||
static bool take_next( dds_topic_reader &, | ||
blob_msg * output, | ||
eprosima::fastdds::dds::SampleInfo * optional_info = nullptr ); | ||
|
||
// Returns some unique (to the writer) identifier for the sample that was sent, or 0 if unsuccessful | ||
dds_sequence_number write_to( dds_topic_writer & ) const; | ||
|
||
// Cast the raw data to the desired type | ||
template< typename T > | ||
T const * custom_data() const | ||
{ | ||
return data().size() > 0 ? reinterpret_cast< T const * >( data().data() ) : nullptr; | ||
} | ||
template< typename T > | ||
T * custom_data() | ||
{ | ||
return data().size() > 0 ? reinterpret_cast< T * >( data().data() ) : nullptr; | ||
} | ||
}; | ||
|
||
|
||
} // namespace topics | ||
} // namespace realdds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2023 Intel Corporation. All Rights Reserved. | ||
|
||
/*! | ||
* @file blob.h | ||
* This header file contains the declaration of the described types in the IDL file. | ||
* | ||
* This file was generated by the tool gen. | ||
*/ | ||
|
||
#ifndef _FAST_DDS_GENERATED_UDDS_BLOB_H_ | ||
#define _FAST_DDS_GENERATED_UDDS_BLOB_H_ | ||
|
||
|
||
//#include <fastrtps/utils/fixed_size_string.hpp> | ||
|
||
#include <stdint.h> | ||
#include <array> | ||
#include <string> | ||
#include <vector> | ||
#include <map> | ||
#include <bitset> | ||
|
||
#if defined(_WIN32) | ||
#if defined(EPROSIMA_USER_DLL_EXPORT) | ||
#define eProsima_user_DllExport __declspec( dllexport ) | ||
#else | ||
#define eProsima_user_DllExport | ||
#endif // EPROSIMA_USER_DLL_EXPORT | ||
#else | ||
#define eProsima_user_DllExport | ||
#endif // _WIN32 | ||
|
||
#if defined(_WIN32) | ||
#if defined(EPROSIMA_USER_DLL_EXPORT) | ||
#if defined(blob_SOURCE) | ||
#define blob_DllAPI __declspec( dllexport ) | ||
#else | ||
#define blob_DllAPI __declspec( dllimport ) | ||
#endif // blob_SOURCE | ||
#else | ||
#define blob_DllAPI | ||
#endif // EPROSIMA_USER_DLL_EXPORT | ||
#else | ||
#define blob_DllAPI | ||
#endif // _WIN32 | ||
|
||
namespace eprosima { | ||
namespace fastcdr { | ||
class Cdr; | ||
} // namespace fastcdr | ||
} // namespace eprosima | ||
|
||
|
||
namespace udds { | ||
/*! | ||
* @brief This class represents the structure blob defined by the user in the IDL file. | ||
* @ingroup BLOB | ||
*/ | ||
class blob | ||
{ | ||
public: | ||
|
||
/*! | ||
* @brief Default constructor. | ||
*/ | ||
eProsima_user_DllExport blob(); | ||
|
||
/*! | ||
* @brief Default destructor. | ||
*/ | ||
eProsima_user_DllExport ~blob(); | ||
|
||
/*! | ||
* @brief Copy constructor. | ||
* @param x Reference to the object udds::blob that will be copied. | ||
*/ | ||
eProsima_user_DllExport blob( | ||
const blob& x); | ||
|
||
/*! | ||
* @brief Move constructor. | ||
* @param x Reference to the object udds::blob that will be copied. | ||
*/ | ||
eProsima_user_DllExport blob( | ||
blob&& x) noexcept; | ||
|
||
/*! | ||
* @brief Copy assignment. | ||
* @param x Reference to the object udds::blob that will be copied. | ||
*/ | ||
eProsima_user_DllExport blob& operator =( | ||
const blob& x); | ||
|
||
/*! | ||
* @brief Move assignment. | ||
* @param x Reference to the object udds::blob that will be copied. | ||
*/ | ||
eProsima_user_DllExport blob& operator =( | ||
blob&& x) noexcept; | ||
|
||
/*! | ||
* @brief Comparison operator. | ||
* @param x udds::blob object to compare. | ||
*/ | ||
eProsima_user_DllExport bool operator ==( | ||
const blob& x) const; | ||
|
||
/*! | ||
* @brief Comparison operator. | ||
* @param x udds::blob object to compare. | ||
*/ | ||
eProsima_user_DllExport bool operator !=( | ||
const blob& x) const; | ||
|
||
/*! | ||
* @brief This function copies the value in member data | ||
* @param _data New value to be copied in member data | ||
*/ | ||
eProsima_user_DllExport void data( | ||
const std::vector<uint8_t>& _data); | ||
|
||
/*! | ||
* @brief This function moves the value in member data | ||
* @param _data New value to be moved in member data | ||
*/ | ||
eProsima_user_DllExport void data( | ||
std::vector<uint8_t>&& _data); | ||
|
||
/*! | ||
* @brief This function returns a constant reference to member data | ||
* @return Constant reference to member data | ||
*/ | ||
eProsima_user_DllExport const std::vector<uint8_t>& data() const; | ||
|
||
/*! | ||
* @brief This function returns a reference to member data | ||
* @return Reference to member data | ||
*/ | ||
eProsima_user_DllExport std::vector<uint8_t>& data(); | ||
|
||
/*! | ||
* @brief This function returns the maximum serialized size of an object | ||
* depending on the buffer alignment. | ||
* @param current_alignment Buffer alignment. | ||
* @return Maximum serialized size. | ||
*/ | ||
eProsima_user_DllExport static size_t getMaxCdrSerializedSize( | ||
size_t current_alignment = 0); | ||
|
||
/*! | ||
* @brief This function returns the serialized size of a data depending on the buffer alignment. | ||
* @param data Data which is calculated its serialized size. | ||
* @param current_alignment Buffer alignment. | ||
* @return Serialized size. | ||
*/ | ||
eProsima_user_DllExport static size_t getCdrSerializedSize( | ||
const udds::blob& data, | ||
size_t current_alignment = 0); | ||
|
||
|
||
/*! | ||
* @brief This function serializes an object using CDR serialization. | ||
* @param cdr CDR serialization object. | ||
*/ | ||
eProsima_user_DllExport void serialize( | ||
eprosima::fastcdr::Cdr& cdr) const; | ||
|
||
/*! | ||
* @brief This function deserializes an object using CDR serialization. | ||
* @param cdr CDR serialization object. | ||
*/ | ||
eProsima_user_DllExport void deserialize( | ||
eprosima::fastcdr::Cdr& cdr); | ||
|
||
|
||
|
||
/*! | ||
* @brief This function returns the maximum serialized size of the Key of an object | ||
* depending on the buffer alignment. | ||
* @param current_alignment Buffer alignment. | ||
* @return Maximum serialized size. | ||
*/ | ||
eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( | ||
size_t current_alignment = 0); | ||
|
||
/*! | ||
* @brief This function tells you if the Key has been defined for this type | ||
*/ | ||
eProsima_user_DllExport static bool isKeyDefined(); | ||
|
||
/*! | ||
* @brief This function serializes the key members of an object using CDR serialization. | ||
* @param cdr CDR serialization object. | ||
*/ | ||
eProsima_user_DllExport void serializeKey( | ||
eprosima::fastcdr::Cdr& cdr) const; | ||
|
||
private: | ||
|
||
std::vector<uint8_t> m_data; | ||
}; | ||
} // namespace udds | ||
|
||
#endif // _FAST_DDS_GENERATED_UDDS_BLOB_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2023 Intel Corporation. All Rights Reserved. | ||
|
||
module udds | ||
{ | ||
struct blob | ||
{ | ||
sequence<octet> data; | ||
}; | ||
}; |
93 changes: 93 additions & 0 deletions
93
third-party/realdds/include/realdds/topics/blob/blobPubSubTypes.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2023 Intel Corporation. All Rights Reserved. | ||
|
||
/*! | ||
* @file blobPubSubTypes.h | ||
* This header file contains the declaration of the serialization functions. | ||
* | ||
* This file was generated by the tool fastcdrgen. | ||
*/ | ||
|
||
|
||
#ifndef _FAST_DDS_GENERATED_UDDS_BLOB_PUBSUBTYPES_H_ | ||
#define _FAST_DDS_GENERATED_UDDS_BLOB_PUBSUBTYPES_H_ | ||
|
||
#include <fastdds/dds/topic/TopicDataType.hpp> | ||
#include <fastrtps/utils/md5.h> | ||
|
||
#include "blob.h" | ||
|
||
#if !defined(GEN_API_VER) || (GEN_API_VER != 1) | ||
#error \ | ||
Generated blob is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. | ||
#endif // GEN_API_VER | ||
|
||
namespace udds | ||
{ | ||
/*! | ||
* @brief This class represents the TopicDataType of the type blob defined by the user in the IDL file. | ||
* @ingroup BLOB | ||
*/ | ||
class blobPubSubType : public eprosima::fastdds::dds::TopicDataType | ||
{ | ||
public: | ||
|
||
typedef blob type; | ||
|
||
eProsima_user_DllExport blobPubSubType(); | ||
|
||
eProsima_user_DllExport virtual ~blobPubSubType() override; | ||
|
||
eProsima_user_DllExport virtual bool serialize( | ||
void* data, | ||
eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; | ||
|
||
eProsima_user_DllExport virtual bool deserialize( | ||
eprosima::fastrtps::rtps::SerializedPayload_t* payload, | ||
void* data) override; | ||
|
||
eProsima_user_DllExport virtual std::function<uint32_t()> getSerializedSizeProvider( | ||
void* data) override; | ||
|
||
eProsima_user_DllExport virtual bool getKey( | ||
void* data, | ||
eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, | ||
bool force_md5 = false) override; | ||
|
||
eProsima_user_DllExport virtual void* createData() override; | ||
|
||
eProsima_user_DllExport virtual void deleteData( | ||
void* data) override; | ||
|
||
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED | ||
eProsima_user_DllExport inline bool is_bounded() const override | ||
{ | ||
return false; | ||
} | ||
|
||
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED | ||
|
||
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN | ||
eProsima_user_DllExport inline bool is_plain() const override | ||
{ | ||
return false; | ||
} | ||
|
||
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN | ||
|
||
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE | ||
eProsima_user_DllExport inline bool construct_sample( | ||
void* memory) const override | ||
{ | ||
(void)memory; | ||
return false; | ||
} | ||
|
||
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE | ||
|
||
MD5 m_md5; | ||
unsigned char* m_keyBuffer; | ||
}; | ||
} | ||
|
||
#endif // _FAST_DDS_GENERATED_UDDS_BLOB_PUBSUBTYPES_H_ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is
udds
? For other topics we usedraw
namespace.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the topic they had built in. We can talk about it.