Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
osdp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Siddharth Chandrasekaran <siddharth@embedjournal.com>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_MGMT_OSDP_H_
13#define ZEPHYR_INCLUDE_MGMT_OSDP_H_
14
15#include <zephyr/kernel.h>
16#include <stdint.h>
17
18#include <zephyr/sys/slist.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#define OSDP_CMD_TEXT_MAX_LEN 32
25#define OSDP_CMD_KEYSET_KEY_MAX_LEN 32
26#define OSDP_EVENT_MAX_DATALEN 64
55
67
105
127
157
195
212
236
249
273
284
317
337
346
352 sys_snode_t node;
360 union {
363 };
364};
365
381typedef int (*pd_command_callback_t)(void *arg, struct osdp_cmd *cmd);
382
396typedef int (*cp_event_callback_t)(void *arg, int pd, struct osdp_event *ev);
397
398#if defined(CONFIG_OSDP_MODE_PD) || defined(__DOXYGEN__)
399
414
424int osdp_pd_notify_event(const struct osdp_event *event);
425
430#else /* CONFIG_OSDP_MODE_PD */
431
444int osdp_cp_send_command(int pd, struct osdp_cmd *cmd);
445
446
454void osdp_cp_set_event_callback(cp_event_callback_t cb, void *arg);
455
456#endif /* CONFIG_OSDP_MODE_PD */
457
458#if defined(CONFIG_OSDP_SC_ENABLED) || defined(__DOXYGEN__)
459
472
477#endif
478
479#ifdef __cplusplus
480}
481#endif
482
483#endif /* ZEPHYR_INCLUDE_MGMT_OSDP_H_ */
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition ft8xx_reference_api.h:153
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
Public kernel APIs.
#define OSDP_CMD_KEYSET_KEY_MAX_LEN
Max length of key data for keyset command.
Definition osdp.h:25
int(* pd_command_callback_t)(void *arg, struct osdp_cmd *cmd)
Callback for PD command notifications.
Definition osdp.h:381
osdp_event_type
OSDP PD Events.
Definition osdp.h:341
@ OSDP_EVENT_CARDREAD
Card read event.
Definition osdp.h:342
@ OSDP_EVENT_SENTINEL
Max event value.
Definition osdp.h:344
@ OSDP_EVENT_KEYPRESS
Keypad press event.
Definition osdp.h:343
osdp_event_cardread_format_e
Various card formats that a PD can support.
Definition osdp.h:278
@ OSDP_CARD_FMT_ASCII
ASCII card format.
Definition osdp.h:281
@ OSDP_CARD_FMT_SENTINEL
Max card format value.
Definition osdp.h:282
@ OSDP_CARD_FMT_RAW_UNSPECIFIED
Unspecified card format.
Definition osdp.h:279
@ OSDP_CARD_FMT_RAW_WIEGAND
Wiegand card format.
Definition osdp.h:280
osdp_led_color_e
LED Colors as specified in OSDP for the on_color/off_color parameters.
Definition osdp.h:59
@ OSDP_LED_COLOR_SENTINEL
Max value.
Definition osdp.h:65
@ OSDP_LED_COLOR_RED
Red.
Definition osdp.h:61
@ OSDP_LED_COLOR_NONE
No color.
Definition osdp.h:60
@ OSDP_LED_COLOR_GREEN
Green.
Definition osdp.h:62
@ OSDP_LED_COLOR_BLUE
Blue.
Definition osdp.h:64
@ OSDP_LED_COLOR_AMBER
Amber.
Definition osdp.h:63
int(* cp_event_callback_t)(void *arg, int pd, struct osdp_event *ev)
Callback for CP event notifications.
Definition osdp.h:396
void osdp_pd_set_command_callback(pd_command_callback_t cb, void *arg)
Set callback method for PD command notification.
uint32_t osdp_get_sc_status_mask(void)
Get the current SC status mask.
osdp_cmd_e
OSDP application exposed commands.
Definition osdp.h:240
@ OSDP_CMD_COMSET
PD Communication Configuration Command.
Definition osdp.h:246
@ OSDP_CMD_KEYSET
Encryption Key Set Command.
Definition osdp.h:245
@ OSDP_CMD_LED
Reader LED control command.
Definition osdp.h:242
@ OSDP_CMD_SENTINEL
Max command value.
Definition osdp.h:247
@ OSDP_CMD_BUZZER
Reader buzzer control command.
Definition osdp.h:243
@ OSDP_CMD_OUTPUT
Output control command.
Definition osdp.h:241
@ OSDP_CMD_TEXT
Reader text output command.
Definition osdp.h:244
int osdp_pd_notify_event(const struct osdp_event *event)
API to notify PD events to CP.
#define OSDP_CMD_TEXT_MAX_LEN
Max length of text for text command.
Definition osdp.h:24
#define OSDP_EVENT_MAX_DATALEN
Max length of event data.
Definition osdp.h:26
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Sent from CP to control the behaviour of a buzzer in the PD.
Definition osdp.h:131
uint8_t reader
Reader number.
Definition osdp.h:135
uint8_t rep_count
The number of times to repeat the ON/OFF cycle; 0: forever.
Definition osdp.h:155
uint8_t control_code
Control code.
Definition osdp.h:143
uint8_t on_count
The ON duration of the sound, in units of 100 ms.
Definition osdp.h:147
uint8_t off_count
The OFF duration of the sound, in units of 100 ms.
Definition osdp.h:151
Sent in response to a COMSET command.
Definition osdp.h:200
uint32_t baud_rate
Baud rate.
Definition osdp.h:210
uint8_t address
Unit ID to which this PD will respond after the change takes effect.
Definition osdp.h:204
This command transfers an encryption key from the CP to a PD.
Definition osdp.h:221
uint8_t length
Number of bytes of key data - (Key Length in bits + 7) / 8.
Definition osdp.h:230
uint8_t type
Type of keys:
Definition osdp.h:226
uint8_t data[32]
Key data.
Definition osdp.h:234
LED params sub-structure.
Definition osdp.h:71
uint16_t timer_count
Time in units of 100 ms (only for temporary mode).
Definition osdp.h:103
uint8_t off_count
The OFF duration of the flash, in units of 100 ms.
Definition osdp.h:91
uint8_t on_color
Color to set during the ON timer (see osdp_led_color_e).
Definition osdp.h:95
uint8_t off_color
Color to set during the OFF timer (see osdp_led_color_e).
Definition osdp.h:99
uint8_t on_count
The ON duration of the flash, in units of 100 ms.
Definition osdp.h:87
uint8_t control_code
Control code.
Definition osdp.h:83
Sent from CP to PD to control the behaviour of it's on-board LEDs.
Definition osdp.h:109
struct osdp_cmd_led_params permanent
Permanent LED status descriptor.
Definition osdp.h:125
struct osdp_cmd_led_params temporary
Ephemeral LED status descriptor.
Definition osdp.h:121
uint8_t led_number
LED number.
Definition osdp.h:117
uint8_t reader
Reader number.
Definition osdp.h:113
Command sent from CP to Control digital output of PD.
Definition osdp.h:31
uint8_t control_code
Control code.
Definition osdp.h:49
uint16_t timer_count
Time in units of 100 ms.
Definition osdp.h:53
uint8_t output_no
Output number.
Definition osdp.h:37
Command to manipulate any display units that the PD supports.
Definition osdp.h:161
uint8_t offset_row
Row to display the first character (1-indexed)
Definition osdp.h:181
uint8_t data[32]
The string to display.
Definition osdp.h:193
uint8_t reader
Reader number.
Definition osdp.h:165
uint8_t control_code
Control code.
Definition osdp.h:173
uint8_t length
Number of characters in the string.
Definition osdp.h:189
uint8_t offset_col
Column to display the first character (1-indexed)
Definition osdp.h:185
uint8_t temp_time
Duration to display temporary text, in seconds.
Definition osdp.h:177
OSDP Command Structure.
Definition osdp.h:254
enum osdp_cmd_e id
Command ID.
Definition osdp.h:262
struct osdp_cmd_comset comset
Comset command structure.
Definition osdp.h:269
struct osdp_cmd_buzzer buzzer
Buzzer command structure.
Definition osdp.h:266
struct osdp_cmd_text text
Text command structure.
Definition osdp.h:267
struct osdp_cmd_output output
Output command structure.
Definition osdp.h:268
struct osdp_cmd_led led
LED command structure.
Definition osdp.h:265
struct osdp_cmd_keyset keyset
Keyset command structure.
Definition osdp.h:270
OSDP event cardread.
Definition osdp.h:293
int direction
Direction of data in data array.
Definition osdp.h:307
int length
Length of card data in bytes or bits depending on format.
Definition osdp.h:311
enum osdp_event_cardread_format_e format
Format of the card being read.
Definition osdp.h:301
int reader_no
Reader number.
Definition osdp.h:297
uint8_t data[64]
Card data of length bytes or bits bits depending on format.
Definition osdp.h:315
OSDP Event Keypad.
Definition osdp.h:321
int length
Length of keypress data in bytes.
Definition osdp.h:331
uint8_t data[64]
Keypress data of length bytes.
Definition osdp.h:335
int reader_no
Reader number.
Definition osdp.h:327
OSDP Event structure.
Definition osdp.h:350
struct osdp_event_keypress keypress
Keypress event structure.
Definition osdp.h:361
struct osdp_event_cardread cardread
Card read event structure.
Definition osdp.h:362
enum osdp_event_type type
Event type.
Definition osdp.h:358