#include <SFBNet.h>
Data Structures | |
struct | Entry |
Public Types | |
enum | Sizes { MAX_TOTAL_SVCS = 64, MAX_LOCAL_SVCS = 32, MAX_RETURN_ROUTE_LENGTH = 100 } |
Scaling limits for SFBNet. More... | |
Public Member Functions | |
bool | shouldTakeFirstTie () |
Access tie-breaking strategy for equal-length routing decisions. | |
void | setShouldTakeFirstTie (bool on) |
Control tie-breaking strategy for equal-length routing decisions. | |
void | begin () |
Initializes the Net, by registering the 'N' reflex and starting the broadcast alarm. | |
bool | isActive () |
true if the most-recent call to begin() is newer than the most-recent call to end(). | |
void | end () |
Stops the Net. | |
void | offer (u8 service) |
Specifies that service is now locally provided. | |
bool | withhold (u8 service) |
Specifies that service is not (or no longer) locally provided. | |
bool | isOfferedByNode (u8 service) |
Is service currently being offered locally by this node? | |
bool | isOfferedByNet (u8 service) |
Is service being currently offered anywhere on the grid (as far as we know)? | |
void | openServiceStream (u8 service) |
Opens a "connection" with a service provider. | |
void | printf (const char *fmt,...) |
Prints formatted output to the currently open service. | |
void | vprintf (const char *fmt, va_list &ap) |
Prints formatted output to the currently open service. | |
void | printf (u8 service, const char *fmt,...) |
Prints formatted output to a provider of service, if any. | |
void | setBroadcastPeriod (u32 millis) |
Sets the broadcast period to approximately millis. | |
void | setHorizon (u32 distance) |
Sets the TTL ('Time To Live') horizon for all Net packets originating at this node to distance. | |
u32 | getHorizon () |
Gets the TTL ('Time To Live') horizon used for all Net packets originating at this node. | |
u32 | getServiceStreamFace () |
Get the virtual face used for printing to the internal packet buffer. | |
bool | neighborActive (u8 face) |
Returns true if we have recently heard SFBNet activity from face . | |
void | printPath (u8 toFace, bool skipFirst=true) |
void | dump (u8 face, const u8 *prefix=0) |
Log internal state to face for debugging. |
Allows a sketch to offer 'services' to a (region of) connected boards. Service requests from the network appear as simple reflex triggerings on the service-offering board; replies generated during reflex processing can be automatically reverse-routed to the requesting board.
enum SFBNet::Sizes |
Scaling limits for SFBNet.
Increasing these values increases the SFBNet RAM footprint.
u32 SFBNet::getHorizon | ( | ) | [inline] |
Gets the TTL ('Time To Live') horizon used for all Net packets originating at this node.
bool SFBNet::isOfferedByNet | ( | u8 | service | ) |
Is service being currently offered anywhere on the grid (as far as we know)?
true
iff it is.bool SFBNet::isOfferedByNode | ( | u8 | service | ) |
Is service currently being offered locally by this node?
true
iff it is.void SFBNet::offer | ( | u8 | service | ) |
Specifies that service is now locally provided.
Changes nothing if service was already locally provided.
void SFBNet::openServiceStream | ( | u8 | service | ) |
Opens a "connection" with a service provider.
That is, it sets the currently selected service to service, such that, when a newline is printed, the current contents of the internal packet buffer are shipped out to a provider of service.
void SFBNet::printf | ( | const char * | fmt, | |
... | ||||
) |
Prints formatted output to the currently open service.
void SFBNet::setBroadcastPeriod | ( | u32 | millis | ) |
Sets the broadcast period to approximately millis.
Actual range of values is about 0.25 seconds to about one minute, at a granularity of about a quarter second; millis values outside that range will be clipped to the nearest value. Default value is about 5 seconds. A smaller period responds faster to node connectivity changes, but increases overall network traffic.
void SFBNet::setHorizon | ( | u32 | distance | ) |
Sets the TTL ('Time To Live') horizon for all Net packets originating at this node to distance.
Default value 6. Increasing the TTL increases the effective 'radius' of the Net, but greatly increases the amount of traffic sent during broadcasts.
void SFBNet::setShouldTakeFirstTie | ( | bool | on | ) | [inline] |
Control tie-breaking strategy for equal-length routing decisions.
Determines whether shortest-direction ties should be resolved in favor of the first such direction encountered (on set to true
) or by a random choice (on set to false
).
bool SFBNet::shouldTakeFirstTie | ( | ) | [inline] |
Access tie-breaking strategy for equal-length routing decisions.
true
if configured to route to the first-encountered among all equally shortest directions; false
if picking randomly among all such choices.void SFBNet::vprintf | ( | const char * | fmt, | |
va_list & | ap | |||
) |
bool SFBNet::withhold | ( | u8 | service | ) |
Specifies that service is not (or no longer) locally provided.
true
iff service had been being offered before this call.