Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Best-effort local area broadcast

The broadcast module sends packets to all local area neighbors with an a header that identifies the sender.

The broadcast module sends a packet to all local neighbors. The module adds the single-hop sender address as a packet attribute to outgoing packets. All Rime primitives that need the identity of the sender in the outgoing packets use the broadcast primitive, either directly or indirectly through any of the other communication primitives that are based on the broadcast primitive.

Channels

The broadcast module uses 1 channel.

Data Structures

struct  broadcast_callbacks
 Callback structure for broadcast. More...
 
struct  broadcast_conn
 

Files

file  broadcast.h
 
    Header file for identified best-effort local area broadcast

 

Macros

#define BROADCAST_ATTRIBUTES
 

Functions

void broadcast_close (struct broadcast_conn *c)
 Close a broadcast connection. More...
 
void broadcast_open (struct broadcast_conn *c, uint16_t channel, const struct broadcast_callbacks *u)
 Set up an identified best-effort broadcast connection. More...
 
int broadcast_send (struct broadcast_conn *c)
 Send an identified best-effort broadcast packet. More...
 

#define BROADCAST_ATTRIBUTES
Value:
Definition: packetbuf.h:377
#define PACKETBUF_ADDRSIZE
Definition: packetbuf.h:446
#define ABC_ATTRIBUTES
Definition: abc.h:65

void broadcast_close ( struct broadcast_conn c)

Close a broadcast connection.

Parameters
cA pointer to a struct broadcast_conn
        This function closes a broadcast connection that has
        previously been opened with broadcast_open().

        This function typically is called as an exit handler.
void broadcast_open ( struct broadcast_conn c,
uint16_t  channel,
const struct broadcast_callbacks u 
)

Set up an identified best-effort broadcast connection.

Parameters
cA pointer to a struct broadcast_conn
channelThe channel on which the connection will operate
uA struct broadcast_callbacks with function pointers to functions that will be called when a packet has been received
        This function sets up a broadcast connection on the
        specified channel. The caller must have allocated the
        memory for the struct broadcast_conn, usually by declaring it
        as a static variable.

        The struct broadcast_callbacks pointer must point to a structure
        containing a pointer to a function that will be called
        when a packet arrives on the channel.
int broadcast_send ( struct broadcast_conn c)

Send an identified best-effort broadcast packet.

Parameters
cThe broadcast connection on which the packet should be sent
Return values
Non-zeroif the packet could be sent, zero otherwise
        This function sends an identified best-effort broadcast
        packet. The packet must be present in the packetbuf
        before this function is called.

        The parameter c must point to a broadcast connection that
        must have previously been set up with broadcast_open().