Skip to content

Commit d5ad50f

Browse files
WIP work through compile errors
Signed-off-by: Luca Della Vedova <[email protected]>
1 parent aaadbe4 commit d5ad50f

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

rclrs/src/dynamic_message/dynamic_subscription.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use super::{
99
};
1010
use crate::rcl_bindings::*;
1111
use crate::{
12+
ENTITY_LIFECYCLE_MUTEX, Waitable,
1213
Node, QoSProfile, RclReturnCode, RclrsError, ToResult, NodeHandle, WorkerCommands, WaitableLifecycle, SubscriptionHandle,
1314
};
1415

@@ -36,7 +37,7 @@ impl DynamicSubscription {
3637
/// Creates a new dynamic subscription.
3738
///
3839
/// This is not a public function, by the same rationale as `Subscription::new()`.
39-
pub(crate) fn create_dynamic<F>(
40+
pub(crate) fn new<F>(
4041
topic: &str,
4142
topic_type: &str,
4243
qos: QoSProfile,
@@ -70,7 +71,6 @@ impl DynamicSubscription {
7071
err,
7172
s: topic.into(),
7273
})?;
73-
let rcl_node = &mut *node.rcl_node_mtx.lock().unwrap();
7474

7575
// SAFETY: No preconditions for this function.
7676
let mut rcl_subscription_options = unsafe { rcl_subscription_get_default_options() };

rclrs/src/dynamic_message/message_structure.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use super::TypeErasedSequence;
55
use crate::rcl_bindings::rosidl_typesupport_introspection_c__MessageMember as rosidl_message_member_t;
66
use crate::rcl_bindings::rosidl_typesupport_introspection_c__MessageMembers as rosidl_message_members_t;
77
use crate::rcl_bindings::*;
8+
use crate::rcl_bindings::rosidl_typesupport_introspection_c_field_types::*;
89

910
/// Possible base types for fields in a message.
1011
// The field variants are self-explaining, no need to add redundant documentation.

rclrs/src/node.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -810,11 +810,10 @@ impl NodeState {
810810
where
811811
F: FnMut(DynamicMessage) + 'static + Send,
812812
{
813-
let subscription = Arc::new(DynamicSubscription::new(
814-
self, topic, topic_type, qos, callback,
815-
)?);
816-
self.subscriptions
817-
.push(Arc::downgrade(&subscription) as Weak<dyn SubscriptionBase>);
813+
let subscription = DynamicSubscription::new(
814+
topic, topic_type, qos, callback, &self.handle, self.commands.async_worker_commands(),
815+
)?;
816+
// TODO(luca) similar API to above?
818817
Ok(subscription)
819818
}
820819

rclrs/src/subscription.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ pub(crate) struct SubscriptionHandle {
329329
}
330330

331331
impl SubscriptionHandle {
332-
fn lock(&self) -> MutexGuard<rcl_subscription_t> {
332+
pub(crate) fn lock(&self) -> MutexGuard<rcl_subscription_t> {
333333
self.rcl_subscription.lock().unwrap()
334334
}
335335

0 commit comments

Comments
 (0)