API
za_serial.c File Reference
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "za_serial.h"
Include dependency graph for za_serial.c:

Go to the source code of this file.

Functions

void za_set_verbose (int value)
 
static size_t copy_until_delim (char *destination, const char *source, const char delim, size_t destination_length)
 
static int decode_reply (struct za_reply *destination, char *reply)
 
static int decode_alert (struct za_reply *destination, char *reply)
 
static int decode_info (struct za_reply *destination, char *reply)
 
int za_decode (struct za_reply *destination, char *reply)
 

Variables

static int za_verbose = 1
 

Function Documentation

◆ copy_until_delim()

static size_t copy_until_delim ( char *  destination,
const char *  source,
const char  delim,
size_t  destination_length 
)
static

Definition at line 489 of file za_serial.c.

Referenced by decode_alert(), decode_info(), and decode_reply().

◆ decode_alert()

static int decode_alert ( struct za_reply destination,
char *  reply 
)
static

Definition at line 609 of file za_serial.c.

Referenced by za_decode().

◆ decode_info()

static int decode_info ( struct za_reply destination,
char *  reply 
)
static

Definition at line 685 of file za_serial.c.

Referenced by za_decode().

◆ decode_reply()

static int decode_reply ( struct za_reply destination,
char *  reply 
)
static

Definition at line 505 of file za_serial.c.

Referenced by za_decode().

◆ za_decode()

int za_decode ( struct za_reply destination,
char *  reply 
)

Build a za_reply struct from a string pointed-to by reply.

The za_reply struct can then be used to gain easier access to the parts of an ASCII reply.

Parameters
[out]destinationa pointer to a za_reply struct to be populated with the data found in reply.
[in]replya pointer to a string containing a full reply from a Zaber device, as specified by the ASCII protocol manual.
Returns
Z_SUCCESS on success, Z_ERROR_NULL_PARAMETER if destination or reply is NULL, or Z_ERROR_COULD_NOT_DECODE if the reply is malformed.

Definition at line 756 of file za_serial.c.

◆ za_set_verbose()

void za_set_verbose ( int  value)

Sets whether errors and extra info are reported to stderr.

Set value to 0 to disable all output. Additionally, you can compile this library with the macro NDEBUG defined, which will disable all output and skip checks to "verbose" altogether in the compiled code.

Parameters
[in]valuewhether or not the program should output error messages and info to stderr.

Definition at line 18 of file za_serial.c.

Variable Documentation

◆ za_verbose

int za_verbose = 1
static

Definition at line 16 of file za_serial.c.

Referenced by za_set_verbose().