DC_CONTEXT_NEW(3)

NAME
dc_context_new - create a new device-handling context

LIBRARY
libdivecomputer

SYNOPSIS
#include <libdivecomputer/context.h>
dc_status_t
dc_context_new(dc_context_t **context);

DESCRIPTION
Create a context in which dive computers may be queried. The “context” supplies logging messages and so on, and may be re-used for multiple dive computer query sessions. It is usually passed to dc_device_open(3) to query a specific dive computer device.

On success, the context must be freed with dc_context_free(3). You may configure the context with dc_context_set_loglevel(3) and dc_context_set_logfunc(3). This is highly recommended as the default logging behaviour of dc_context_new depends upon compile-time values.

RETURN VALUES
This returns DC_STATUS_OK on success, in which case context is filled in, or an error code on failure.

SEE ALSO
dc_context_free(3), dc_context_set_logfunc(3), dc_context_set_loglevel(3), dc_device_open(3)

AUTHORS
The libdivecomputer library was written by Jef Driesen, jef@libdivecomputer.org. The manpages were written by Kristaps Dzonsons, kristaps@bsd.lv.