123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- #ifndef _OSDP_H_
- #define _OSDP_H_
- #include <zephyr.h>
- #include <stdint.h>
- #include <sys/slist.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define OSDP_CMD_TEXT_MAX_LEN 32
- #define OSDP_CMD_KEYSET_KEY_MAX_LEN 32
- enum osdp_card_formats_e {
- OSDP_CARD_FMT_RAW_UNSPECIFIED,
- OSDP_CARD_FMT_RAW_WIEGAND,
- OSDP_CARD_FMT_ASCII,
- OSDP_CARD_FMT_SENTINEL
- };
- struct osdp_cmd_output {
- uint8_t output_no;
- uint8_t control_code;
- uint16_t timer_count;
- };
- 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
- };
- 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 led_number;
- struct osdp_cmd_led_params temporary;
- struct osdp_cmd_led_params permanent;
- };
- 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_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[OSDP_CMD_TEXT_MAX_LEN];
- };
- struct osdp_cmd_comset {
- uint8_t address;
- uint32_t baud_rate;
- };
- struct osdp_cmd_keyset {
- uint8_t type;
- uint8_t length;
- uint8_t data[OSDP_CMD_KEYSET_KEY_MAX_LEN];
- };
- 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
- };
- struct osdp_cmd {
- sys_snode_t node;
- 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;
- };
- };
- #ifdef CONFIG_OSDP_MODE_PD
- int osdp_pd_get_cmd(struct osdp_cmd *cmd);
- #else
- int osdp_cp_set_callback_key_press(
- int (*cb)(int address, uint8_t key));
- int osdp_cp_set_callback_card_read(
- int (*cb)(int address, int format, uint8_t *data, int len));
- int osdp_cp_send_command(int pd, struct osdp_cmd *cmd);
- #endif
- #ifdef CONFIG_OSDP_SC_ENABLED
- uint32_t osdp_get_sc_status_mask(void);
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|