Refactor indiapi structures
It comes back like a boomerang.
The goal is to arrange the fields in the structures so that they are close to each other. This will help with the property work to ultimately manage memory (which is a nuisance in blobs).
With this organization, I can introduce a more generic structure to the library and simplify some implementations.
/* this is just an example */
typedef struct _IGeneric
{
/** Helper info */
void *aux;
/** Pointer to parent */
void *parent;
/** Index name */
char name[MAXINDINAME];
/** Short description */
char label[MAXINDILABEL];
union
{
struct
{
/** Allocated text string */
char *text;
} itext;
struct
{
/** GUI display format, see above */
char format[MAXINDIFORMAT];
/** Range min, ignored if min == max */
double min;
/** Range max, ignored if min == max */
double max;
/** Step size, ignored if step == 0 */
double step;
/** Current value */
double value;
} inumber;
struct
{
/** Switch state */
ISState s;
} iswitch;
struct
{
/** Light state */
IPState s;
} ilight;
struct
{
/** Format attr */
char format[MAXINDIBLOBFMT];
/** Allocated binary large object bytes - maybe a shared buffer: use IDSharedBlobFree to free*/
void *blob;
/** Blob size in bytes */
int bloblen;
/** N uncompressed bytes */
int size;
} iblob;
};
} IGeneric;
typedef struct _IGenericVectorProperty
{
/** Helper info */
void *aux;
/** Device name */
char device[MAXINDIDEVICE];
/** Property name */
char name[MAXINDINAME];
/** Short description */
char label[MAXINDILABEL];
/** GUI grouping hint */
char group[MAXINDIGROUP];
/** Current property state */
IPState s;
/** Widgets comprising this vector */
void *widgets;
/** Dimension of widgets[] */
int count;
/** ISO 8601 timestamp of this event */
char timestamp[MAXINDITSTAMP];
/** Current max time to change, secs */
double timeout;
/** Client accessibility hint */
IPerm p;
union
{
struct
{
/** Switch behavior hint */
ISRule r;
} iswitch;
};
} IGenericVectorProperty;
Apart from changing the location of the field data, the most significant change is the removal of aux0, aux1, aux2 and leaving only aux.
This is not a problem with INDI Core and INDI 3-rdparty.
A small problem arises with the KStars implementation where aux2 is used, among other things.
I leave the topic as a draft open for discussion.
Ok I think this would even lead to more significant changes for 2.0.0. There is already a large burden on 3rd party client code to be updated (if they happen to rely on INDI::BaseClient).