LibOSDP App Events

LibOSDP exposes the following structures thought osdp.h. This document attempts to document each of its members. The following structure is used as a wrapper for all the events for convenience.

struct osdp_event {
    enum osdp_event_type type; // Used to select specific event in union
    union {
        struct osdp_event_keypress keypress;
        struct osdp_event_cardread cardread;
        struct osdp_event_mfgrep mfgrep;
        struct osdp_status_report status;
    };
};

Below are the structure of each of the event structures.

Key press Event

struct osdp_event_keypress

OSDP Event Keypad.

Public Members

int reader_no

Reader number in context of sub-readers attached to current PD; this number indicates the number of that reader. This is not supported by LibOSDP.

int length

Length of keypress data in bytes

uint8_t data[OSDP_EVENT_KEYPRESS_MAX_DATALEN]

Keypress data of length bytes

Card read Event

struct osdp_event_cardread

OSDP event cardread.

Note

When format is set to OSDP_CARD_FMT_RAW_UNSPECIFIED or OSDP_CARD_FMT_RAW_WIEGAND, the length is expressed in bits. OTOH, when it is set to OSDP_CARD_FMT_ASCII, the length is in bytes. The number of bytes to read from the data field must be interpreted accordingly.

Public Members

int reader_no

Reader number. 0 = First Reader, 1 = Second Reader, etc.

enum osdp_event_cardread_format_e format

Format of the card being read.

int direction

Direction of data in data array.

  • 0 - Forward

  • 1 - Backward

int length

Length of card data in bytes or bits depending on format

uint8_t data[OSDP_EVENT_CARDREAD_MAX_DATALEN]

Card data of length bytes or bits bits depending on format

Manufacture specific reply Event

struct osdp_event_mfgrep

OSDP Event Manufacturer Specific Command.

Note

OSDP spec v2.2 makes this structure fixed at 4 bytes (3-byte vendor code and 1-byte data). LibOSDP allows for some additional data to be passed in this command using the data and length fields while using the 1-byte data (as specified in the specification) as command. To be fully compliant with the specification, you can set length to 0.

Public Members

uint32_t vendor_code

3-bytes IEEE assigned OUI of manufacturer

uint8_t command

1-byte reply code

uint8_t length

Length of manufacturer data in bytes (optional)

uint8_t data[OSDP_EVENT_MFGREP_MAX_DATALEN]

Manufacturer data of length bytes (optional)

Status report request Event

struct osdp_status_report

Status report structure. Used by OSDP_CMD_STATUS and OSDP_EVENT_STATUS. In case of command, it is used to send a query to the PD while in the case of events, the PR responds back with this structure.

This can is used by the PD to indicate various status change reports. Upto a maximum of 32 statuses can be reported using this API.

Public Members

enum osdp_status_report_type type

The kind of event to report see enum osdp_event_status_type_e

int nr_entries

Number of valid bits in status

uint32_t mask

Status bit mask

enum osdp_status_report_type

OSDP Status report types.

Values:

enumerator OSDP_STATUS_REPORT_INPUT

Status report of the inputs attached the PD.

enumerator OSDP_STATUS_REPORT_OUTPUT

Status report of the output attached the PD.

enumerator OSDP_STATUS_REPORT_LOCAL

Local tamper and power status report.

Bit-0: tamper Bit-1: power

enumerator OSDP_STATUS_REPORT_REMOTE

Remote tamper and power status report.

Bit-0: tamper Bit-1: power