AMU Library 3.0
C/C++ library for communicating with AMU (Aerospace Measurement Unit) devices
Loading...
Searching...
No Matches
error.c File Reference
#include <stdint.h>
#include "parser.h"
#include "ieee488.h"
#include "error.h"
#include "fifo_private.h"
#include "constants.h"

Go to the source code of this file.

Data Structures

struct  error_reg

Macros

#define SCPI_ERROR_SETVAL(e, c, i)
#define ERROR_DEFS_N   9
#define X(def, val, str)
#define XE(def, val, str)

Functions

void SCPI_ErrorInit (scpi_t *context, scpi_error_t *data, int16_t size)
static void SCPI_ErrorEmitEmpty (scpi_t *context)
static void SCPI_ErrorEmit (scpi_t *context, int16_t err)
void SCPI_ErrorClear (scpi_t *context)
scpi_bool_t SCPI_ErrorPop (scpi_t *context, scpi_error_t *error)
int32_t SCPI_ErrorCount (scpi_t *context)
static scpi_bool_t SCPI_ErrorAddInternal (scpi_t *context, int16_t err, char *info, size_t info_len)
void SCPI_ErrorPushEx (scpi_t *context, int16_t err, char *info, size_t info_len)
void SCPI_ErrorPush (scpi_t *context, int16_t err)
const char * SCPI_ErrorTranslate (int16_t err)

Variables

static const struct error_reg errs [9]

Macro Definition Documentation

◆ ERROR_DEFS_N

#define ERROR_DEFS_N   9

Definition at line 152 of file error.c.

◆ SCPI_ERROR_SETVAL

#define SCPI_ERROR_SETVAL ( e,
c,
i )
Value:
do { (e)->error_code = (c); (void)(i);} while(0)

Definition at line 48 of file error.c.

◆ X

#define X ( def,
val,
str )
Value:
case def: return str;

◆ XE

#define XE ( def,
val,
str )

Function Documentation

◆ SCPI_ErrorAddInternal()

scpi_bool_t SCPI_ErrorAddInternal ( scpi_t * context,
int16_t err,
char * info,
size_t info_len )
static

Definition at line 131 of file error.c.

◆ SCPI_ErrorClear()

void SCPI_ErrorClear ( scpi_t * context)

Clear error queue

Parameters
context- scpi context

Definition at line 90 of file error.c.

◆ SCPI_ErrorCount()

int32_t SCPI_ErrorCount ( scpi_t * context)

Return number of errors/events in the queue

Parameters
context
Returns

Definition at line 123 of file error.c.

◆ SCPI_ErrorEmit()

void SCPI_ErrorEmit ( scpi_t * context,
int16_t err )
static

Emit error

Parameters
contextscpi context
errError to emit

Definition at line 78 of file error.c.

◆ SCPI_ErrorEmitEmpty()

void SCPI_ErrorEmitEmpty ( scpi_t * context)
static

Emit no error

Parameters
contextscpi context

Definition at line 63 of file error.c.

◆ SCPI_ErrorInit()

void SCPI_ErrorInit ( scpi_t * context,
scpi_error_t * data,
int16_t size )

Initialize error queue

Parameters
context- scpi context

Definition at line 55 of file error.c.

◆ SCPI_ErrorPop()

scpi_bool_t SCPI_ErrorPop ( scpi_t * context,
scpi_error_t * error )

Pop error from queue

Parameters
context- scpi context
error
Returns

Definition at line 108 of file error.c.

◆ SCPI_ErrorPush()

void SCPI_ErrorPush ( scpi_t * context,
int16_t err )

Push error to queue

Parameters
context- scpi context
err- error number

Definition at line 202 of file error.c.

◆ SCPI_ErrorPushEx()

void SCPI_ErrorPushEx ( scpi_t * context,
int16_t err,
char * info,
size_t info_len )

Push error to queue

Parameters
context
err- error number
info- additional text information or NULL for no text
info_len- length of text or 0 for automatic length

Definition at line 173 of file error.c.

◆ SCPI_ErrorTranslate()

const char * SCPI_ErrorTranslate ( int16_t err)

Translate error number to string

Parameters
err- error number
Returns
Error string representation

Definition at line 212 of file error.c.

Variable Documentation

◆ errs

const struct error_reg errs[9]
static
Initial value:
= {
{-100, -199, 0x20 },
{-200, -299, 0x10 },
{-300, -399, 0x08 },
{ 1, 32767, 0x08 },
{-400, -499, 0x04 },
{-500, -599, 0x80 },
{-600, -699, 0x40 },
{-700, -799, 0x02 },
{-800, -899, 0x01 },
}

Definition at line 154 of file error.c.