Dispatcher

  • This is Dispatcher which dispatch the messages based on the module id

  • Each module has certain messages to dispatch,once module registerd using bit field ,messages hold and consume the messages.

  • Using this api rs_dp_dispatch_msg () hold the messages related to particular module id and using this api rs_dp_consume_msgs () consume the messages gathered in the module id.

Usage

  1. All API functions have the first argument as the module id.

  2. Internal data buffer size and pointer are initialized with module init function.

  3. dispatcher register the module and consume the messages using module id

  4. Return codes of API functions are defined in header file.

Dispatcher calls

Function

Description

rs_dp_dispatch_msg

Function to dispatch the message based on the module id

rs_dp_register_module

Function to registers the module

rs_dp_consume_msgs

Function consumes the messages when message exists

Error Code

  • Every API’s for the message queue module returns some success or failure values. Please refer below section,

Example Demo

Please refer below section,

Message Queue Header Details

Documentation from the relevant header as follows:

Dispatcher Specific APIs.

Defines macros and functions specific to Rapidsea dispatcher functionality

Author

Embien RAPIDSEA Team

Copyright

Embien Technologies India Pvt. Ltd.

Defines

RS_DISPATCHER_MAX_MSGS

Number of Data IDs that can be signalled.

Typedefs

typedef struct tag_rs_dp_msg rs_dp_msg_t

Contains information about dispatcher message.

typedef struct tag_rs_dp_module_info rs_dp_module_info_t

Contains information about dispatcher module information.

Enums

enum rs_module_id_t

Contains information about list of module id’s.

Values:

enumerator RS_MODULE_SPARKLET

Sparklet module.

enumerator RS_MODULE_VP

VP module.

enumerator RS_MODULE_APP_1

Application module 1.

enumerator RS_MODULE_APP_2

Application module 2.

enumerator RS_MODULE_APP_3

Application module 3.

enumerator RS_MODULE_APP_4

Application module 4.

enumerator RS_MODULE_APP_5

Application module 5.

enumerator RS_MODULE_APP_6

Application module 6.

enumerator RS_MODULE_APP_7

Application module 7.

enumerator RS_MODULE_APP_8

Application module 8.

enumerator RS_AM_SPEEDOMETER

Speedometer module.

enumerator RS_AM_ODOMETER

Odometer module.

enumerator RS_AM_TRIPMETER

Trip meter module.

enumerator RS_AM_TEMPERATURE

Temperature module.

enumerator RS_AM_FUELGAUGE

Fuel gauge module.

enumerator RS_AM_TACHOMETER

Tachometer module.

enumerator RS_AM_TELLTALE
enumerator RS_AM_GEAR

Gear module.

enumerator RS_AM_USER_DISPLAY

Display module.

enumerator RS_ALL_MODULES

All modules.

Functions

rs_ret_val_t rs_dp_register_module(rs_module_id_t module_id, void *ptr_arg, void *ptr_update_msg)

This function register the module.

This function defines the module type and update the message

Parameters:
  • rs_module_id_t[in] module_id - Module id

  • void*[in] ptr_arg - Pointer to the input buffer

  • void*[in] ptr_update_msg - notifier of the module

Returns:

return 0 for success

rs_ret_val_t rs_dp_dispatch_msg(rs_module_id_t module_id, rs_dp_msg_t *ptr_dp_msg)

This function dispatch the message.

This function defines the dispatch the message of the module id

Parameters:
  • rs_module_id_t[in] module_id - Module id

  • rs_dp_msg_t[in] *ptr_dp_msg - Pointer to the dispatcher struct

Returns:

return 0 for success

rs_ret_val_t rs_dp_consume_msgs(rs_module_id_t module_id)
struct tag_rs_dp_msg
#include <rs_dispatcher.h>

Contains information about dispatcher message.

Public Members

uint16_t data_id

Data identifier.

void *ptr_arg

Pointer to the argument.

struct tag_rs_dp_module_info
#include <rs_dispatcher.h>

Contains information about dispatcher module information.

Public Members

uint8_t registered

Indicates if the module is registered.

uint8_t msg_pending

Indicates if there is a pending message.

uint32_t bit_field[RS_DISPATCHER_MAX_MSGS / 32]

Bit field for message statuses.

void (*update_msg)(rs_dp_msg_t *ptr_dispatch_msg)

Function pointer to update message.

void *ptr_arg

Pointer to the argument.