Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
osdp.h File Reference

Open Supervised Device Protocol (OSDP) public API header file. More...

#include <zephyr/kernel.h>
#include <stdint.h>
#include <zephyr/sys/slist.h>

Go to the source code of this file.

Data Structures

struct  osdp_cmd_output
 Command sent from CP to Control digital output of PD. More...
 
struct  osdp_cmd_led_params
 LED params sub-structure. More...
 
struct  osdp_cmd_led
 Sent from CP to PD to control the behaviour of it's on-board LEDs. More...
 
struct  osdp_cmd_buzzer
 Sent from CP to control the behaviour of a buzzer in the PD. More...
 
struct  osdp_cmd_text
 Command to manipulate any display units that the PD supports. More...
 
struct  osdp_cmd_comset
 Sent in response to a COMSET command. More...
 
struct  osdp_cmd_keyset
 This command transfers an encryption key from the CP to a PD. More...
 
struct  osdp_cmd
 OSDP Command Structure. More...
 
struct  osdp_event_cardread
 OSDP event cardread. More...
 
struct  osdp_event_keypress
 OSDP Event Keypad. More...
 
struct  osdp_event
 OSDP Event structure. More...
 

Macros

#define OSDP_CMD_TEXT_MAX_LEN   32
 Max length of text for text command.
 
#define OSDP_CMD_KEYSET_KEY_MAX_LEN   32
 Max length of key data for keyset command.
 
#define OSDP_EVENT_MAX_DATALEN   64
 Max length of event data.
 

Typedefs

typedef int(* pd_command_callback_t) (void *arg, struct osdp_cmd *cmd)
 Callback for PD command notifications.
 
typedef int(* cp_event_callback_t) (void *arg, int pd, struct osdp_event *ev)
 Callback for CP event notifications.
 

Enumerations

enum  osdp_led_color_e {
  OSDP_LED_COLOR_NONE , OSDP_LED_COLOR_RED , OSDP_LED_COLOR_GREEN , OSDP_LED_COLOR_AMBER ,
  OSDP_LED_COLOR_BLUE , OSDP_LED_COLOR_SENTINEL
}
 LED Colors as specified in OSDP for the on_color/off_color parameters. More...
 
enum  osdp_cmd_e {
  OSDP_CMD_OUTPUT = 1 , OSDP_CMD_LED , OSDP_CMD_BUZZER , OSDP_CMD_TEXT ,
  OSDP_CMD_KEYSET , OSDP_CMD_COMSET , OSDP_CMD_SENTINEL
}
 OSDP application exposed commands. More...
 
enum  osdp_event_cardread_format_e { OSDP_CARD_FMT_RAW_UNSPECIFIED , OSDP_CARD_FMT_RAW_WIEGAND , OSDP_CARD_FMT_ASCII , OSDP_CARD_FMT_SENTINEL }
 Various card formats that a PD can support. More...
 
enum  osdp_event_type { OSDP_EVENT_CARDREAD , OSDP_EVENT_KEYPRESS , OSDP_EVENT_SENTINEL }
 OSDP PD Events. More...
 

Functions

Peripheral Device mode APIs
Note
These are only available when CONFIG_OSDP_MODE_PD is enabled.
void osdp_pd_set_command_callback (pd_command_callback_t cb, void *arg)
 Set callback method for PD command notification.
 
int osdp_pd_notify_event (const struct osdp_event *event)
 API to notify PD events to CP.
 
OSDP Secure Channel APIs
Note
These are only available when CONFIG_OSDP_SC_ENABLED is enabled.
uint32_t osdp_get_sc_status_mask (void)
 Get the current SC status mask.
 

Detailed Description

Open Supervised Device Protocol (OSDP) public API header file.

Macro Definition Documentation

◆ OSDP_CMD_KEYSET_KEY_MAX_LEN

#define OSDP_CMD_KEYSET_KEY_MAX_LEN   32

Max length of key data for keyset command.

◆ OSDP_CMD_TEXT_MAX_LEN

#define OSDP_CMD_TEXT_MAX_LEN   32

Max length of text for text command.

◆ OSDP_EVENT_MAX_DATALEN

#define OSDP_EVENT_MAX_DATALEN   64

Max length of event data.

Typedef Documentation

◆ cp_event_callback_t

typedef int(* cp_event_callback_t) (void *arg, int pd, struct osdp_event *ev)

Callback for CP event notifications.

After it has been registered with osdp_cp_set_event_callback, this method is invoked when the CP receives an event from the PD.

Parameters
argOpaque pointer provided by the application during callback registration.
pdthe offset (0-indexed) of this PD in kconfig OSDP_PD_ADDRESS_LIST
evpointer to osdp_event struct (filled by libosdp).
Return values
0on handling the event successfully.
-veon errors.

◆ pd_command_callback_t

typedef int(* pd_command_callback_t) (void *arg, struct osdp_cmd *cmd)

Callback for PD command notifications.

After it has been registered with osdp_pd_set_command_callback, this method is invoked when the PD receives a command from the CP.

Parameters
argpointer that will was passed to the arg param of osdp_pd_set_command_callback.
cmdpointer to the received command.
Return values
0if LibOSDP must send a osdp_ACK response
-veif LibOSDP must send a osdp_NAK response
+veand modify the passed struct osdp_cmd *cmd if LibOSDP must send a specific response. This is useful for sending manufacturer specific reply osdp_MFGREP.

Enumeration Type Documentation

◆ osdp_cmd_e

enum osdp_cmd_e

OSDP application exposed commands.

Enumerator
OSDP_CMD_OUTPUT 

Output control command.

OSDP_CMD_LED 

Reader LED control command.

OSDP_CMD_BUZZER 

Reader buzzer control command.

OSDP_CMD_TEXT 

Reader text output command.

OSDP_CMD_KEYSET 

Encryption Key Set Command.

OSDP_CMD_COMSET 

PD Communication Configuration Command.

OSDP_CMD_SENTINEL 

Max command value.

◆ osdp_event_cardread_format_e

Various card formats that a PD can support.

This is sent to CP when a PD must report a card read.

Enumerator
OSDP_CARD_FMT_RAW_UNSPECIFIED 

Unspecified card format.

OSDP_CARD_FMT_RAW_WIEGAND 

Wiegand card format.

OSDP_CARD_FMT_ASCII 

ASCII card format.

OSDP_CARD_FMT_SENTINEL 

Max card format value.

◆ osdp_event_type

OSDP PD Events.

Enumerator
OSDP_EVENT_CARDREAD 

Card read event.

OSDP_EVENT_KEYPRESS 

Keypad press event.

OSDP_EVENT_SENTINEL 

Max event value.

◆ osdp_led_color_e

LED Colors as specified in OSDP for the on_color/off_color parameters.

Enumerator
OSDP_LED_COLOR_NONE 

No color.

OSDP_LED_COLOR_RED 

Red.

OSDP_LED_COLOR_GREEN 

Green.

OSDP_LED_COLOR_AMBER 

Amber.

OSDP_LED_COLOR_BLUE 

Blue.

OSDP_LED_COLOR_SENTINEL 

Max value.

Function Documentation

◆ osdp_get_sc_status_mask()

uint32_t osdp_get_sc_status_mask ( void )

Get the current SC status mask.

Returns
SC status mask

◆ osdp_pd_notify_event()

int osdp_pd_notify_event ( const struct osdp_event * event)

API to notify PD events to CP.

These events are sent to the CP as an alternate response to a POLL command.

Parameters
eventpointer to event struct. Must be filled by application.
Return values
0on success
-1on failure

◆ osdp_pd_set_command_callback()

void osdp_pd_set_command_callback ( pd_command_callback_t cb,
void * arg )

Set callback method for PD command notification.

This callback is invoked when the PD receives a command from the CP.

Parameters
cbThe callback function's pointer
argA pointer that will be passed as the first argument of cb