Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions include/osdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -937,9 +937,36 @@ enum osdp_event_type {
OSDP_EVENT_MFGREP, /**< Manufacturer specific reply event */
OSDP_EVENT_STATUS, /**< Status event */
OSDP_EVENT_NOTIFICATION, /**< LibOSDP notification event */
OSDP_EVENT_FILE, /**< File event */
OSDP_EVENT_SENTINEL /**< Max event value */
};

/**
* @brief File Transfer Status Detail
*/
enum osdp_event_file_status_e {
OSDP_FILE_STATUS_OK_TO_PROCEED = 0,
OSDP_FILE_STATUS_PROCESSED = 1,
OSDP_FILE_STATUS_REBOOTING = 2,
OSDP_FILE_STATUS_PD_FINISHING = 3,
OSDP_FILE_STATUS_ABORT = -1,
OSDP_FILE_STATUS_UNRECOGNIZED_CONTENTS = -2,
OSDP_FILE_STATUS_MALFORMED_DATA = -3
};

/**
* @brief OSDP Event file transfer status
*
* The event indicates the status of the file transfer for a file id.
*
* @param id id of the transferred file
* @param status status of the file
*/
struct osdp_event_file {
int id; /**< ID of the transferred file */
enum osdp_event_file_status_e status; /**< Status of the file transfer */
};

/**
* @brief OSDP Event structure.
*/
Expand All @@ -954,6 +981,7 @@ struct osdp_event {
struct osdp_event_mfgrep mfgrep; /**< Manufacturer specific response event struture */
struct osdp_status_report status; /**< Status report event structure */
struct osdp_event_notification notif;/**< Notification event structure */
struct osdp_event_file file; /**< File transfer event structure */
};
};

Expand Down
8 changes: 8 additions & 0 deletions src/osdp_cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,14 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
break;
case REPLY_FTSTAT:
ret = osdp_file_cmd_stat_decode(pd, buf + pos, len);
if (ret == 0) {
struct osdp_cmd_file_stat *p = (struct osdp_cmd_file_stat *)(buf + pos);
struct osdp_file *f = TO_FILE(pd);
event.type = OSDP_EVENT_FILE;
event.file.id = f->file_id;
event.file.status = (enum osdp_event_file_status_e)(p->status);
cp_dispatch_event(pd, &event);
}
break;
case REPLY_CCRYPT:
if (sc_is_active(pd) || pd->cmd_id != CMD_CHLNG) {
Expand Down
Loading