Hi fellow coders,

I have implemented AMSender-like structures over and over again and
wondered is it possible to implement this structure more generically?

I had in mind this special component which provides many Send interfaces
and uses only one Send interface.

e.g. something like this cumbrous example:

generic configuration Multiplexer( ... ) {
  provides interface Send[ uint8_t myId ];
  uses interface SubSend;
  ...
}
implementation { ... }

And it is used like this:

implementation {
  components new Multiplexer( unique(...)? ) as Service1;
  components new Multiplexer( unique(...)? ) as Service2;
  components new Multiplexer( unique(...)? ) as Mux;

  components Client1, Client2, Client3, Client4;

  components UnderlyingService;

  Client1.Send -> Service1.Send[SERVICE1_MSG1];
  Client2.Send -> Service1.Send[SERVICE1_MSG2];

  Client3.Send -> Service2.Send[SERVICE2_MSG1];
  Client4.Send -> Service2.Send[SERVICE2_MSG2];

  Service1.SubSend -> Mux.Send[SERVICE1];
  Service2.SubSend -> Mux.Send[SERVICE2];

  Mux.SubSend -> UnderlyingService.Send;
}

Implementing this structure is easy if Multiplexer doesn't implement any
kind of queue. Queue would be nice since it eliminates unnecessary send-command "polling".

Any ideas how to implement this structure or prevent using it at first place?

-Henkka

---
Henrik Raula
henrik.raula< at >tut.fi

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to