Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ePacket interface APIs

ePacket interface API More...

Topics

 ePacket Bluetooth GATT central interface
 ePacket Bluetooth GATT central interface
 ePacket Bluetooth GATT peripheral interface
 ePacket Bluetooth GATT peripheral interface
 ePacket Bluetooth advertising interface
 ePacket Bluetooth advertising interface
 ePacket Bluetooth common definitions
 ePacket Bluetooth common definitions
 ePacket UDP interface
 ePacket UDP interface
 ePacket dummy interface
 ePacket dummy interface
 ePacket interface common APIs
 ePacket interface common API
 ePacket serial interface
 ePacket serial interface

Data Structures

struct  epacket_interface_cb
 ePacket interface callback structure. More...
struct  epacket_interface_api
 ePacket interface driver API More...
struct  epacket_interface_common_data
 Common data struct for all interfaces. More...
struct  epacket_interface_common_config
 Common config struct for all interfaces. More...

Macros

#define EPACKET_INTERFACE_MAX_PACKET(node_id)
 Maximum packet size on an interface, limited by CONFIG_EPACKET_PACKET_SIZE_MAX.
#define EPACKET_INTERFACE_PACKET_OVERHEAD(node_id)
 Overhead of the interface on packet size.
#define EPACKET_INTERFACE_PAYLOAD_FROM_PACKET(node_id, packet_size)
 Get the maximum payload size for a given packet size.
#define EPACKET_INTERFACE_MAX_PAYLOAD(node_id)
 Maximum payload size on an interface.
#define EPACKET_INTERFACE_IS_COMPILED_IN(node_id)
 Will this ePacket interface be compiled in?
#define GATEWAY_HANDLER_DEFINE(name, backhaul)
 Define a handler for a specific backhaul interface.

Typedefs

typedef void(* epacket_receive_handler) (struct net_buf *packet)
 Callback to run on received packet.

Enumerations

enum  epacket_interface_id {
  EPACKET_INTERFACE_SERIAL = 0 , EPACKET_INTERFACE_UDP = 1 , EPACKET_INTERFACE_BT_ADV = 2 , EPACKET_INTERFACE_BT_PERIPHERAL = 3 ,
  EPACKET_INTERFACE_BT_CENTRAL = 4 , EPACKET_INTERFACE_HCI = 10 , EPACKET_INTERFACE_DUMMY = 255
}
 Identifier for ePacket interface. More...

Functions

void epacket_queue (const struct device *dev, struct net_buf *buf)
 Queue an ePacket for sending over an interface.
int epacket_receive (const struct device *dev, k_timeout_t timeout)
 Enable receiving on the interface for a duration.
int epacket_send_key_ids (const struct device *dev, k_timeout_t timeout)
 Send a INFUSE_KEY_IDS packet on an interface.
static uint16_t epacket_interface_max_packet_size (const struct device *dev)
 Get current maximum packet size.
static void epacket_set_receive_handler (const struct device *dev, epacket_receive_handler handler)
 Set the ePacket receive handler for an interface.
static void epacket_register_callback (const struct device *dev, struct epacket_interface_cb *cb)
 Register to be notified of interface events.
static bool epacket_unregister_callback (const struct device *dev, struct epacket_interface_cb *cb)
 Unregister from interface events.
void epacket_default_receive_handler (struct net_buf *buf)
 Default ePacket receive handler.
void epacket_gateway_receive_handler (const struct device *backhaul, struct net_buf *buf)
 Default gateway receive handler.

Detailed Description

ePacket interface API

Macro Definition Documentation

◆ EPACKET_INTERFACE_IS_COMPILED_IN

#define EPACKET_INTERFACE_IS_COMPILED_IN ( node_id)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Value:
IS_ENABLED(DT_STRING_TOKEN(node_id, depends_on))

Will this ePacket interface be compiled in?

Parameters
node_idePacket interface node identitier
Return values
1if interface will be compiled in
0if interface will NOT be compiled in

◆ EPACKET_INTERFACE_MAX_PACKET

#define EPACKET_INTERFACE_MAX_PACKET ( node_id)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Value:
(MIN(CONFIG_EPACKET_PACKET_SIZE_MAX, \
DT_PROP_OR(node_id, max_packet_size, CONFIG_EPACKET_PACKET_SIZE_MAX)))

Maximum packet size on an interface, limited by CONFIG_EPACKET_PACKET_SIZE_MAX.

Parameters
node_idePacket interface node identifier

◆ EPACKET_INTERFACE_MAX_PAYLOAD

#define EPACKET_INTERFACE_MAX_PAYLOAD ( node_id)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Value:
#define EPACKET_INTERFACE_PAYLOAD_FROM_PACKET(node_id, packet_size)
Get the maximum payload size for a given packet size.
Definition interface.h:51
#define EPACKET_INTERFACE_MAX_PACKET(node_id)
Maximum packet size on an interface, limited by CONFIG_EPACKET_PACKET_SIZE_MAX.
Definition interface.h:35

Maximum payload size on an interface.

Parameters
node_idePacket interface node identifier

◆ EPACKET_INTERFACE_PACKET_OVERHEAD

#define EPACKET_INTERFACE_PACKET_OVERHEAD ( node_id)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Value:
(DT_PROP(node_id, header_size) + DT_PROP(node_id, footer_size))

Overhead of the interface on packet size.

Parameters
node_idePacket interface node identifier

◆ EPACKET_INTERFACE_PAYLOAD_FROM_PACKET

#define EPACKET_INTERFACE_PAYLOAD_FROM_PACKET ( node_id,
packet_size )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Value:
(MIN(packet_size, CONFIG_EPACKET_PACKET_SIZE_MAX) - \
EPACKET_INTERFACE_PACKET_OVERHEAD(node_id))

Get the maximum payload size for a given packet size.

Parameters
node_idePacket interface node identifier
packet_sizePacket size to compute the payload size for

◆ GATEWAY_HANDLER_DEFINE

#define GATEWAY_HANDLER_DEFINE ( name,
backhaul )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Value:
static void name(struct net_buf *buf) \
{ \
epacket_gateway_receive_handler(backhaul, buf); \
}

Define a handler for a specific backhaul interface.

Parameters
nameName of handler function
backhaulBackhaul interface

Typedef Documentation

◆ epacket_receive_handler

typedef void(* epacket_receive_handler) (struct net_buf *packet)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Callback to run on received packet.

Parameters
packetReceived packet payload

Enumeration Type Documentation

◆ epacket_interface_id

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Identifier for ePacket interface.

Enumerator
EPACKET_INTERFACE_SERIAL 

Serial interface.

EPACKET_INTERFACE_UDP 

UDP interface.

EPACKET_INTERFACE_BT_ADV 

Bluetooth advertising interface.

EPACKET_INTERFACE_BT_PERIPHERAL 

Bluetooth GATT peripheral interface.

EPACKET_INTERFACE_BT_CENTRAL 

Bluetooth GATT central interface.

EPACKET_INTERFACE_HCI 

HCI interface.

EPACKET_INTERFACE_DUMMY 

Dummy interface for testing.

Function Documentation

◆ epacket_default_receive_handler()

void epacket_default_receive_handler ( struct net_buf * buf)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Default ePacket receive handler.

Currently handles echo and RPC requests.

Parameters
bufePacket that was received

◆ epacket_gateway_receive_handler()

void epacket_gateway_receive_handler ( const struct device * backhaul,
struct net_buf * buf )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Default gateway receive handler.

Received Bluetooth advertising packets are forwarded over backhaul. All other packets handled by epacket_default_receive_handler.

Parameters
backhaulePacket interface to forward packets on.
bufePacket that was received

◆ epacket_interface_max_packet_size()

uint16_t epacket_interface_max_packet_size ( const struct device * dev)
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Get current maximum packet size.

Parameters
devInterface to query
Return values
sizeMaximum packet size (header + payload + footer)

◆ epacket_queue()

void epacket_queue ( const struct device * dev,
struct net_buf * buf )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Queue an ePacket for sending over an interface.

Parameters
devInterface to send packet on
bufPacket to send

◆ epacket_receive()

int epacket_receive ( const struct device * dev,
k_timeout_t timeout )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Enable receiving on the interface for a duration.

Note
Each call to this function overrides any previous configured duration. For example, scheduling a 100 second receive then immediately scheduling a 10 second receive will result in a 10 second receive window.
Parameters
devInterface to control receive on
timeoutDuration to receive for. K_FOREVER = Receive forever K_NO_WAIT = Stop receiving immediately
Return values
-ENOTSUPif interface does not support RX control
errnoif receive control failed
0if receiving stopped immediately
1if receive stop has been scheduled for the future

◆ epacket_register_callback()

void epacket_register_callback ( const struct device * dev,
struct epacket_interface_cb * cb )
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Register to be notified of interface events.

Parameters
devInterface to receive callbacks for
cbCallback struct to register

◆ epacket_send_key_ids()

int epacket_send_key_ids ( const struct device * dev,
k_timeout_t timeout )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Send a INFUSE_KEY_IDS packet on an interface.

Parameters
devInterface to send packet on
timeoutDuration to wait for message buffer
Return values
0If packet was queued
-EAGAINIf packet buffer claim timed out

◆ epacket_set_receive_handler()

void epacket_set_receive_handler ( const struct device * dev,
epacket_receive_handler handler )
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Set the ePacket receive handler for an interface.

Parameters
devInterface to set handler for
handlerHandler function to run on received packets

◆ epacket_unregister_callback()

bool epacket_unregister_callback ( const struct device * dev,
struct epacket_interface_cb * cb )
inlinestatic

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/epacket/interface.h>

Unregister from interface events.

Parameters
devInterface to unregister from
cbCallback struct to unregister
Return values
trueIf structure was removed from callback list
falseIf structure was not present on list