Contiki 2.6

Rimebroadcast

Files

file  broadcast.c
 

Identified best-effort local area broadcast (broadcast)


Functions

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

Function Documentation

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.

Examples:
example-broadcast.c.

Definition at line 104 of file broadcast.c.

References abc_close().

Referenced by ipolite_close().

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.

Examples:
example-broadcast.c.

Definition at line 95 of file broadcast.c.

References abc_open().

Referenced by ipolite_open(), and stbroadcast_open().

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().

Examples:
example-broadcast.c.

Definition at line 110 of file broadcast.c.

References abc_send(), and rimeaddr_node_addr.

Referenced by ipolite_send().