Core Serial Library in C  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
za_serial.h
Go to the documentation of this file.
1 
12 #if !defined(ZA_SERIAL_H)
13 #define ZA_SERIAL_H
14 
15 #if defined(__cplusplus)
16 extern "C"{
17 #endif /* if defined(__cplusplus) */
18 
19 #include "z_common.h"
20 
32 struct za_reply {
42  char reply_flags[3];
44  char device_status[5];
47  char warning_flags[3];
50  char response_data[128];
51 };
52 
75 int za_connect(z_port *port, const char *port_name);
76 
83 int za_disconnect(z_port port);
84 
96 int za_send(z_port port, const char *command);
97 
127 int za_receive(z_port port, char *destination, int length);
128 
142 int za_decode(struct za_reply *destination, char *reply);
143 
165 int za_setbaud(z_port port, int baud);
166 
188 int za_drain(z_port port);
189 
199 void za_set_verbose(int value);
200 
201 #if defined(__cplusplus)
202 }
203 #endif /* if defined(__cplusplus) */
204 
205 #endif /* if !defined(ZA_SERIAL_H) */
char message_type
The message type will always be '@' for replies.
Definition: za_serial.h:35
int za_send(z_port port, const char *command)
Sends a command to a serial port.
Provides programmatic access to reply data.
Definition: za_serial.h:32
int za_setbaud(z_port port, int baud)
Changes the baud rate of both input and output.
int za_connect(z_port *port, const char *port_name)
Connect to a serial port specified by port_name.
Defines a few things that all of the serial API has in common.
char warning_flags[3]
The highest priority warning for the device, or – under normal conditions.
Definition: za_serial.h:47
int axis_number
The axis number: 0-9, where 0 refers to the whole device, and 1-9 refer only to that specific axis...
Definition: za_serial.h:40
char reply_flags[3]
Whether a command was accepted or rejected: either "OK" or "RJ".
Definition: za_serial.h:42
int device_address
The address of the device, an integer between 1 and 99.
Definition: za_serial.h:37
int za_decode(struct za_reply *destination, char *reply)
Build a za_reply struct from a string pointed-to by reply.
char response_data[128]
The response for the command executed.
Definition: za_serial.h:50
int za_drain(z_port port)
Flushes all input received but not yet read, and attempts to drain all input that would be incoming...
HANDLE z_port
A type to represent a port connected to one or more Zaber devices.
Definition: z_common.h:31
char device_status[5]
Either "BUSY" when the axis is moving, or "IDLE" when it isn't.
Definition: za_serial.h:44
int za_receive(z_port port, char *destination, int length)
Reads a message from the serial port.
int za_disconnect(z_port port)
Gracefully closes a connection.
void za_set_verbose(int value)
Sets whether errors and extra info are reported to stderr.