LibOSDP App Commands

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 commands for convenience.

struct osdp_cmd {
    enum osdp_cmd_e id; // Command ID. Used to select specific commands in union
    union {
        struct osdp_cmd_led led;
        struct osdp_cmd_buzzer buzzer;
        struct osdp_cmd_text text;
        struct osdp_cmd_output output;
        struct osdp_cmd_comset comset;
        struct osdp_cmd_keyset keyset;
        struct osdp_cmd_mfg mfg;
        struct osdp_cmd_file_tx file_tx;
        struct osdp_status_report status;
    };
};

Below are the structure of each of the command structures.

LED command

struct osdp_cmd_led_params

LED params sub-structure. Part of LED command. See osdp_cmd_led.

Public Members

uint8_t control_code

Control code.

Temporary Control Code:

  • 0 - NOP - do not alter this LED’s temporary settings.

  • 1 - Cancel any temporary operation and display this LED’s permanent state immediately.

  • 2 - Set the temporary state as given and start timer immediately.

Permanent Control Code:

  • 0 - NOP - do not alter this LED’s permanent settings.

  • 1 - Set the permanent state as given.

uint8_t on_count

The ON duration of the flash, in units of 100 ms.

uint8_t off_count

The OFF duration of the flash, in units of 100 ms.

uint8_t on_color

Color to set during the ON timer (see osdp_led_color_e).

uint8_t off_color

Color to set during the OFF timer (see osdp_led_color_e).

uint16_t timer_count

Time in units of 100 ms (only for temporary mode).

struct osdp_cmd_led

Sent from CP to PD to control the behaviour of it’s on-board LEDs.

Public Members

uint8_t reader

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

uint8_t led_number

LED number. 0 = first LED, 1 = second LED, etc.

struct osdp_cmd_led_params temporary

Ephemeral LED status descriptor.

struct osdp_cmd_led_params permanent

Permanent LED status descriptor.

Buzzer command

struct osdp_cmd_buzzer

Sent from CP to control the behaviour of a buzzer in the PD.

Public Members

uint8_t reader

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

uint8_t control_code

Control code.

  • 0 - no tone

  • 1 - off

  • 2 - default tone

  • 3+ - TBD

uint8_t on_count

The ON duration of the sound, in units of 100 ms.

uint8_t off_count

The OFF duration of the sound, in units of 100 ms.

uint8_t rep_count

The number of times to repeat the ON/OFF cycle; 0: forever.

Text command

struct osdp_cmd_text

Command to manipulate any display units that the PD supports.

Public Members

uint8_t reader

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

uint8_t control_code

Control code.

  • 1 - permanent text, no wrap

  • 2 - permanent text, with wrap

  • 3 - temp text, no wrap

  • 4 - temp text, with wrap

uint8_t temp_time

Duration to display temporary text, in seconds

uint8_t offset_row

Row to display the first character (1-indexed)

uint8_t offset_col

Column to display the first character (1-indexed)

uint8_t length

Number of characters in the string

uint8_t data[OSDP_CMD_TEXT_MAX_LEN]

The string to display

Output command

struct osdp_cmd_output

Command sent from CP to Control digital output of PD.

Public Members

uint8_t output_no

0 = First Output, 1 = Second Output, etc.

uint8_t control_code

One of the following: 0 - NOP – do not alter this output 1 - set the permanent state to OFF, abort timed operation (if any) 2 - set the permanent state to ON, abort timed operation (if any) 3 - set the permanent state to OFF, allow timed operation to complete 4 - set the permanent state to ON, allow timed operation to complete 5 - set the temporary state to ON, resume perm state on timeout 6 - set the temporary state to OFF, resume permanent state on timeout

uint16_t timer_count

Time in units of 100 ms

Comset command

struct osdp_cmd_comset

Sent in response to a COMSET command. Set communication parameters to PD. Must be stored in PD non-volatile memory.

Public Members

uint8_t address

Unit ID to which this PD will respond after the change takes effect.

uint32_t baud_rate

Baud rate.

Valid values: 9600, 19200, 38400, 115200, 230400.

Keyset command

struct osdp_cmd_keyset

This command transfers an encryption key from the CP to a PD.

Public Members

uint8_t type

Type of keys:

  • 0x01 – Secure Channel Base Key

uint8_t length

Number of bytes of key data - (Key Length in bits + 7) / 8

uint8_t data[OSDP_CMD_KEYSET_KEY_MAX_LEN]

Key data

Manufacture specific command

struct osdp_cmd_mfg

Manufacturer Specific Commands.

Public Members

uint32_t vendor_code

3-byte IEEE assigned OUI. Most Significant 8-bits are unused

uint8_t command

1-byte manufacturer defined osdp command

uint8_t length

length Length of command data (optional)

uint8_t data[OSDP_CMD_MFG_MAX_DATALEN]

Command data (optional)

File transfer command

struct osdp_cmd_file_tx

File transfer start command.

Public Members

int id

Pre-agreed file ID between CP and PD

uint32_t flags

Reserved and set to zero by OSDP spec.

Note

: The upper bits are used by libosdp as: bit-31 - OSDP_CMD_FILE_TX_FLAG_CANCEL: cancel an ongoing transfer

Status report command

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