

#ifdef POK_NEEDS_MIDDLEWARE
#ifdef POK_NEEDS_BLACKBOARDS

#include <errno.h>
#include <libc/string.h>
#include <middleware/blackboard.h>
#include <types.h>

extern pok_blackboard_t pok_blackboards[POK_CONFIG_NB_BLACKBOARDS];
extern char *pok_blackboards_names[POK_CONFIG_NB_BLACKBOARDS];

pok_ret_t pok_blackboard_id(char *name, pok_blackboard_id_t *id) {
  uint8_t n;

  for (n = 0; n < POK_CONFIG_NB_BLACKBOARDS; n++) {
    if (streq(name, pok_blackboards_names[n])) {
      *id = n;
      return POK_ERRNO_OK;
    }
  }

  return POK_ERRNO_EINVAL;
}

#endif /* POK_NEEDS_BLACKBOARDS */
#endif
