Documentation

Miscellaneous

Debugging and Diagnostics

functionosdp_logger_init
void osdp_logger_init(const char *name, int log_level, osdp_log_puts_fn_t puts_fn)

Configure OSDP Logging.

Parameters
nameA soft name for this module; will appear in all the log lines.
log_levelOSDP log levels of type enum osdp_log_level_e. Default is LOG_INFO.
puts_fnA puts() like function that will be invoked to write the log buffer. Can be handy if you want to log to file on a UART device without putchar redirection. See osdp_log_puts_fn_t definition to see the behavioral expectations. When this is set to NULL, LibOSDP will log to stderr.
functionosdp_get_version
const char * osdp_get_version()

Get LibOSDP version as a const char *. Used in diagnostics.

Returns
versionstring
functionosdp_get_source_info
const char * osdp_get_source_info()

Get LibOSDP source identifier as a const char *. This string has info about the source tree from which this version of LibOSDP was built. Used in diagnostics.

Returns
sourceidentifier string

Status

functionosdp_get_status_mask
void osdp_get_status_mask(const osdp_t *ctx, uint8_t *bitmask)

Get a bit mask of number of PD that are online currently.

Parameters
ctxOSDP context
bitmaskpointer to an array of bytes. must be as large as (num_pds + 7 / 8).
functionosdp_get_sc_status_mask
void osdp_get_sc_status_mask(const osdp_t *ctx, uint8_t *bitmask)

Get a bit mask of number of PD that are online and have an active secure channel currently.

Parameters
ctxOSDP context
bitmaskpointer to an array of bytes. must be as large as (num_pds + 7 / 8).

File Operations

structosdp_file_ops

OSDP File operations struct that needs to be filled by the CP/PD application and registered with LibOSDP using osdp_file_register_ops() before a file transfer command can be initiated.

Members
void * arg
A opaque pointer to private data that can be filled by the application which will be passed as the first argument for each of the below functions. Applications can keep their file context info such as the open file descriptors or any other private data here.
osdp_file_open_fn_t open
open handler function
osdp_file_read_fn_t read
read handler function
osdp_file_write_fn_t write
write handler function
osdp_file_close_fn_t close
close handler function
functionosdp_file_register_ops
int osdp_file_register_ops(osdp_t *ctx, int pd, const struct osdp_file_ops *ops)

Register a global file operations struct with OSDP. Both CP and PD modes should have done so already before CP can sending a OSDP_CMD_FILE_TX.

Parameters
ctxOSDP context
pdPD number in case of CP. This param is ignored in PD mode
opsPopulated file operations struct
Returns
0on success. -1 on errors.
functionosdp_get_file_tx_status
int osdp_get_file_tx_status(const osdp_t *ctx, int pd, int *size, int *offset)

Query file transfer status if one is in progress. Calling this method when there is no file transfer progressing will return error.

Parameters
ctxOSDP context
pdPD number in case of CP. This param is ignored in PD mode
sizeTotal size of the file (as obtained from file_ops->open())
offsetOffset into the file that has been sent/received (CP/PD)
Returns
0on success. -1 on errors.