MeshX 0.3
This repository provides an implementation for Bluetooth Low Energy (BLE) Mesh network nodes. The project allows you to create BLE mesh nodes that can communicate with each other, enabling the development of smart home solutions or other IoT-based applications.
Loading...
Searching...
No Matches
meshx_txcm.h File Reference

MeshX Tx Control Module This header file contains the definitions and function prototypes for the MeshX Tx Control Module, which is responsible for managing transmission control in the MeshX BLE Mesh stack. More...

#include <stdint.h>
#include <stddef.h>
#include "meshx_err.h"
#include "meshx_common.h"
#include "meshx_control_task.h"
#include "interface/ble_mesh/meshx_ble_mesh_cmn_def.h"
Include dependency graph for meshx_txcm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  meshx_txcm_request
 Structure for Tx Control module requests. More...
 

Macros

#define MESHX_TXCM_MSG_RETRY_MAX   3
 Maximum number of retries for a message.
 
#define MESHX_TXCM_MSG_PARAM_MAX_LEN   64
 Maximum length of the message parameters in bytes.
 
#define MESHX_TXCM_TX_Q_LEN   10
 Maximum number of transmission items in the Tx queue.
 
#define MESHX_TXCM_TX_Q_DEPTH   sizeof(meshx_txcm_tx_q_t)
 Depth (size) of each transmission queue entry.
 

Typedefs

typedef control_task_msg_handle_t meshx_txcm_cb_t
 
typedef meshx_err_t(* meshx_txcm_fn_model_send_t) (meshx_cptr_t msg_param, size_t msg_param_len)
 Function pointer the Model client layer needs to provide for the msg to be sent for both MESHX_TXCM_SIG_ENQ_SEND and MESHX_TXCM_SIG_DIRECT_SEND.
 
typedef struct meshx_txcm_request meshx_txcm_request_t
 Structure for Tx Control module requests.
 

Enumerations

enum  meshx_txcm_sig_t {
  MESHX_TXCM_SIG_ENQ_SEND = 0 ,
  MESHX_TXCM_SIG_DIRECT_SEND = 1 ,
  MESHX_TXCM_SIG_RESEND = 2 ,
  MESHX_TXCM_SIG_ACK = 3 ,
  MESHX_TXCM_SIG_MAX
}
 Enumeration of signal types for the Tx Control Module. More...
 
enum  meshx_txcm_msg_state_t {
  MESHX_TXCM_MSG_STATE_NONE = 0 ,
  MESHX_TXCM_MSG_STATE_NEW = 1 ,
  MESHX_TXCM_MSG_STATE_SENDING = 2 ,
  MESHX_TXCM_MSG_STATE_WAITING_ACK = 3 ,
  MESHX_TXCM_MSG_STATE_ACK = 4 ,
  MESHX_TXCM_MSG_STATE_NACK = 5 ,
  MESHX_TXCM_MSG_STATE_MAX
}
 Enumeration of message states for the Tx Control Module. More...
 
enum  meshx_txcm_msg_type_t {
  MESHX_TXCM_MSG_TYPE_ACKED ,
  MESHX_TXCM_MSG_TYPE_UNACKED ,
  MESHX_TXCM_MSG_TYPE_MAX
}
 

Functions

meshx_err_t meshx_txcm_init (dev_struct_t *pdev)
 Initializes the MeshX Tx Control Module.
 
meshx_err_t meshx_txcm_request_send (meshx_txcm_sig_t request_type, uint16_t dest_addr, meshx_cptr_t msg_param, uint16_t msg_param_len, meshx_txcm_fn_model_send_t send_fn)
 Sends a request to the Tx Control module.
 
meshx_err_t meshx_txcm_event_cb_reg (meshx_txcm_cb_t event_cb)
 Registers a callback function for handling Tx Control module events.
 

Detailed Description

