modbus_mapping_t

219 views
Skip to first unread message

Aryeh Rossignoli

unread,
Jul 20, 2016, 3:14:41 AM7/20/16
to libmodbus
Hi,

first of all many compliments for your library.

I've start writing a Java library that access your library thanks to Java Native Access library.

It's working very well.

About the slave part I did it with version 3.0.6 but then I noticed that modbus_mapping_t struct has been changed to support offsets:

typedef struct {
int nb_bits;
+ int offset_bits;
int nb_input_bits;
+ int offset_input_bits;
int nb_input_registers;
+ int offset_input_registers;
int nb_registers;
+ int offset_registers;
uint8_t *tab_bits;
uint8_t *tab_input_bits;
uint16_t *tab_input_registers;
My question, was not better to add the new fields at the end of the struct ?

It would be compatible with older versions.

Or even better, why not create some functions to access the struct fields ?

Such as:

uint8_t *modbus_mapping_get_input_bits(modbus_mapping_t *);

uint16_t *modbus_mapping_get_input_registers(modbus_mapping_t *);

uint16_t *modbus_mapping_get_registers(modbus_mapping_t *);

etc

Thank you.
Aryeh

Stéphane Raimbault

unread,
Nov 27, 2017, 6:08:58 AM11/27/17
to libm...@googlegroups.com
I don't want to add new functions but you're right I could kept the new lib v3.2 backward compatible by adding them at the end.

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "libmodbus".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse libmodbus+unsubscribe@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages