abr_sdk.cabi#

Python wrapper around the ABR SDK C ABI.

The C ABI is the interface between the ABR shared libraries and the SDK frontends. This binding has been automatically generated from the C ABI header files. Users should not use the functionality from this header directly.

Author: Andreas Stöckel (Applied Brain Research)

Module Contents#

Classes#

Status

Possible status codes returned by the various ABR functions.

LogLevel

Levels used for log messages.

VariantType

Possible types for variant values.

EventFlags

Possible flags for event creation. These can be combined via bitwise or.

AsrTextChunkType

Enumeration defining different ASR text chunk types.

VariantValue

String value, valid when type is #ABR_VAR_STR.

Variant

The actual value. The active union member is determined by @ref type.

Config

The configuration value.

Fingerprint

The fingerprint as 64 lowercase hexadecimal characters (null-terminated string).

AsrTextChunk

Small buffer containing the actual character data.

AbrSdkCAbiError

Exception thrown if a C function returns with an error code.

CAbi

Typed wrapper around a ABR C SDK library.

Functions#

_resolve

Used internally to ensure that all required shared library exports exist and that they have the right type signature.

_annotate_types

Resolve all ABR SDK symbols.

Data#

ABR_ABI_MAJOR

Major supported ABI version. Use for shared library compatibility checks.

ABR_ABI_MINOR

Minor supported ABI version. Use for shared library compatibility checks.

LogCallback

Function type used to connect the ABR SDK logger to the Python log system.

API#

abr_sdk.cabi.ABR_ABI_MAJOR#

6

Major supported ABI version. Use for shared library compatibility checks.

abr_sdk.cabi.ABR_ABI_MINOR#

0

Minor supported ABI version. Use for shared library compatibility checks.

class abr_sdk.cabi.Status#

Bases: enum.IntEnum

Possible status codes returned by the various ABR functions.

Initialization

Initialize self. See help(type(self)) for accurate signature.

OK#

0

The operation was successful.

ERR_INVALID_ARGS#

None

The API was used incorrectly; values may be out-of-range, or the given handles may point at the wrong object type.

ERR_INVALID_CONFIG#

None

Error in the cfg dictionary passed to abr_app_create or abr_activate_license.

Either a required key is missing, a key has an incorrect value, or a given key is unknown. See the log output for more information.

ERR_TIMEOUT#

None

The specified timeout expired while waiting for events.

ERR_INTERRUPT#

None

The process received a signal from the operating system while waiting for events, or a user called abr_evset_interrupt() from another thread.

ERR_PLATFORM_UNSUPPORTED#

None

The current platform is not supported by this ABR library. You may be attempting to load a ABR library that was compiled for a specific accelerator, but that accelerator is not available.

ERR_BUSY#

None

Another ABR library instance (may be in a separate process) is already using the current accelerator.

ERR_SYSTEM#

None

A system call failed. See the log for more information.

ERR_PERMISSION#

None

There was a permission error while attempting to access a resource, such as a neural network accelerator or a file with model weights.

ERR_NOT_IMPLEMENTED#

None

This function is not implemented yet.

ERR_INCOMPATIBLE_APP#

None

The attempted operation is incompatible with this application.

ERR_INCOMPATIBLE_LIBRARY#

None

The shared library is incompatible with this version of the ABR SDK.

ERR_NOT_STATICALLY_LINKED#

None

Attempting to open the ABR SDK in “statically linked” mode, but the library has not been linked at compile time.

ERR_LICENSE#

None

The license check failed.

See the log messages for information on what precisely caused this error and how and it can be solved.

class abr_sdk.cabi.LogLevel#

Bases: enum.IntEnum

Levels used for log messages.

Initialization

Initialize self. See help(type(self)) for accurate signature.

DEFAULT#

0

Use the default log level.

TRACE#

5

Trace-level logging for detailed debugging.

DEBUG#

10

Debug-level logging for development purposes.

INFO#

20

Informational messages about normal operation.

WARNING#

30

Warning messages for potentially problematic situations.

ERROR#

40

Error messages for recoverable failures.

CRITICAL#

50

Critical messages for severe failures.

DISABLE#

2147483647

Disable all logging.

class abr_sdk.cabi.VariantType#

Bases: enum.IntEnum

Possible types for variant values.

Variants are used for runtime-typed values in configuration and properties.

Initialization

Initialize self. See help(type(self)) for accurate signature.

UNDEFINED#

0

The variant has no defined value.

NULL#

1

The variant represents a null value.

BOOLEAN#

2

The variant contains a boolean value.

UINT#

3

The variant contains an unsigned integer.

SINT#

4

The variant contains a signed integer.

PTR#

5

The variant contains a pointer.

STR#

6

The variant contains a string.

class abr_sdk.cabi.EventFlags#

Bases: enum.IntEnum

Possible flags for event creation. These can be combined via bitwise or.

Initialization

Initialize self. See help(type(self)) for accurate signature.

NONE#

0

No special event flags set.

AUTO_DISABLE#

1

Automatically disables events that are triggered during a call to poll or while waiting for the platform event handle.

This is useful if the calling code needs to wait for multiple events to be triggered before some action can be performed. Without auto-disabling, events must be manually disabled to avoid poll constantly returning, which complicates the code.

DISABLED#

2

Create the event in a “disabled” state.

Using this flag avoids the event becoming triggered in between event creation and the call to abr_event_disable().

class abr_sdk.cabi.AsrTextChunkType#

Bases: enum.IntEnum

Enumeration defining different ASR text chunk types.

End-users may filter chunks depending on their latency and quality requirements.

Initialization

Initialize self. See help(type(self)) for accurate signature.

NONE#

0

Not used in valid text chunks.

Chunks with this type should be ignored.

CAUSAL#

1

The text was produced by the low-latency but less accurate “causal” branch of the model.

NONCAUSAL#

2

The text was produced by the higher latency but high-quality “non-causal” branch of the model.

POSTPROC#

3

The text was produced as the result of a post-processing operation, such as a language model or a punctuation model. At this level, the produced text has the highest quality, but also the highest inserted latency.

class abr_sdk.cabi.VariantValue#

Bases: ctypes.Union

String value, valid when type is #ABR_VAR_STR.

Initialization

Initialize self. See help(type(self)) for accurate signature.

_fields_#

((‘boolean’,), (‘uint’,), (‘sint’,), (‘ptr’,), (‘str’,))

class abr_sdk.cabi.Variant#

Bases: ctypes.Structure

The actual value. The active union member is determined by @ref type.

Initialization

Initialize self. See help(type(self)) for accurate signature.

_fields_#

((‘type’,), (‘value’,))

class abr_sdk.cabi.Config#

Bases: ctypes.Structure

The configuration value.

Initialization

Initialize self. See help(type(self)) for accurate signature.

_fields_#

((‘key’,), (‘value’,))

class abr_sdk.cabi.Fingerprint#

Bases: ctypes.Structure

The fingerprint as 64 lowercase hexadecimal characters (null-terminated string).

Initialization

Initialize self. See help(type(self)) for accurate signature.

_fields_#

((‘hex’,),)

class abr_sdk.cabi.AsrTextChunk#

Bases: ctypes.Structure

Small buffer containing the actual character data.

Initialization

Initialize self. See help(type(self)) for accurate signature.

_fields_#

