Skip to content

Setting up a pubsub listener requires a lot of boilerplate code #18

@jschall

Description

@jschall

e.g.:

#include <modules/worker_thread/worker_thread.h>

WORKER_THREAD_DECLARE_EXTERN(spi3_thread)

static struct worker_thread_listener_task_s imu_delta_listener_task;
static void imu_deltas_handler(size_t msg_size, const void* buf, void* ctx);

RUN_AFTER(INIT_END) {
    worker_thread_add_listener_task(&spi3_thread, &imu_delta_listener_task, &imu_deltas_topic, imu_deltas_handler, NULL);
}

static void imu_deltas_handler(size_t msg_size, const void* buf, void* ctx) {
    const struct imu_delta_s* deltas = (const struct imu_delta_s*)buf;

    // ...
}

should be more like:

WORKER_THREAD_LISTENER(spi3_thread, imu_deltas_topic) {

}

Or something more C++-y.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions