aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <jaylink-dev@marcschink.de>2016-10-18 19:49:22 +0200
committerMarc Schink <jaylink-dev@marcschink.de>2016-11-05 13:34:48 +0100
commitffa64002fcadd32fe94b154456790cc02a90f313 (patch)
treea7ccf744194c0179e6168e433af1162dcfbdbafe
parent564df3739b1ea4c56d38ec867c49aee76372ec75 (diff)
Add support for library capabilities
Signed-off-by: Marc Schink <jaylink-dev@marcschink.de>
-rw-r--r--libjaylink/core.c20
-rw-r--r--libjaylink/libjaylink.h7
2 files changed, 27 insertions, 0 deletions
diff --git a/libjaylink/core.c b/libjaylink/core.c
index 9eb444e..67b66f4 100644
--- a/libjaylink/core.c
+++ b/libjaylink/core.c
@@ -144,3 +144,23 @@ JAYLINK_API int jaylink_exit(struct jaylink_context *ctx)
return JAYLINK_OK;
}
+
+/**
+ * Check for a capability of libjaylink.
+ *
+ * @param[in] cap Capability to check for.
+ *
+ * @retval true Capability is supported.
+ * @retval false Capability is not supported or invalid argument.
+ *
+ * @since 0.1.0
+ */
+JAYLINK_API bool jaylink_library_has_cap(enum jaylink_capability cap)
+{
+ switch (cap) {
+ case JAYLINK_CAP_HIF_USB:
+ return true;
+ default:
+ return false;
+ }
+}
diff --git a/libjaylink/libjaylink.h b/libjaylink/libjaylink.h
index 1066d96..a60e70b 100644
--- a/libjaylink/libjaylink.h
+++ b/libjaylink/libjaylink.h
@@ -87,6 +87,12 @@ enum jaylink_log_level {
/** Maximum length of a libjaylink log domain in bytes. */
#define JAYLINK_LOG_DOMAIN_MAX_LENGTH 32
+/** libjaylink capabilities. */
+enum jaylink_capability {
+ /** Library supports USB as host interface. */
+ JAYLINK_CAP_HIF_USB = 0
+};
+
/** Host interfaces. */
enum jaylink_host_interface {
/** Universal Serial Bus (USB). */
@@ -377,6 +383,7 @@ typedef int (*jaylink_log_callback)(const struct jaylink_context *ctx,
JAYLINK_API int jaylink_init(struct jaylink_context **ctx);
JAYLINK_API int jaylink_exit(struct jaylink_context *ctx);
+JAYLINK_API bool jaylink_library_has_cap(enum jaylink_capability cap);
/*--- device.c --------------------------------------------------------------*/