Skip to content

Commit

Permalink
adding get_query_function
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedric Boudinet committed Nov 10, 2022
1 parent dd45f19 commit ea6a047
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/modbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,16 @@ int modbus_get_header_length(modbus_t *ctx)
return ctx->backend->header_length;
}

int modbus_get_query_function(modbus_t *ctx, const uint8_t * req)
{
if (ctx == NULL) {
errno = EINVAL;
return -1;
}

return req[ctx->backend->header_length];
}

int modbus_enable_quirks(modbus_t *ctx, uint32_t quirks_mask)
{
if (ctx == NULL) {
Expand Down
1 change: 1 addition & 0 deletions src/modbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ MODBUS_API int
modbus_set_indication_timeout(modbus_t *ctx, uint32_t to_sec, uint32_t to_usec);

MODBUS_API int modbus_get_header_length(modbus_t *ctx);
int modbus_get_query_function(modbus_t *ctx, const uint8_t * req);

MODBUS_API int modbus_connect(modbus_t *ctx);
MODBUS_API void modbus_close(modbus_t *ctx);
Expand Down

0 comments on commit ea6a047

Please sign in to comment.