MeshX Tx Control Module This header file contains the definitions and function prototypes for the MeshX Tx Control Module, which is responsible for managing transmission control in the MeshX BLE Mesh stack.

Author
Pranjal Chanda

Definition in file meshx_txcm.h.

Macro Definition Documentation

◆ MESHX_TXCM_MSG_PARAM_MAX_LEN

#define MESHX_TXCM_MSG_PARAM_MAX_LEN   64

Maximum length of the message parameters in bytes.

Definition at line 34 of file meshx_txcm.h.

◆ MESHX_TXCM_MSG_RETRY_MAX

#define MESHX_TXCM_MSG_RETRY_MAX   3

Maximum number of retries for a message.

Definition at line 27 of file meshx_txcm.h.

◆ MESHX_TXCM_TX_Q_DEPTH

#define MESHX_TXCM_TX_Q_DEPTH   sizeof(meshx_txcm_tx_q_t)

Depth (size) of each transmission queue entry.

Definition at line 47 of file meshx_txcm.h.

◆ MESHX_TXCM_TX_Q_LEN

#define MESHX_TXCM_TX_Q_LEN   10

Maximum number of transmission items in the Tx queue.

Definition at line 41 of file meshx_txcm.h.

Typedef Documentation

◆ meshx_txcm_cb_t

Definition at line 49 of file meshx_txcm.h.

◆ meshx_txcm_fn_model_send_t

typedef meshx_err_t(* meshx_txcm_fn_model_send_t) (meshx_cptr_t msg_param, size_t msg_param_len)

Function pointer the Model client layer needs to provide for the msg to be sent for both MESHX_TXCM_SIG_ENQ_SEND and MESHX_TXCM_SIG_DIRECT_SEND.

Parameters
[in]msg_paramPointer to the model specific parameter structure
[in]msg_param_lenLength of the msg_param

Definition at line 94 of file meshx_txcm.h.

◆ meshx_txcm_request_t

Structure for Tx Control module requests.

This structure holds the details of a transmission request, including the type of signal, the send function callback, and parameters for the message to be transmitted.

Enumeration Type Documentation

◆ meshx_txcm_msg_state_t

Enumeration of message states for the Tx Control Module.

This enumeration defines the different states a message can be in during transmission, including new messages, waiting for acknowledgment, acknowledged messages, and the maximum state value.

Enumerator
MESHX_TXCM_MSG_STATE_NONE 

New message state

MESHX_TXCM_MSG_STATE_NEW 

New message state

MESHX_TXCM_MSG_STATE_SENDING 

Message sending state

MESHX_TXCM_MSG_STATE_WAITING_ACK 

Message waiting for acknowledgment state

MESHX_TXCM_MSG_STATE_ACK 

Message acknowledged state

MESHX_TXCM_MSG_STATE_NACK 

Message not acknowledged state

MESHX_TXCM_MSG_STATE_MAX  

Definition at line 71 of file meshx_txcm.h.

