if (message->default_cs) {
bt_clock_snapshot_recycle(message->default_cs);
+ message->default_cs = NULL;
}
g_free(message);
struct bt_message *bt_message_inactivity_create(
struct bt_self_message_iterator *self_msg_iter,
- struct bt_clock_class *default_clock_class)
+ const struct bt_clock_class *default_clock_class)
{
struct bt_self_component_port_input_message_iterator *msg_iter =
(void *) self_msg_iter;
BT_MESSAGE_TYPE_INACTIVITY,
bt_message_inactivity_destroy, NULL);
ret_msg = &message->parent;
- message->default_cs = bt_clock_snapshot_create(default_clock_class);
+ message->default_cs = bt_clock_snapshot_create(
+ (void *) default_clock_class);
if (!message->default_cs) {
goto error;
}
BT_ASSERT_PRE_NON_NULL(msg, "Message");
BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_INACTIVITY);
BT_ASSERT_PRE_HOT(msg, "Message", ": %!+n", msg);
- bt_clock_snapshot_set_value_inline(inactivity->default_cs, value_cycles);
+ bt_clock_snapshot_set_raw_value(inactivity->default_cs, value_cycles);
BT_LIB_LOGV("Set inactivity message's default clock snapshot: "
"%![msg-]+n, value=%" PRIu64, msg, value_cycles);
}
-const struct bt_clock_snapshot *
+extern enum bt_clock_snapshot_state
bt_message_inactivity_borrow_default_clock_snapshot_const(
- const struct bt_message *msg)
+ const bt_message *msg, const bt_clock_snapshot **snapshot)
{
struct bt_message_inactivity *inactivity = (void *) msg;
BT_ASSERT_PRE_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_NON_NULL(snapshot, "Clock snapshot (output)");
BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_INACTIVITY);
- return inactivity->default_cs;
+ *snapshot = inactivity->default_cs;
+ return BT_CLOCK_SNAPSHOT_STATE_KNOWN;
}