Skip to content

Commit

Permalink
fix: passes through command id using ENUM const.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuckya committed May 19, 2023
1 parent 35cd5ca commit 2fd108c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions python/pyosdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void pyosdp_add_module_constants(PyObject *module)
ADD_CONST("CMD_KEYSET", OSDP_CMD_KEYSET);
ADD_CONST("CMD_MFG", OSDP_CMD_MFG);
ADD_CONST("CMD_FILE_TX", OSDP_CMD_FILE_TX);
ADD_CONST("CMD_STATUS", OSDP_CMD_STATUS);

/* For `struct osdp_cmd_file_tx`::flags */
ADD_CONST("CMD_FILE_TX_FLAG_CANCEL", OSDP_CMD_FILE_TX_FLAG_CANCEL);
Expand Down
8 changes: 6 additions & 2 deletions python/pyosdp_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,11 @@ static int pyosdp_make_struct_cmd_file_tx(struct osdp_cmd *p, PyObject *dict)
}

/* Dummies for commands that don't have any body */
static int pyosdp_make_struct_cmd_dummy(struct osdp_cmd *cmd, PyObject *obj) { return 0; }
static int pyosdp_make_struct_cmd_dummy(struct osdp_cmd *cmd, PyObject *obj) {
cmd->id = OSDP_CMD_STATUS;

return 0;
}
static int pyosdp_make_dict_cmd_dummy(PyObject *obj, struct osdp_cmd *cmd) { return 0; }


Expand Down Expand Up @@ -695,4 +699,4 @@ int pyosdp_make_dict_event(PyObject **dict, struct osdp_event *event)

*dict = obj;
return 0;
}
}

0 comments on commit 2fd108c

Please sign in to comment.