Myriota Flex SDK 2.5.0
Loading...
Searching...
No Matches
Diagnostics and Configuration

User defined Diagnostics and Configuration fields. More...

Macros

#define FLEX_DIAG_CONF_TABLE_BEGIN()
 
#define FLEX_DIAG_CONF_TABLE_END()
 Ends recording the diagnostic and configuration table.
 
#define FLEX_DIAG_CONF_TABLE_BOOL_ADD(id, name, default_value, type)
 
#define FLEX_DIAG_CONF_TABLE_FLOAT_ADD(id, name, default_value, type)
 
#define FLEX_DIAG_CONF_TABLE_I32_ADD(id, name, default_value, type)
 
#define FLEX_DIAG_CONF_TABLE_STR_ADD(id, name, default_value, max_len, type)
 
#define FLEX_DIAG_CONF_TABLE_TIME_ADD(id, name, default_value, type)
 
#define FLEX_DIAG_CONF_TABLE_U32_ADD(id, name, default_value, type)
 

Typedefs

typedef void(* FLEX_DiagConfValueNotifyHandler) (const void *const value)
 

Enumerations

enum  FLEX_DiagConfID {
  FLEX_DIAG_CONF_ID_USER_0 , FLEX_DIAG_CONF_ID_USER_1 , FLEX_DIAG_CONF_ID_USER_2 , FLEX_DIAG_CONF_ID_USER_3 ,
  FLEX_DIAG_CONF_ID_USER_4 , FLEX_DIAG_CONF_ID_USER_5 , FLEX_DIAG_CONF_ID_USER_6 , FLEX_DIAG_CONF_ID_USER_7 ,
  FLEX_DIAG_CONF_ID_USER_8 , FLEX_DIAG_CONF_ID_USER_9 , FLEX_DIAG_CONF_ID_USER_10 , FLEX_DIAG_CONF_ID_USER_11 ,
  FLEX_DIAG_CONF_ID_USER_12 , FLEX_DIAG_CONF_ID_USER_13 , FLEX_DIAG_CONF_ID_USER_14 , FLEX_DIAG_CONF_ID_USER_15 ,
  FLEX_DIAG_CONF_ID_USER_MAX
}
 Diagnostics and Configurations IDs. More...
 
enum  FLEX_DiagConfType { FLEX_DIAG_CONF_TYPE_CONF , FLEX_DIAG_CONF_TYPE_DIAG , FLEX_DIAG_CONF_TYPE_PERSIST_DIAG }
 The type of diagnostic or configuration item. More...
 

Functions

int FLEX_DiagConfValueWrite (const FLEX_DiagConfID id, const void *const value)
 
int FLEX_DiagConfValueRead (const FLEX_DiagConfID id, void *const value)
 
int FLEX_DiagConfValueNotifyHandlerSet (const FLEX_DiagConfID id, const FLEX_DiagConfValueNotifyHandler handler)
 

Detailed Description

User defined Diagnostics and Configuration fields.

Macro Definition Documentation

◆ FLEX_DIAG_CONF_TABLE_BEGIN

#define FLEX_DIAG_CONF_TABLE_BEGIN ( )
Value:
FLEX_DiagConfTableItem *diag_conf_table_get_(void) { \
static FLEX_DiagConfTableItem table[] = {

Begins recording the diagnostic and configuration table

Note
The collective length of all item names, and string values including terminators is 512 bytes and 256 bytes respectively.

◆ FLEX_DIAG_CONF_TABLE_END

#define FLEX_DIAG_CONF_TABLE_END ( )
Value:
{0}}; \
return table; \
}

Ends recording the diagnostic and configuration table.

◆ FLEX_DIAG_CONF_TABLE_BOOL_ADD

#define FLEX_DIAG_CONF_TABLE_BOOL_ADD ( id,
name,
default_value,
type )
Value:
{ id, FLEX_DIAG_CONF_VALUE_TAG_B8, type, 0, name, (void *)default_value }

Adds a boolean to the diagnostic and configuration table

Parameters
idThe id of diagnostic or configuration of type FLEX_DiagConfID.
nameThe name of diagnostic or configuration.
default_valueThe default_value of the diagnostic or configuration.
typeIf the table item is a configuration, diagnostic, or presistent diagnostic. See FLEX_DiagConfType.

◆ FLEX_DIAG_CONF_TABLE_FLOAT_ADD

#define FLEX_DIAG_CONF_TABLE_FLOAT_ADD ( id,
name,
default_value,
type )
Value:
{ id, FLEX_DIAG_CONF_VALUE_TAG_F32, type, 0, name, (void *)default_value }

Adds a float to the diagnostic and configuration table

Parameters
idThe id of diagnostic or configuration of type FLEX_DiagConfID.
nameThe name of diagnostic or configuration.
default_valueThe default_value of the diagnostic or configuration.
typeIf the table item is a configuration, diagnostic, or presistent diagnostic. See FLEX_DiagConfType.

◆ FLEX_DIAG_CONF_TABLE_I32_ADD

#define FLEX_DIAG_CONF_TABLE_I32_ADD ( id,
name,
default_value,
type )
Value:
{ id, FLEX_DIAG_CONF_VALUE_TAG_I32, type, 0, name, (void *)default_value }

Adds a signed integer to the diagnostic and configuration table

Parameters
idThe id of diagnostic or configuration of type FLEX_DiagConfID.
nameThe name of diagnostic or configuration.
default_valueThe default_value of the diagnostic or configuration.
typeIf the table item is a configuration, diagnostic, or presistent diagnostic. See FLEX_DiagConfType.

◆ FLEX_DIAG_CONF_TABLE_STR_ADD

#define FLEX_DIAG_CONF_TABLE_STR_ADD ( id,
name,
default_value,
max_len,
type )
Value:
{ id, FLEX_DIAG_CONF_VALUE_TAG_STR, type, max_len, name, (void *)default_value }

Adds a string to the diagnostic and configuration table

Parameters
idThe id of diagnostic or configuration of type FLEX_DiagConfID.
nameThe name of diagnostic or configuration.
default_valueThe default_value of the diagnostic or configuration.
max_lenIf the maximum length of the string that can be stored.
typeIf the table item is a configuration, diagnostic, or presistent diagnostic. See FLEX_DiagConfType.

◆ FLEX_DIAG_CONF_TABLE_TIME_ADD

#define FLEX_DIAG_CONF_TABLE_TIME_ADD ( id,
name,
default_value,
type )
Value:
{ id, FLEX_DIAG_CONF_VALUE_TAG_T32, type, 0, name, (void *)default_value }

Adds a timestamp to the diagnostic and configuration table

Parameters
idThe id of diagnostic or configuration of type FLEX_DiagConfID.
nameThe name of diagnostic or configuration.
default_valueThe default_value of the diagnostic or configuration.
typeIf the table item is a configuration, diagnostic, or presistent diagnostic. See FLEX_DiagConfType.

◆ FLEX_DIAG_CONF_TABLE_U32_ADD

#define FLEX_DIAG_CONF_TABLE_U32_ADD ( id,
name,
default_value,
type )
Value:
{ id, FLEX_DIAG_CONF_VALUE_TAG_U32, type, 0, name, (void *)default_value }

Adds a unsigned integer to the diagnostic and configuration table

Parameters
idThe id of diagnostic or configuration of type FLEX_DiagConfID.
nameThe name of diagnostic or configuration.
default_valueThe default_value of the diagnostic or configuration.
typeIf the table item is a configuration, diagnostic, or presistent diagnostic. See FLEX_DiagConfType.

Typedef Documentation

◆ FLEX_DiagConfValueNotifyHandler

typedef void(* FLEX_DiagConfValueNotifyHandler) (const void *const value)

Diagnostics or Configuration Notify Function Pointer Declaration.

Parameters
valueThe new value of the diagnostic or configuration.

Enumeration Type Documentation

◆ FLEX_DiagConfID

Diagnostics and Configurations IDs.

Enumerator
FLEX_DIAG_CONF_ID_USER_0 

Diagnostics or Configuration ID 0.

FLEX_DIAG_CONF_ID_USER_1 

Diagnostics or Configuration ID 1.

FLEX_DIAG_CONF_ID_USER_2 

Diagnostics or Configuration ID 2.

FLEX_DIAG_CONF_ID_USER_3 

Diagnostics or Configuration ID 3.

FLEX_DIAG_CONF_ID_USER_4 

Diagnostics or Configuration ID 4.

FLEX_DIAG_CONF_ID_USER_5 

Diagnostics or Configuration ID 5.

FLEX_DIAG_CONF_ID_USER_6 

Diagnostics or Configuration ID 6.

FLEX_DIAG_CONF_ID_USER_7 

Diagnostics or Configuration ID 7.

FLEX_DIAG_CONF_ID_USER_8 

Diagnostics or Configuration ID 8.

FLEX_DIAG_CONF_ID_USER_9 

Diagnostics or Configuration ID 9.

FLEX_DIAG_CONF_ID_USER_10 

Diagnostics or Configuration ID 10.

FLEX_DIAG_CONF_ID_USER_11 

Diagnostics or Configuration ID 11.

FLEX_DIAG_CONF_ID_USER_12 

Diagnostics or Configuration ID 12.

FLEX_DIAG_CONF_ID_USER_13 

Diagnostics or Configuration ID 13.

FLEX_DIAG_CONF_ID_USER_14 

Diagnostics or Configuration ID 14.

FLEX_DIAG_CONF_ID_USER_15 

Diagnostics or Configuration ID 15.

FLEX_DIAG_CONF_ID_USER_MAX 

Diagnostics or Configuration MAX ID.

◆ FLEX_DiagConfType

The type of diagnostic or configuration item.

Enumerator
FLEX_DIAG_CONF_TYPE_CONF 

Configuration Type - Read/Write value while the application is running

FLEX_DIAG_CONF_TYPE_DIAG 

Diagnostic Type - Read only value that is cleared on reset.

FLEX_DIAG_CONF_TYPE_PERSIST_DIAG 

Persistent Diagnostic Type - Read only value that is not cleared on reset.

Function Documentation

◆ FLEX_DiagConfValueWrite()

int FLEX_DiagConfValueWrite ( const FLEX_DiagConfID id,
const void *const value )

Writes the diagnostic or configuration value.

Parameters
idThe id of the diagnostic or configuration.
valueThe diagnostic or configuration value to write.
Returns
FLEX_SUCCESS (0) if succeeded and < 0 if failed.
Return values
-FLEX_ERROR_ENOTRECOVERABLEBLE module comms in a unrecoverable state.
-FLEX_ERROR_EPROTOBLE module comms protocol error most likely a version miss match.
-FLEX_ERROR_ECOMMFailed to communicate with the BLE module.
-FLEX_ERROR_EINVALSupplied a id that is out of range.
-FLEX_ERROR_ENXIOSupplied a id with no corresponding table entry.

◆ FLEX_DiagConfValueRead()

int FLEX_DiagConfValueRead ( const FLEX_DiagConfID id,
void *const value )

Reads the diagnostic or configuration value.

Parameters
idThe id of the diagnostic or configuration.
valueThe diagnostic or configuration value to read.
Returns
FLEX_SUCCESS (0) if succeeded and < 0 if failed.
Return values
-FLEX_ERROR_ENOTRECOVERABLEBLE module comms in a unrecoverable state.
-FLEX_ERROR_EPROTOBLE module comms protocol error most likely a version miss match.
-FLEX_ERROR_ECOMMFailed to communicate with the BLE module.
-FLEX_ERROR_EINVALSupplied a id that is out of range.
-FLEX_ERROR_ENXIOSupplied a id with no corresponding table entry.

◆ FLEX_DiagConfValueNotifyHandlerSet()

int FLEX_DiagConfValueNotifyHandlerSet ( const FLEX_DiagConfID id,
const FLEX_DiagConfValueNotifyHandler handler )

Adds an event handler for when the given diagnostic or configuration value changes.

Note
There can only be one handler subscribed to the event at a time, so passing in a new handler will remove current one.
Parameters
idThe id of the diagnostic or configuration.
handlerthe event handler to be called on diagnostic or configuration change.
Returns
FLEX_SUCCESS (0) if succeeded and < 0 if failed.
Return values
-FLEX_ERROR_EINVALSupplied a id that is out of range.
-FLEX_ERROR_ENXIOSupplied a id with no corresponding table entry.