Repository navigation
move notification out of device; more generic; uses json - #11042
Conversation
…be added only when stopped
About the data side, I saw a d4xx device with more than 200 profiles, So you say you have currently 5034/6741 but the limit is 4096? |
|
|
||
| // Forward declaration | ||
| namespace topics { | ||
| class notification; |
There was a problem hiding this comment.
Can you explain when is a topic "raw"?
Why is device_info raw but notification not?
There was a problem hiding this comment.
This is the non-raw notification you're looking at. There's a raw::notification, too
| { | ||
| module raw | ||
| { | ||
| module device |
There was a problem hiding this comment.
Notification topic name does not include the device name? e.g. /realsense/D455/notification?
There was a problem hiding this comment.
Topic name? Not sure what you mean. This is a general-purpose notification topic. What does it have to do with a device?
| static void construct_raw_message( msg_type msg_id, const T& msg, raw::device::notification& raw_msg ) | ||
| // Get the custom data with casting to the desired type | ||
| // Syntax: auto stream_info = msg.get< STREAM_INFO >(); | ||
| // if ( msg ) do something with it; |
There was a problem hiding this comment.
Not sure I understand. What is get? Shouldn't it be
// Syntax: auto stream_info = msg.custom_data< STREAM_INFO >();
// if ( stream_info ) do something with it;
There was a problem hiding this comment.
Copy paste issue - get was renamed to custom_data. I'll update.
| using type = raw::device::notificationPubSubType; | ||
| using type = raw::notificationPubSubType; | ||
|
|
||
| enum class data_type |
There was a problem hiding this comment.
I think data_formatting will be a better name
There was a problem hiding this comment.
It's the type of the data... data_format is OK I guess but why?
There was a problem hiding this comment.
Sounds better to me :-)
Data type might mean other stuff as well. Format just means "the way in which something is arranged or set out."
Also when looking JSON and CBOR, wikipedia specifies they are data formats
| ~dds_notification_server(); | ||
|
|
||
| // By default we're not started, to avoid on-discovery before all discovery messages have been collected | ||
| void start(); |
There was a problem hiding this comment.
In other classes it is called run()
| "more streams than expected (" + std::to_string( n_streams_expected ) | ||
| + ") received" ); | ||
| auto type = utilities::json::get< std::string >( j, "type" ); | ||
| auto stream_name = utilities::json::get< std::string >( j, "name" ); |
There was a problem hiding this comment.
Are the messages defined somewhere, like a readme? Can we pass it to Yoram's group so they will know what we expect?
There was a problem hiding this comment.
Sure, eventually. :)
There was a problem hiding this comment.
Just making sure, this PR still keeps the profiles transfer works server --> client right?
There was a problem hiding this comment.
What other option is there? Everything is always server --> client...
There was a problem hiding this comment.
I mean that the functionality still works? like before this PR?
There was a problem hiding this comment.
Unit-tests pass. Functionality is still there. Notifications are sent, processed, etc. and streams are created on the client.
I don't understand the question, I guess.
| profiles += sp->to_json(); | ||
| json msg = { | ||
| { "id", "stream-header" }, | ||
| { "type", stream->profiles().front()->type_to_string() }, |
There was a problem hiding this comment.
To support rs2 features we will need to add a dds_stream_xxx type system and a conversion back to rs2_stream+index (like we convert dds_stream_format to and from rs2_format)
This will be able to replace the changes I made in my PR ( #11045, you did add some comments about it)
There was a problem hiding this comment.
Will also need some factory to create all the different stream types
There was a problem hiding this comment.
Once both our PRs are in, I'll add all the other classes
| auto & stream = _streams[stream_name]; | ||
| if( stream ) | ||
| DDS_THROW( runtime_error, "stream '" + stream_name + "' already exists" ); | ||
| stream = std::make_shared< dds_video_stream >( stream_name, sensor_name ); |
There was a problem hiding this comment.
Hard to see in this UI
Where is dds_motion_stream created?
There was a problem hiding this comment.
This was a bug. Once we have it working we need to add some unit-tests with motion streams...
There was a problem hiding this comment.
Added a test-case.
Moved profile type_to_string() into stream-base type_string().
Added type-check: when creating a stream in device-impl, it checks that its type is now the same as that given in the json.
There's still a
uidbut it's no longer transmitted with profiles. To be removed in another PR.Notifications are now
topics::notification(no longer insidedevice::).Notifications now primarily have a
data_typeandversion, nothing else. Thedatacan be in the format specified in thedata_type(which currently supportsCUSTOM,JSON, andCBOR). The data is bound at4096bytes (from what I saw in the code, it was at 100 before, but that obviously wasn't a limit -- this needs more looking into). Testing shows that, for a L515, the color stream has the most profiles (114) and this comes out to6741in raw json or5034in CBOR.Notifications now communicate using JSON. This code mostly resides in the device and device-server. Should be a lot more flexible.
Additionally:
guard against device-server::init() failures
add L515 stream-format
move expected stream number out of device-impl (only used in init())
notification-server no longer starts automatically; on-discovery notifications can only be added when stopped
change device destruction in device-watcher to another thread