Anurag S. Maskey wrote:
>> Actually, scratch that. They should stay
>> in libnwam_impl.h, since they will only be
>> used under the hood by the libnwam calls
>> Anurag described to get the active objects.
>> door_if.c in nwamd has a #include for
>> libnwam_impl.h. I don't think stuff like
>> this belongs in the public header since it's
>> only needed by the daemon, but I could
>> be wrong.
>>
>>
> That's right.
>
>
>> I think what we need to do is modify
>> nwamd/door_if.c to handle ENM, loc and NCP
>> requests and return the active entity
>> (or entities in the case of ENMs).
>>
> I'll add a new request action (NWAM_ACTION_ACTIVE) to ask for the
> currently active entities, and have door_swtich() handle these request.
>
> Also, I'll complete door_switch() by having it handle the
> activate/deactivate requests. This will mean having nwamd_*_enable()
> and nwamd_*_disable() for all three entities.
>
> pseudocode along the lines of ...
>
> switch (request_type) :
> ...
> case NWAM_REQUEST_TYPE_<foo>_ACTION:
> switch (action) {
> case NWAM_ACTION_[DE]ACTIVATE:
> object = nwam_object_find(<foo>, name)
> int ret = nwamd_<foo>_[dis,en]able(object)
> set status for return object depending on value of ret
> break;
> case NWAM_ACTION_ACTIVE:
> object_list = nwamd_get_object_list(<foo>)
> loop through objects to find object->object_state == ONLINE
> set req_name in return object to object->name
> break;
> }
> ...
>
>
>
sounds great! The only wrinkle is that
if the user asks to activate an NCP,
it won't be in an object list (since the
NCU object list actually comprises
the NCUs of the active NCP). I'm going
to introduce a global active_ncp string, so
you could just check if the activate
action specifies the same NCP - if
so it's a no-op, if not, we'll need
an nwamd_ncp_activate() function
which updates the active-ncp property,
the internal active_ncp string and
dumps the old ncu object list, replacing
it with the ncu object list for the now-active
NCP. I'm hoping I'll have most of that
done today, but in case I don't that's
the rough idea. Thanks!
Alan