72{
meshx_txcm_msg_state_t
Enumeration of message states for the Tx Control Module.
Definition meshx_txcm.h:72
@ MESHX_TXCM_MSG_STATE_SENDING
Definition meshx_txcm.h:75
@ MESHX_TXCM_MSG_STATE_NACK
Definition meshx_txcm.h:78
@ MESHX_TXCM_MSG_STATE_NONE
Definition meshx_txcm.h:73
@ MESHX_TXCM_MSG_STATE_NEW
Definition meshx_txcm.h:74
@ MESHX_TXCM_MSG_STATE_ACK
Definition meshx_txcm.h:77
@ MESHX_TXCM_MSG_STATE_WAITING_ACK
Definition meshx_txcm.h:76
@ MESHX_TXCM_MSG_STATE_MAX
Definition meshx_txcm.h:79

◆ meshx_txcm_msg_type_t

Enumerator
MESHX_TXCM_MSG_TYPE_ACKED 
MESHX_TXCM_MSG_TYPE_UNACKED 
MESHX_TXCM_MSG_TYPE_MAX 

Definition at line 82 of file meshx_txcm.h.

83{
meshx_txcm_msg_type_t
Definition meshx_txcm.h:83
@ MESHX_TXCM_MSG_TYPE_UNACKED
Definition meshx_txcm.h:85
@ MESHX_TXCM_MSG_TYPE_MAX
Definition meshx_txcm.h:86
@ MESHX_TXCM_MSG_TYPE_ACKED
Definition meshx_txcm.h:84

◆ meshx_txcm_sig_t

Enumeration of signal types for the Tx Control Module.

This enumeration defines the different types of signals that can be sent to the Tx Control Module, each representing a different type of transmission command.

Enumerator
MESHX_TXCM_SIG_ENQ_SEND 

Signal to enqueue a transmission command

MESHX_TXCM_SIG_DIRECT_SEND 

Signal to directly send a transmission command without queuing

MESHX_TXCM_SIG_RESEND 

Signal to resend the last transmission queued message

MESHX_TXCM_SIG_ACK 

Signal to acknowledge the last transmission message

MESHX_TXCM_SIG_MAX  

Maximum signal type value

Definition at line 56 of file meshx_txcm.h.

57{
meshx_txcm_sig_t
Enumeration of signal types for the Tx Control Module.
Definition meshx_txcm.h:57
@ MESHX_TXCM_SIG_ENQ_SEND
Definition meshx_txcm.h:58
@ MESHX_TXCM_SIG_DIRECT_SEND
Definition meshx_txcm.h:59
@ MESHX_TXCM_SIG_ACK
Definition meshx_txcm.h:61
@ MESHX_TXCM_SIG_RESEND
Definition meshx_txcm.h:60
@ MESHX_TXCM_SIG_MAX
Definition meshx_txcm.h:62

Function Documentation

◆ meshx_txcm_event_cb_reg()

meshx_err_t meshx_txcm_event_cb_reg ( meshx_txcm_cb_t event_cb)

Registers a callback function for handling Tx Control module events.

This function registers a callback function to handle specific events from the Tx Control module. The callback will be invoked when the specified event occurs.

Parameters
[in]event_cbPointer to the callback function to be registered for event handling.
Returns
meshx_err_t
  • MESHX_SUCCESS on successful registration.
  • Error code (meshx_err_t) if registration fails.
Here is the caller graph for this function:

◆ meshx_txcm_init()

meshx_err_t meshx_txcm_init ( dev_struct_t * pdev)

Initializes the MeshX Tx Control Module.

This function sets up the transmission control module for MeshX. It checks if the module has already been initialized using an initialization magic value. If not initialized, it sets the magic value, assigns the provided device structure to the task argument, and creates the Tx Control task.

Parameters
[in]pdevPointer to the device structure to be used by the Tx Control Module.
Returns
  • MESHX_SUCCESS on successful initialization or if already initialized.
  • Error code (meshx_err_t) if task creation fails.
Here is the caller graph for this function:

◆ meshx_txcm_request_send()

meshx_err_t meshx_txcm_request_send ( meshx_txcm_sig_t request_type,
uint16_t dest_addr,
meshx_cptr_t msg_param,
uint16_t msg_param_len,
meshx_txcm_fn_model_send_t send_fn )

Sends a request to the Tx Control module.

This function sends a request to the Tx Control module with the specified parameters. It creates a new request structure, copies the message parameters, and sends the request to the signal queue of the Tx Control module.

Parameters
[in]request_typeType of the request (ACK, RESEND, ENQ_SEND, DIRECT_SEND)
[in]dest_addrDestination address of the message
[in]msg_paramPointer to the message parameters
[in]msg_param_lenLength of the message parameters
[in]send_fnFunction pointer to the send function to be used for the request
Returns
meshx_err_t
Here is the caller graph for this function: