Command structures

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;
    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;
    };
};
enum osdp_cmd_e

OSDP application exposed commands.

Values:

enumerator OSDP_CMD_OUTPUT
enumerator OSDP_CMD_LED
enumerator OSDP_CMD_BUZZER
enumerator OSDP_CMD_TEXT
enumerator OSDP_CMD_KEYSET
enumerator OSDP_CMD_COMSET
enumerator OSDP_CMD_MFG
enumerator OSDP_CMD_FILE_TX
enumerator OSDP_CMD_SENTINEL
struct osdp_cmd

OSDP Command Structure. This is a wrapper for all individual OSDP commands.

param id

used to select specific commands in union. Type: enum osdp_cmd_e

param led

LED command structure

param buzzer

buzzer command structure

param text

text command structure

param output

output command structure

param comset

comset command structure

param keyset

keyset command structure

Command LED

struct osdp_cmd_led_params {
    uint8_t control_code;
    uint8_t on_count;
    uint8_t off_count;
    uint8_t on_color;
    uint8_t off_color;
    uint16_t timer_count;
};

struct osdp_cmd_led {
    uint8_t reader;
    uint8_t number;
    struct osdp_cmd_led_params temporary;
    struct osdp_cmd_led_params permanent;
};
struct osdp_cmd_led_params

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

param control_code

One of the following: 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

param on_count

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

param off_count

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

param on_color

Color to set during the ON timer (enum osdp_led_color_e)

param off_color

Color to set during the OFF timer (enum osdp_led_color_e)

param 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.

param reader

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

param led_number

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

param temporary

ephemeral LED status descriptor

param permanent

permanent LED status descriptor

Command Output

struct osdp_cmd_output {
    uint8_t output_no;
    uint8_t control_code;
    uint16_t timer_count;
};
struct osdp_cmd_output

Command sent from CP to Control digital output of PD.

param output_no

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

param 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

param timer_count

Time in units of 100 ms

Command Buzzer

struct osdp_cmd_buzzer {
    uint8_t reader;
    uint8_t control_code;
    uint8_t on_count;
    uint8_t off_count;
    uint8_t rep_count;
};
struct osdp_cmd_buzzer

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

param reader

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

param control_code

0: no tone, 1: off, 2: default tone, 3+ is TBD.

param on_count

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

param off_count

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

param rep_count

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

Command Text

struct osdp_cmd_text {
    uint8_t reader;
    uint8_t control_code;
    uint8_t temp_time;
    uint8_t offset_row;
    uint8_t offset_col;
    uint8_t length;
    uint8_t data[32];
};
struct osdp_cmd_text

Command to manuplate any display units that the PD supports.

param reader

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

param control_code

One of the following: 1 - permanent text, no wrap 2 - permanent text, with wrap 3 - temp text, no wrap 4 - temp text, with wrap

param temp_time

duration to display temporary text, in seconds

param offset_row

row to display the first character (1 indexed)

param offset_col

column to display the first character (1 indexed)

param length

Number of characters in the string

param data

The string to display

Command Comset

struct osdp_cmd_comset {
    uint8_t address;
    uint32_t baud_rate;
};
struct osdp_cmd_comset

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

param address

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

param baud_rate

baud rate value 9600/19200/38400/115200/230400

Command Keyset

struct osdp_cmd_keyset {
    uint8_t type;
    uint8_t length;
    uint8_t data[OSDP_CMD_KEYSET_KEY_MAX_LEN];
};
struct osdp_cmd_keyset

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

param type

Type of keys:

  • 0x00 - Master Key (This is not part of OSDP Spec, see gh-issue:#42)

  • 0x01 – Secure Channel Base Key

param length

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

param data

Key data