Samraksh / eMote

eMote OS -- Multiple Ports (using .NET MF v4.3)
0 stars 0 forks source link

Change callback for MACBase #372

Open WilliamAtSamraksh opened 8 years ago

WilliamAtSamraksh commented 8 years ago

At present the way CSMA callbacks are specified is via MACBase.Configure, providing callback methods as arguments for receive & neighbor change events. This is non-standard. It requires exactly one callback handler for each event type and makes it awkward (and inefficient) to allow zero or many callback handlers, something that is useful if there are separate listeners (such as a main protocol and a health monitor).

I suggest obsoleting

DeviceStatus Configure(MacConfiguration config, ReceiveCallBack receiveCallback, NeighborhoodChangeCallBack neighborChangeCallback)

and replacing it with

DeviceStatus Configure(MacConfiguration config)

along with OnReceive and OnNeighborChange events that can be subscribed in the usual way.

This would be a modest change and would be backward-compatible.

ChrisAtSamraksh commented 8 years ago

Yeah, this is the way to properly do this. When OMAC is integrated into the master we can put this change in at that point.