Renee Danson wrote: > On Thu, Jan 29, 2009 at 02:29:45PM -0500, Anurag S. Maskey wrote: > >> I think this is a typo in the door fuction nwamd. I want to confirm >> that I'm not missing anything. >> >> nwam_*_enable() calls nwam_action() with NWAM_REQUEST_TYPE_*_ACTION. >> This command is then passed to the door function door_switch() in >> nwamd. door_switch() on the other hand is checking for >> NWAM_EVENT_TYPE_*, which I am guessing is a typo and should be >> NWAM_REQUEST_TYPE_*, right? >> > > Hmm. We seem to have two different namespaces, probably the result of > work being done at two different points in time, possibly by two different > people! I think the different names are more than just typos; we need > to figure out how this interface is really being used and make sure it > works properly. > > libnwam.h (the public header for the library) has a list of "Event > notification definitions", which are of the form NWAM_EVENT_TYPE_<foo>. > One of these is the NWAM_EVENT_TYPE_ENM_ACTION which is handled by the > door server in nwamd (implemented in the door_switch() function). But > there aren't any corresponding event types for Locs or NCPs, as you > point out. > > libnwam_impl.h (the private header for the library) includes an > nwam_request_type_t enum, which covers the NWAM_REQUEST_TYPE_<foo> > definitions. This one does include ENM_ACTION, LOC_ACTION, and > NCP_ACTION defs. > > It seems to me that the door interface is being used in two ways: > > * Making (likely synchronous) queries of nwamd about the current > state (what's the active ncp? is enm foo active?), or to request > that nwamd do things (such as activating a particular location). > > * Asking for (and later receiving?) notifications of various events. > > Yep, you're dead right. > I suspect the NWAM_REQUEST_TYPE_<foo> definitions were introduced by > someone working on the former, while the NWAM_EVENT_TYPE_<foo> defs > were introduced by someone working on the latter. > > This conflict obviously needs to be resolved. Alan and Michael, the > two of you have done the most work in libnwam and nwamd; do you have > input on this? > > I think I introduced the requests, I could be wrong. The events are in the public header so the UI can use them, but I think the requests should be moved there too so that nwamadm can use them. Basically as Renee says we've got two types of situation - the user sends a request either for information (what's the active NCP etc) or as a request to register for events. The former should invoke a direct response with the data, while the latter is called internally via nwam_events_register() to kick off an event thread in the UI with a specified callback function.
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). Alan
