Re: [Hamlib-developer] rig_caps_register
Library to control radio transceivers and receivers
Brought to you by:
n0nb
|
From: Stephane F. <f4...@fr...> - 2000-09-19 06:19:16
|
Frank Singleton wrote:
>
> In order for rig.c to populate the rig_caps array automagically,as
> suggested
>
[..]
> We could have backend call a frontend rig_caps_register function that
> simple passes an address of their own cap structure into
> the rig_caps array in rig.c
>
> ie:
>
> int rig_caps_register(RIG *rig) {
>
you mean int rig_caps_register(const struct rig_caps *my_backend_caps)
> .... insert cap ptr into rig_base[]
> .... and return result to caller
>
> }
>
> This way, frontend can init all backends via a rig_backend_poll()
> function. backends must respond by registering their caps,
> rig_caps_register() and
> any other things we may add in future :-)
>
So if I understand correctly, the rig_backend_poll() function
(called by who?) would call some backend initializer function
(constructor?) that would in term call rig_caps_register().
Well, this is not too far fetched, especially if you consider
the dlopen/_init facility (in case of external loadable modules).
> This way
>
> rig_caps *rig_base[MAX_RIG_CAPS] will be
> dynamically populated.
>
> eg:
>
> frontend backend
> -------- -------
>
> for all rigs do
gotcha! there you still have to have a backend array with pointer to
functions, or at least explicitly reference all the backend
constructors.
>
> rig_backend_poll
> --------------------->
>
> rig_caps_regisyter
> <--------------------- ft747_caps
>
> rig_backend_poll
> --------------------->
>
[...]
> rig_base[] is now populated ...
>
>
> The rig_backend_poll could be done at
> loading of the frontend libhamlib library that
> can access all the backends.
>
This idea needs some maturation, let's think about it,
see how we can work it out.
> Also, should we have 1 lib "libhamlib"
> that contains the frontend and all the backends (easy), or
> should we load frontend "libhamlib" and he can
> dynamically load backend libraries on demand.
> This second option is probably more
> professional ;-)
and also more fun :-)
As usual, I think both are good, like in SANE (no pun here :)
--
Stephane Fillod F4CFE
|