Skip to content

v3.0.0 - suggestion - Add context argument to callbacks #320

@zfields

Description

@zfields

By adding an additional argument, void * context, to the callbacks, the callback provider can associate the callback to different endpoints. This would enable multiple streams to be managed simultaneously by the callback provider. If the user does not need or desire the context, then they will be able to provide a NULL to the context argument.

Current Implementation:

extern "C" {
  // callback function types
  typedef void (*callbackFunction)(uint8_t, int);
  typedef void (*systemCallbackFunction)(void);
  typedef void (*stringCallbackFunction)(char *);
  typedef void (*sysexCallbackFunction)(uint8_t command, uint8_t argc, uint8_t *argv);
}

Proposed Implementation:

extern "C" {
  // callback function types
  typedef void (*callbackFunction)(uint8_t, int, void *);
  typedef void (*systemCallbackFunction)(void *);
  typedef void (*stringCallbackFunction)(char *, void *);
  typedef void (*sysexCallbackFunction)(uint8_t command, uint8_t argc, uint8_t *argv, void *context);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions