13#ifndef INFUSE_SDK_INCLUDE_INFUSE_EPACKET_PACKET_H_
14#define INFUSE_SDK_INCLUDE_INFUSE_EPACKET_PACKET_H_
18#include <zephyr/kernel.h>
19#include <zephyr/device.h>
20#include <zephyr/toolchain.h>
21#include <zephyr/net_buf.h>
22#include <zephyr/bluetooth/bluetooth.h>
53#define EPACKET_ADDR_ALL ((union epacket_interface_address){0})
68#ifdef CONFIG_EPACKET_BUFFERS_TX_DELAYABLE_WORK
69 struct k_work_delayable dwork;
132#define EPACKET_KEY_ID_REQ_MAGIC 0x4D
140#define EPACKET_RATE_LIMIT_REQ_MAGIC 0x4E
epacket_interface_id
Definition interface.h:55
static uint16_t epacket_interface_max_packet_size(const struct device *dev)
Get current maximum packet size.
Definition interface.h:217
epacket_auth
Definition packet.h:37
struct net_buf * epacket_alloc_tx(k_timeout_t timeout)
Allocate ePacket TX buffer.
int epacket_received_packet_append(struct net_buf *storage_buf, struct net_buf *received_buf)
Append received packet to storage buffer.
struct net_buf * epacket_alloc_rx(k_timeout_t timeout)
Allocate ePacket RX buffer.
void epacket_global_flags_set(uint16_t flags)
Set global flags for all transmitted packets.
void epacket_rate_limit_reset(void)
Reset any active rate limits.
epacket_flags
Definition packet.h:114
void(* epacket_tx_done_cb)(const struct device *dev, struct net_buf *pkt, int result, void *user_data)
Callback run when packet is transmitted.
Definition packet.h:63
int epacket_num_buffers_free_rx(void)
Query the number of free RX buffers.
int epacket_num_buffers_free_tx(void)
Query the number of free TX buffers.
static void epacket_set_tx_metadata(struct net_buf *buf, enum epacket_auth auth, uint16_t flags, enum infuse_type type, union epacket_interface_address dest)
Set metadata on a packet.
Definition packet.h:348
static struct net_buf * epacket_alloc_tx_for_interface(const struct device *dev, k_timeout_t timeout)
Allocate ePacket TX buffer for a specific interface.
Definition packet.h:315
uint16_t epacket_global_flags_get(void)
Get the current global flags value.
static void epacket_set_tx_callback(struct net_buf *buf, epacket_tx_done_cb tx_done, void *user_data)
Set callback to be run after packet sent.
Definition packet.h:368
epacket_forward_auto_conn_flags
Definition packet.h:204
void epacket_rate_limit_tx(k_ticks_t *last_call, uint16_t bytes_transmitted)
Limit the transmission rate of bulk data paths.
@ EPACKET_AUTH_NETWORK
Definition packet.h:42
@ EPACKET_AUTH_DEVICE
Definition packet.h:43
@ EPACKET_AUTH_FAILURE
Definition packet.h:39
@ EPACKET_AUTH_REMOTE_ENCRYPTED
Definition packet.h:41
@ EPACKET_FLAGS_ENCRYPTION_NETWORK
Definition packet.h:117
@ EPACKET_FLAGS_CLOUD_SELF
Definition packet.h:123
@ EPACKET_FLAGS_ENCRYPTION_DEVICE
Definition packet.h:116
@ EPACKET_FLAGS_INTERFACE_MASK
Definition packet.h:126
@ EPACKET_FLAGS_ACK_REQUEST
Definition packet.h:119
@ EPACKET_FLAGS_CLOUD_FORWARDING
Definition packet.h:121
@ EPACKET_FORWARD_AUTO_CONN_DC_NOTIFICATION
Definition packet.h:210
@ EPACKET_FORWARD_AUTO_CONN_SUB_DATA
Definition packet.h:208
@ EPACKET_FORWARD_AUTO_CONN_PRIORITISE_UPLINK
Definition packet.h:212
@ EPACKET_FORWARD_AUTO_CONN_SINGLE_RPC
Definition packet.h:206
infuse_type
Core Infuse Data Types.
Definition types.h:26
Core Infuse-IoT platform types.
Packet for INFUSE_EPACKET_CONN_TERMINATED.
Definition packet.h:234
uint8_t interface
Definition packet.h:236
int16_t reason
Definition packet.h:238
uint8_t address[]
Definition packet.h:240
Format of BLE address in INFUSE_RECEIVED_EPACKET and INFUSE_EPACKET_FORWARD.
Definition packet.h:159
uint8_t type
Definition packet.h:160
uint8_t addr[6]
Definition packet.h:161
Common config struct for all interfaces.
Definition interface.h:165
uint8_t footer_size
Definition interface.h:168
uint8_t header_size
Definition interface.h:167
Format of INFUSE_KEY_IDS packet.
Definition packet.h:135
uint8_t device_key_id[3]
Definition packet.h:136
Magic two byte packet that requests a pause in data transmission.
Definition packet.h:143
uint8_t magic
EPACKET_RATE_LIMIT_REQ_MAGIC
Definition packet.h:145
uint8_t delay_ms
Duration to pause transmission for.
Definition packet.h:147
Magic three byte packet that sets a target data throughput.
Definition packet.h:151
uint16_t target_throughput_kbps
Target data throughput in kilobits/sec.
Definition packet.h:155
uint8_t magic
EPACKET_RATE_LIMIT_REQ_MAGIC
Definition packet.h:153
bt_addr_le_t bluetooth
Definition packet.h:49