((‘type’,), (‘pad0_’,), (‘replace_byte_offs_begin’,), (‘replace_byte_offs_end’,), (‘n_bytes’,), (‘pa…

abr_sdk.cabi.LogCallback#

‘CFUNCTYPE(…)’

Function type used to connect the ABR SDK logger to the Python log system.

class abr_sdk.cabi.AbrSdkCAbiError(status: int | abr_sdk.cabi.Status)#

Bases: abr_sdk.exceptions.AbrSdkError

Exception thrown if a C function returns with an error code.

Initialization

property status: abr_sdk.cabi.Status#

Return the status code the exception was created with.

static check(status: int | abr_sdk.cabi.Status) → abr_sdk.cabi.Status#

Throw a AbrSdkCAbiError if status indicates an error.

abr_sdk.cabi._resolve(cdll: ctypes.CDLL, name: str, argtypes: tuple[Any, ...], restype: Any) → None#

Used internally to ensure that all required shared library exports exist and that they have the right type signature.

abr_sdk.cabi._annotate_types(cdll: ctypes.CDLL) → None#

Resolve all ABR SDK symbols.

class abr_sdk.cabi.CAbi(library_path: str | pathlib.Path)#

Typed wrapper around a ABR C SDK library.

Initialization

Attempts to open the shared library at library_path.

CDLLCache: ClassVar[dict[str, ctypes.CDLL]]#

None

abr_abi_version() → int#

@short Return an identifier describing the ABI version.

The returned integer is structured as follows:

  • Bits 16-31: Major version (incompatible ABIs)

  • Bits 0-15: Minor version (new features, back and forward-compatible)

@return The ABI version as a 32-bit unsigned integer.

abr_app_create(app_p: ctypes._Pointer[ctypes.c_void_p], cfg: ctypes._Pointer[Config], n_cfg: ctypes.c_uint32 | int, log_cb: collections.abc.Callable[[ctypes.c_void_p, ctypes.c_int32, ctypes.c_char_p], None] | None, log_cb_user_data: ctypes.c_void_p | None) → abr_sdk.cabi.Status#

@short Create a new time-series neural network application.

Users may instantiate an arbitrary number of application instances, as long as the underlying accelerator supports this, and there are enough resources (i.e., memory) left.

Every application instance is optionally linked to a logger. The logger is used to capture log messages from the application.

@param app_p Pointer to the variable where the newly created application handle will be stored. This will be set to @c NULL if initialization fails.

@param cfg Pointer to an array of configuration options. May be @c NULL if no additional configuration is needed. Recognized keys depend on the loaded application; the library picks the default for any key the caller omits. Application-specific keys are namespaced by the application name (e.g. ASR exposes “asr_*”).

Application-agnostic keys:

  • “min_log_level” (#ABR_VAR_SINT, see #abr_log_level): minimum severity threshold passed to the logger. Defaults to #ABR_LOG_DEFAULT.

  • “resources_dir” (#ABR_VAR_STR): filesystem directory the loaded library reads model weights from. Defaults to the directory containing the loaded shared library.

  • “license_dir” (#ABR_VAR_STR): filesystem directory in which license data is stored.

  • “litert_delegate” (#ABR_VAR_STR): LiteRT kernel path used to run the neural networks. One of:

  • “builtin”: the TFLite built-in kernels, with no delegate.

  • “xnnpack”: the XNNPACK delegate.

  • a filesystem path to an external delegate library. Defaults to the delegate the library was built for. Libraries built for TFLite Micro log that the key is ignored.

  • “cache_dir” (#ABR_VAR_STR): existing, writable directory in which the library stores data that it can recompute, such as neural networks compiled for the target hardware. A directory that does not exist or cannot be written to is rejected. If omitted, the library uses the abr-sdk subdirectory of the first of the directories listed below, and may create that subdirectory including any missing parent directories. If none of them applies, the library logs a warning and computes that data again on every run.

  • the directory Android assigns to the calling application, Context.getCacheDir(). Android only, and only in an app process.

  • $XDG_CACHE_HOME, if that environment variable holds an absolute path. Linux only.

  • $HOME/.cache, if the HOME environment variable holds an absolute path the calling process can write to. Linux only.

  • $TMPDIR, if that environment variable is set and not empty.

  • /tmp. Linux only.

ASR-specific keys:

  • “asr_mode” (#ABR_VAR_STR): which decoder branch is surfaced. One of:

  • “fast”: causal decoder (lower-quality, sooner output).

  • “accurate”: noncausal decoder (higher-quality, lookahead latency).

Defaults to “accurate”.

  • “asr_enable_spellcheck” (#ABR_VAR_BOOLEAN): whether the spell checker corrects the transcript. Ignored if the library has no spell checker. Defaults to @c true.

  • “asr_enable_pcr” (#ABR_VAR_BOOLEAN): whether the punctuation and capitalization (PCR) network post-processes the transcript. Ignored if the library has no PCR network. Defaults to @c true.

@param n_cfg Number of configuration options in the @p cfg array.

@param log_cb Pointer to the log callback function. Passing @c NULL disables logging.

@param log_cb_user_data Arbitrary pointer passed as the first argument to

@p log_cb. Useful for object-oriented patterns where @p log_cb is a member function and @p log_cb_user_data is a class instance.

@return One of the following status codes:

  • #ABR_OK: A valid pointer has been written to @p abr_p, and the application is ready to use.

  • #ABR_ERR_LICENSE: No application has been created because this device does not hold a valid license. Call abr_activate_license() to activate the device. See the log for more details.

  • #ABR_ERR_PLATFORM_UNSUPPORTED: This application library is not supported on this machine. You may be attempting to open an application library that uses a hardware accelerator that is not available on your machine.

  • #ABR_ERR_BUSY: The targeted accelerator is already busy executing another application.

  • #ABR_ERR_SYSTEM: A system call returned with an error.

Depending on the error code, additional information may have been logged.

abr_get_fingerprint(fingerprint: ctypes._Pointer[Fingerprint], cfg: ctypes._Pointer[Config], n_cfg: ctypes.c_uint32 | int, log_cb: collections.abc.Callable[[ctypes.c_void_p, ctypes.c_int32, ctypes.c_char_p], None] | None, log_cb_user_data: ctypes.c_void_p | None) → abr_sdk.cabi.Status#

@short Returns this device’s fingerprint, as reported by the library.

Does not require an application instance. A device without a hardware identity is identified by a random identity that is created in license_dir on first use and reused afterwards; the directory is created if it does not exist.

@param fingerprint Pointer to the structure where the fingerprint will be stored.

@param cfg Configuration options that would normally be passed to abr_app_create(). The relevant keys are license_dir and min_log_level; all other keys are ignored.

@param n_cfg Number of configuration options in the @p cfg array.

@param log_cb Pointer to the log callback function. Passing @c NULL disables logging.

@param log_cb_user_data Arbitrary pointer passed as the first argument to

@p log_cb. Useful for object-oriented patterns where @p log_cb is a member function and @p log_cb_user_data is a class instance.

@return One of the following status codes:

  • #ABR_OK: The fingerprint has been written to @p fingerprint.

  • #ABR_ERR_INVALID_ARGS: The @p fingerprint pointer is NULL, or @p cfg is NULL while @p n_cfg is non-zero.

  • #ABR_ERR_INVALID_CONFIG: The license_dir configuration key is missing.

  • #ABR_ERR_LICENSE: This device has no usable identity. See the log for more details.

  • #ABR_ERR_SYSTEM: The random identity could not be stored in license_dir.

abr_activate_license(envelope: ctypes.c_char_p | bytes | bytearray, cfg: ctypes._Pointer[Config], n_cfg: ctypes.c_uint32 | int, log_cb: collections.abc.Callable[[ctypes.c_void_p, ctypes.c_int32, ctypes.c_char_p], None] | None, log_cb_user_data: ctypes.c_void_p | None) → abr_sdk.cabi.Status#

@short Activate a license for this device given the server response.

Does not require an application instance; activation only depends on the license directory and the device this function is called on.

@param envelope Pointer at a zero-terminated string containing the signed license envelope.

@param cfg Configuration options that would normally be passed to abr_app_create(). The relevant keys are license_dir and min_log_level; all other keys are ignored and logged at the debug level.

@param n_cfg Number of configuration options in the @p cfg array.

@param log_cb Pointer to the log callback function. Passing @c NULL disables logging.

@param log_cb_user_data Arbitrary pointer passed as the first argument to

@p log_cb. Useful for object-oriented patterns where @p log_cb is a member function and @p log_cb_user_data is a class instance.

@return One of the following status codes:

  • #ABR_OK: The device has been activated.

  • #ABR_ERR_INVALID_ARGS: The @p envelope pointer is NULL, or @p cfg is NULL while @p n_cfg is non-zero.

  • #ABR_ERR_INVALID_CONFIG: The license_dir configuration key is missing.

  • #ABR_ERR_LICENSE: The license could not be validated. See the log for more details.

  • #ABR_ERR_SYSTEM: The random identity could not be stored in license_dir.

abr_app_free(app: ctypes.c_void_p | None) → None#

@short Free the application instance and all resources held by it.

Note that this invalidates all other handles that (directly or indirectly) have this application instance as a parent.

This function does nothing if @p app is @c NULL; i.e., it is safe to call abr_app_free() independent of whether the library has been initialized correctly or not.

@param app Pointer to the application instance to free, or @c NULL.

abr_app_get_buffer_count(app: ctypes.c_void_p | None) → int#

@short Return the number of I/O buffers available in the application.

@param app Pointer to the application instance for which the buffer count should be obtained.

@return The number of buffers, or zero if @p app is @c NULL.

abr_app_get_buffer(app: ctypes.c_void_p | None, idx: ctypes.c_uint32 | int) → ctypes.c_void_p#

@short Fetch the i-th buffer from the application.

Calling this function multiple times with the same index will always return the same buffer object. There is no need to free these objects after use.

Input buffers come first, in graph order, followed by the output buffers. ASR, TTS and PCR libraries expose exactly one of each.

@param app Pointer to the application instance.

@param idx Zero-based index of the buffer object to retrieve.

@return A pointer to the buffer, or @c NULL if @p app is @c NULL or

@p idx is out of range.

abr_get_parent(obj: ctypes.c_void_p | None) → ctypes.c_void_p#

@short Return the parent object of the specified object.

@param obj Pointer to any ABR object; this may be a #abr_app_t, a #abr_buf_t, etc. May be @c NULL.

@return The parent object of the given object, or @c NULL if the object has no known parent object.

abr_get_property_count(obj: ctypes.c_void_p | None) → int#

@short Return the number of properties attached to the given object.

Every ABR object may have a series of runtime-defined properties attached. These properties are used for values that do not need to be accessed very often. Using a generic interface avoids having to add new functions to the C ABI every time a new property is exported.

Passing @c NULL provides information about the application library itself.

@param obj Pointer to a ABR object; this may be a #abr_app_t, a #abr_buf_t, etc. Passing @c NULL provides access to the global “meta” scope.

@return The number of properties.

abr_get_property_name(obj: ctypes.c_void_p | None, idx: ctypes.c_uint32 | int) → bytes | None#

@short Return the property name by index.

@param obj Pointer to a ABR object, or @c NULL for the global “meta” scope.

@param idx Zero-based index of the property.

@return The property name, or @c NULL if the index is out of range.

abr_get_property_value_by_idx(obj: ctypes.c_void_p | None, idx: ctypes.c_uint32 | int) → abr_sdk.cabi.Variant#

@short Return a property value by index.

@param obj Pointer to a ABR object, or @c NULL for the global “meta” scope.

@param idx Zero-based index of the property.

@return The property value, or an “undefined” variant if the index is out of range or the object is not known.

abr_get_property_value_by_name(obj: ctypes.c_void_p | None, key: ctypes.c_char_p | bytes | bytearray) → abr_sdk.cabi.Variant#

@short Return a property value by name.

@param obj Pointer to a ABR object, or @c NULL for the global “meta” scope.

@param key The property name to look up. Keys are case-sensitive.

@return The property value, or an “undefined” variant if the name is not found or the object is not known.

abr_buf_get_size(buf: ctypes.c_void_p | None) → int#

@short Return the total buffer capacity in bytes.

@param buf Pointer to the buffer.

@return The buffer capacity in bytes, or zero if @p buf is @c NULL.

abr_buf_get_level(buf: ctypes.c_void_p | None) → int#

@short Return the number of bytes that can be pushed or pulled.

@param buf Pointer to the buffer.

@return The number of bytes that can be pushed, or pulled up to the next flush marker; zero if @p buf is @c NULL.

abr_buf_push(buf: ctypes.c_void_p | None, data: Union[ctypes._Pointer[ctypes.c_uint8], bytes, bytearray], n_bytes: ctypes.c_uint32 | int, flush: ctypes.c_bool | bool) → int#

@short Push (write) data onto a buffer.

Does nothing if @p buf is an output buffer.

@param buf Pointer to the buffer.

@param data Pointer to the data to push.

@param n_bytes Number of bytes to push.

@param flush If true, pushes a “flush marker” into the buffer. This indicates that this is the end of a data segment, and that the application should process all data made available so far. If not all @p n_bytes fit, the marker is dropped; push the rest with @p flush set again. A push of zero bytes always places the marker.

@return The number of bytes actually pushed onto the buffer, or a negative error code (compatible with #abr_status_t) on failure. Once the application has failed, every call returns the status of that failure; free the application to recover.

abr_buf_pull(buf: ctypes.c_void_p | None, data: Union[ctypes._Pointer[ctypes.c_uint8], bytes, bytearray], n_bytes: ctypes.c_uint32 | int, flush: ctypes._Pointer[ctypes.c_bool]) → int#

@short Pull (read) data from a buffer.

Does nothing if @p buf is an input buffer.

@param buf Pointer to the buffer.

@param data Pointer to the buffer where pulled data will be stored.

@param n_bytes Maximum number of bytes to pull.

@param flush Pointer to a boolean flag, or @c NULL. Set to true if the pull stopped at a flush marker and consumed it, which typically happens once for every flush flag pushed into the pipeline. A pull with @p n_bytes of zero never reports or consumes a marker; a pull that returns zero bytes may still report one, at the end of an empty segment.

@return The number of bytes actually pulled from the buffer, or a negative error code (compatible with #abr_status_t) on failure. Once the application has failed, every call returns the status of that failure; free the application to recover.

abr_evset_create(app: ctypes.c_void_p | None) → ctypes.c_void_p#

@short Create a new event set connected to the given application instance.

The event set (short “evset”) may be used by a single user thread to wait for events on the application’s buffers.

@param app Pointer to the application instance.

@return Pointer to the newly created event set, or @c NULL on failure.

abr_evset_get_platform_handle(evset: ctypes.c_void_p | None) → int#

@short Return the platform-specific event handle.

The event handle may be used to yield to the operating system until a buffer event (configured through the buffer interface) happens.

On POSIX-like systems, the returned handle is a file descriptor of a

@c socketpair() or a compatible mechanism such as @c eventfd() on Linux. An event results in eight bytes becoming readable from the file descriptor. The user must read those eight bytes to confirm the event.

The file descriptor is meant to be used in conjunction with @c poll()-like event loops typically used by event-runtimes, such as Python @c async or

@c libuv (NodeJS/JavaScript), or Boost ASIO (C++).

The exact semantics of the returned handle on Windows platforms is yet to be determined.

@param evset Pointer to the event set.

@return The platform-specific handle, or a negative value on error.

abr_evset_poll(evset: ctypes.c_void_p | None, timeout_ms: ctypes.c_int32 | int) → abr_sdk.cabi.Status#

@short Block the current thread until an event is triggered or timeout.

This function returns once at least one event in the event set is in the “enabled” and “triggered” state.

Events created with the #ABR_EVENT_FLAGS_AUTO_DISABLE flag are disabled if they cause abr_evset_poll() to return. Users must explicitly enable events again once they are interested in that event again. This simplifies usage patterns where users need to wait for multiple events to become triggered before something can happen.

Under the hood, this function uses the event platform handle to yield to the operating system. This function may be used if the runtime does not provide an easy way to integrate an event handle into the main asynchronous I/O loop.

@param evset Pointer to the event set to poll.

@param timeout_ms Timeout in milliseconds. A positive value indicates the maximum time to wait. A value of zero returns immediately with #ABR_OK if an event is ready, or #ABR_ERR_TIMEOUT otherwise. A negative value denotes an infinite timeout.

@return One of the following status codes:

  • #ABR_OK: At least one event is triggered. Use abr_event_is_triggered() to determine which event.

  • #ABR_ERR_TIMEOUT: The timeout expired.

  • #ABR_ERR_INTERRUPT: The process received a signal/interrupt while waiting or abr_evset_interrupt() was called. It is safe to call abr_evset_poll() again in this case.

  • Any other error code: The call failed. If the application failed, every later call returns the same status; free the application to recover.

abr_evset_interrupt(evset: ctypes.c_void_p | None) → None#

@short Interrupt a thread waiting on the event set platform handle.

The abr_evset_poll() function will unblock and return with #ABR_ERR_INTERRUPT if no event has been triggered.

@param evset Event set that should be interrupted.

abr_evset_free(evset: ctypes.c_void_p | None) → None#

@short Free a previously created event set.

Frees the event set and all events connected to it.

@param evset Pointer to the event set to free, or @c NULL.

abr_event_create_buf_level_event(evset: ctypes.c_void_p | None, buf: ctypes.c_void_p | None, threshold: ctypes.c_uint32 | int, flags: ctypes.c_uint8 | int) → ctypes.c_void_p#

@short Register a buffer level event for the given buffer.

The I/O event is triggered if there are @p threshold bytes available for reading from or writing to the buffer, or if an output buffer holds a flush marker.

@param evset Pointer to the event set.

@param buf Pointer to the buffer to monitor.

@param threshold Number of bytes that must be available to trigger the event.

@param flags Bitwise combination of abr_event_flags_t enum values that influence how the event behaves.

@return Pointer to the newly created event, or @c NULL on failure.

abr_event_free(event: ctypes.c_void_p | None) → None#

@short Free a previously created event.

This function does nothing if @p event is @c NULL or does not point at a valid event.

@param event Pointer to the event to free, or @c NULL.

abr_event_is_triggered(event: ctypes.c_void_p | None) → bool#

@short Return @c true if the event has been triggered.

Returns whether the event has reached its trigger condition. This function is independent of the event’s enabled/disabled status.

@param event Pointer to the event to check.

@return @c true if the event is in the triggered state, @c false otherwise or if @p event is @c NULL.

abr_event_is_enabled(event: ctypes.c_void_p | None) → bool#

@short Return @c true if the event is currently enabled.

Only enabled events can cause the underlying event set to wake up, i.e., cause the platform handle to become readable or abr_evset_poll() to return. Note that events can only be disabled if the event was created with the #ABR_EVENT_FLAGS_AUTO_DISABLE flag, or if it was manually disabled by calling abr_event_disable().

To re-enable an event, call abr_event_enable(). To disable an event call abr_event_disable().

@param event Pointer to the event to check.

@return @c true if the event is enabled, @c false otherwise or if

@p event is @c NULL.

abr_event_enable(event: ctypes.c_void_p | None) → None#

@short (Re-)enable an event.

Ensures that the given event can cause poll to return, or, when using the platform handle, the handle to become readable.

@param event Pointer to the event to enable. Does nothing if the pointer is NULL or the pointer does not point at an event object.

abr_event_disable(event: ctypes.c_void_p | None) → None#

@short Disable an event.

After having been disabled, the event cannot cause poll to return, or, when using the platform handle, the handle to become readable.

@param event Pointer to the event to disable. Does nothing if the pointer is NULL or the pointer does not point at an event object.