"field-callsite",
};
+static
+const char * const in_port_name = "in";
+
static
void destroy_pretty_data(struct pretty_component *pretty)
{
- bt_self_component_port_input_notification_iterator_put_ref(pretty->iterator);
+ bt_self_component_port_input_message_iterator_put_ref(pretty->iterator);
if (pretty->string) {
(void) g_string_free(pretty->string, TRUE);
}
static
-enum bt_self_component_status handle_notification(
+bt_self_component_status handle_message(
struct pretty_component *pretty,
- const bt_notification *notification)
+ const bt_message *message)
{
- enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+ bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
BT_ASSERT(pretty);
- switch (bt_notification_get_type(notification)) {
- case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
- if (pretty_print_packet(pretty, notification)) {
+ switch (bt_message_get_type(message)) {
+ case BT_MESSAGE_TYPE_EVENT:
+ if (pretty_print_event(pretty, message)) {
ret = BT_SELF_COMPONENT_STATUS_ERROR;
}
break;
- case BT_NOTIFICATION_TYPE_EVENT:
- if (pretty_print_event(pretty, notification)) {
+ case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
+ fprintf(stderr, "Message iterator inactivity message\n");
+ break;
+ case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
+ case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
+ if (pretty_print_discarded_items(pretty, message)) {
ret = BT_SELF_COMPONENT_STATUS_ERROR;
}
break;
- case BT_NOTIFICATION_TYPE_INACTIVITY:
- fprintf(stderr, "Inactivity notification\n");
- break;
default:
break;
}
}
BT_HIDDEN
-enum bt_self_component_status pretty_port_connected(
- bt_self_component_sink *comp,
- bt_self_component_port_input *self_port,
- const bt_port_output *other_port)
+bt_self_component_status pretty_graph_is_configured(
+ bt_self_component_sink *comp)
{
- enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
struct pretty_component *pretty;
pretty = bt_self_component_get_data(
bt_self_component_sink_as_self_component(comp));
BT_ASSERT(pretty);
BT_ASSERT(!pretty->iterator);
- pretty->iterator = bt_self_component_port_input_notification_iterator_create(
- self_port);
+ pretty->iterator = bt_self_component_port_input_message_iterator_create(
+ bt_self_component_sink_borrow_input_port_by_name(comp,
+ in_port_name));
if (!pretty->iterator) {
status = BT_SELF_COMPONENT_STATUS_NOMEM;
}
}
BT_HIDDEN
-enum bt_self_component_status pretty_consume(
+bt_self_component_status pretty_consume(
bt_self_component_sink *comp)
{
- enum bt_self_component_status ret;
- bt_notification_array_const notifs;
- bt_self_component_port_input_notification_iterator *it;
+ bt_self_component_status ret;
+ bt_message_array_const msgs;
+ bt_self_component_port_input_message_iterator *it;
struct pretty_component *pretty = bt_self_component_get_data(
bt_self_component_sink_as_self_component(comp));
- enum bt_notification_iterator_status it_ret;
+ bt_message_iterator_status it_ret;
uint64_t count = 0;
uint64_t i = 0;
it = pretty->iterator;
- it_ret = bt_self_component_port_input_notification_iterator_next(it,
- ¬ifs, &count);
+ it_ret = bt_self_component_port_input_message_iterator_next(it,
+ &msgs, &count);
switch (it_ret) {
- case BT_NOTIFICATION_ITERATOR_STATUS_OK:
+ case BT_MESSAGE_ITERATOR_STATUS_OK:
break;
- case BT_NOTIFICATION_ITERATOR_STATUS_NOMEM:
+ case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
ret = BT_SELF_COMPONENT_STATUS_NOMEM;
goto end;
- case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
+ case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
ret = BT_SELF_COMPONENT_STATUS_AGAIN;
goto end;
- case BT_NOTIFICATION_ITERATOR_STATUS_END:
+ case BT_MESSAGE_ITERATOR_STATUS_END:
ret = BT_SELF_COMPONENT_STATUS_END;
- BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
+ BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
pretty->iterator);
goto end;
default:
goto end;
}
- BT_ASSERT(it_ret == BT_NOTIFICATION_ITERATOR_STATUS_OK);
+ BT_ASSERT(it_ret == BT_MESSAGE_ITERATOR_STATUS_OK);
for (i = 0; i < count; i++) {
- ret = handle_notification(pretty, notifs[i]);
+ ret = handle_message(pretty, msgs[i]);
if (ret) {
goto end;
}
- bt_notification_put_ref(notifs[i]);
+ bt_message_put_ref(msgs[i]);
}
end:
for (; i < count; i++) {
- bt_notification_put_ref(notifs[i]);
+ bt_message_put_ref(msgs[i]);
}
return ret;
for (i = 0; i < BT_ARRAY_SIZE(plugin_options); i++) {
const char *key = plugin_options[i];
- enum bt_value_status status;
+ bt_value_status status;
status = bt_value_map_insert_entry(plugin_opt_map, key,
bt_value_null);
int apply_params(struct pretty_component *pretty, const bt_value *params)
{
int ret = 0;
- enum bt_value_status status;
+ bt_value_status status;
bool value, found;
char *str = NULL;
}
BT_HIDDEN
-enum bt_self_component_status pretty_init(
+bt_self_component_status pretty_init(
bt_self_component_sink *comp,
const bt_value *params,
UNUSED_VAR void *init_method_data)
{
- enum bt_self_component_status ret;
+ bt_self_component_status ret;
struct pretty_component *pretty = create_pretty();
if (!pretty) {
goto end;
}
- ret = bt_self_component_sink_add_input_port(comp, "in", NULL, NULL);
+ ret = bt_self_component_sink_add_input_port(comp, in_port_name,
+ NULL, NULL);
if (ret != BT_SELF_COMPONENT_STATUS_OK) {
goto end;
}