gclib 2.4.0
Galil Communications Library
Loading...
Searching...
No Matches
gclib.h File Reference
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include "gclib_compat.h"

Go to the source code of this file.

Classes

struct  gclib_interrupt_t
 An interrupt generated by the controller. More...

Typedefs

typedef struct Context * gclib_handle
 A handle to an open connection given by gclib_open() for use in future API calls.
typedef struct DataRecord * gclib_data_record_handle
 A handle to a data record, for use in Data Record API calls.
typedef enum gclib_result gclib_result
 All gclib function return values.
typedef enum gclib_interrupt_type gclib_interrupt_type
 All interrupt status types.
typedef struct gclib_interrupt_t gclib_interrupt_t
 An interrupt generated by the controller.
typedef enum gclib_digital_input_flags gclib_digital_input_flags
 Flags to enable or disable GCLIB_DIGITAL_INPUT_LOW interrupts per digital input, for use in gclib_set_interrupts().
typedef enum gclib_axis_flags gclib_axis_flags
 Flags for building an axis mask, for example in gclib_set_interrupts().
typedef enum gclib_connection_t gclib_connection_t
 Connection type, as returned by gclib_connection_type().
typedef enum gclib_mode_of_motion_t gclib_mode_of_motion_t
 The controller's current mode of motion, given by gclib_data_record_mode_of_motion().
typedef enum gclib_ethernet_status_t gclib_ethernet_status_t
 The current status of an ethernet handle, given by gclib_data_record_ethernet_status().

Enumerations

enum  gclib_result {
  GCLIB_SUCCESS , GCLIB_INVALID_ARGUMENT , GCLIB_INTERNAL_ERROR , GCLIB_TIMEOUT ,
  GCLIB_COMMAND_ERROR , GCLIB_BUFFER_TOO_SMALL , GCLIB_NOT_CONNECTED , GCLIB_NOT_SUBSCRIBED
}
 All gclib function return values. More...
enum  gclib_interrupt_type {
  GCLIB_NO_INTERRUPTS = 0 , GCLIB_USER_INTERRUPT = 0 , GCLIB_MOTION_COMPLETE = 1 << 0 , GCLIB_ALL_AXES_MOTION_COMPLETE = 1 << 8 ,
  GCLIB_EXCESS_POSITION_ERROR = 1 << 9 , GCLIB_LIMIT_SWITCH = 1 << 10 , GCLIB_WATCHDOG_TIMER = 1 << 11 , GCLIB_PROGRAM_STOPPED = 1 << 13 ,
  GCLIB_COMMAND_DONE = 1 << 14 , GCLIB_DIGITAL_INPUT_LOW = 1 << 15 , GCLIB_ALL_INTERRUPTS = (1 << 16) - 1
}
 All interrupt status types. More...
enum  gclib_digital_input_flags {
  GCLIB_NO_DIGITAL_INPUTS = 0 , GCLIB_DIGITAL_INPUT_1 = 1 << 0 , GCLIB_DIGITAL_INPUT_2 = 1 << 1 , GCLIB_DIGITAL_INPUT_3 = 1 << 2 ,
  GCLIB_DIGITAL_INPUT_4 = 1 << 3 , GCLIB_DIGITAL_INPUT_5 = 1 << 4 , GCLIB_DIGITAL_INPUT_6 = 1 << 5 , GCLIB_DIGITAL_INPUT_7 = 1 << 6 ,
  GCLIB_DIGITAL_INPUT_8 = 1 << 7 , GCLIB_ALL_DIGITAL_INPUTS = (1 << 8) - 1
}
 Flags to enable or disable GCLIB_DIGITAL_INPUT_LOW interrupts per digital input, for use in gclib_set_interrupts(). More...
enum  gclib_axis_flags {
  GCLIB_NO_AXES = 0 , GCLIB_AXIS_A = 1 << 0 , GCLIB_AXIS_B = 1 << 1 , GCLIB_AXIS_C = 1 << 2 ,
  GCLIB_AXIS_D = 1 << 3 , GCLIB_AXIS_E = 1 << 4 , GCLIB_AXIS_F = 1 << 5 , GCLIB_AXIS_G = 1 << 6 ,
  GCLIB_AXIS_H = 1 << 7 , GCLIB_ALL_AXES = (1 << 8) - 1
}
 Flags for building an axis mask, for example in gclib_set_interrupts(). More...
enum  gclib_connection_t { GCLIB_ETHERNET = 1 , GCLIB_SERIAL , GCLIB_PCI }
 Connection type, as returned by gclib_connection_type(). More...
enum  gclib_mode_of_motion_t {
  GCLIB_NO_MOTION , GCLIB_CONTOUR , GCLIB_POSITION_ABSOLUTE , GCLIB_POSITION_RELATIVE ,
  GCLIB_FIND_EDGE , GCLIB_FIND_INDEX , GCLIB_HOME , GCLIB_VECTOR_MOVE ,
  GCLIB_LINEAR_MOVE = GCLIB_VECTOR_MOVE
}
 The controller's current mode of motion, given by gclib_data_record_mode_of_motion(). More...
enum  gclib_ethernet_status_t {
  HANDLE_FREE = 0 , UDP_SLAVE = 1 , TCP_SLAVE = 2 , UDP_MASTER = -1 ,
  TCP_MASTER = -2 , ESTABLISHING_UDP = -5 , ESTABLISHING_TCP = -6
}
 The current status of an ethernet handle, given by gclib_data_record_ethernet_status(). More...

Functions

gclib_result gclib_version (char *version, size_t len)
 Get library version.
gclib_result gclib_gcaps_version (char *gcaps_version, size_t len)
 Get library version used by current gcaps server.
gclib_result gclib_addresses (char *addresses, size_t len)
 Show address, model, and serial of detected controllers, where available.
gclib_result gclib_ip_requests (char *ip_requests, size_t len)
 Show MAC address, model, and serial of all controllers requesting IP addresses, comma-separated.
gclib_result gclib_assign_ip (const char *mac, const char *ip)
 Assign IP to a controller.
gclib_result gclib_list_servers (char *servers, size_t len)
 List available gcaps servers separated by newline.
gclib_result gclib_server (char *name, size_t len)
 Current gcaps server.
gclib_result gclib_set_server (const char *name)
 Set gcaps server.
gclib_result gclib_published (char *name, size_t len)
 Provides published status of local gcaps server.
gclib_result gclib_set_published (const char *name)
 Set published status of local gcaps server.
void gclib_force_gcaps (bool on)
 Force future library calls to use either gcaps or direct connections.
gclib_result gclib_open (gclib_handle *h, const char *address)
 Open a connection to a controller.
gclib_result gclib_set_baud_rate (gclib_handle h, size_t baud_rate)
 Set baud rate of serial connection.
gclib_result gclib_close (gclib_handle *h)
 Close connection to controller.
const char * gclib_error (gclib_handle h)
 Get library error string.
gclib_result gclib_address (gclib_handle h, char *address, size_t len)
 Get connection address.
gclib_result gclib_connection_type (gclib_handle h, gclib_connection_t *type)
 Get connection type.
gclib_result gclib_revision_information (gclib_handle h, char *rev_info, size_t len)
 Get revision information (^R^V) from controller.
gclib_result gclib_serial_number (gclib_handle h, uint32_t *serial_number)
 Get serial number from controller.
gclib_result gclib_command (gclib_handle h, const char *command, char *buf, size_t len)
 Issues a command to the controller and provides the response.
gclib_result gclib_set_interrupts (gclib_handle h, gclib_interrupt_type interrupt_mask, gclib_axis_flags motion_complete_axes, gclib_digital_input_flags digital_inputs)
 Configure which interrupts will be generated by the controller.
gclib_result gclib_set_data_records (gclib_handle h, size_t period_ms)
 Configure controller data records.
gclib_result gclib_subscribe_messages (gclib_handle h, void(callback)(void *user_data, const char *message), void *user_data)
 Subscribe to unsolicited messages.
gclib_result gclib_subscribe_interrupts (gclib_handle h, void(callback)(void *user_data, gclib_interrupt_t interrupt), void *user_data)
 Subscribe to interrupts.
gclib_result gclib_subscribe_data_records (gclib_handle h, void(callback)(void *user_data, gclib_data_record_handle data_record), void *user_data)
 Subscribe to data records.
gclib_result gclib_subscribe_progress (gclib_handle h, void(callback)(void *user_data, size_t current, size_t max), void *user_data)
 Subscribe to progress for gclib_set_program(), gclib_set_array(), and gclib_set_firmware().
gclib_result gclib_unsubscribe (gclib_handle h, void *callback)
 Unsubscribe from messages, interrupts, data records, or progress.
gclib_result gclib_message (gclib_handle h, char *message, size_t len, int timeout)
 Get a queued unsolicited message, or wait up to timeout ms for one to arrive.
gclib_result gclib_interrupt (gclib_handle h, gclib_interrupt_t *interrupt, int timeout)
 Get a queued interrupt, or wait up to timeout ms for one to arrive.
gclib_result gclib_data_record (gclib_handle h, gclib_data_record_handle *data_record, int timeout)
 Get a queued data record, or wait up to timeout ms for one to arrive.
gclib_result gclib_program (gclib_handle h, char *program, size_t len)
 Get the controller's current program.
gclib_result gclib_set_program (gclib_handle h, const char *program, const char *insert)
 Set the program on the controller.
gclib_result gclib_array (gclib_handle h, const char *name, char *buf, size_t len, size_t start, size_t end)
 Get an array from the controller.
gclib_result gclib_set_array (gclib_handle h, const char *name, const char *buf, size_t start, size_t end)
 Set an array on the controller.
gclib_result gclib_set_firmware (gclib_handle h, const char *file_path)
 Set the firmware on the controller.
uint16_t gclib_data_record_sample (gclib_data_record_handle h)
 The sample in which this data record was generated.
bool gclib_data_record_input (gclib_data_record_handle h, size_t index)
 Get an input.
bool gclib_data_record_output (gclib_data_record_handle h, size_t index)
 Get an output.
uint8_t gclib_data_record_input_bank (gclib_data_record_handle h, size_t index)
 Get a bank of inputs.
uint8_t gclib_data_record_output_bank (gclib_data_record_handle h, size_t index)
 Get a bank of outputs.
uint8_t gclib_data_record_error_code (gclib_data_record_handle h)
 Get the error code.
uint32_t gclib_data_record_contour_segment_count (gclib_data_record_handle h)
 Get the contour segment count.
uint16_t gclib_data_record_contour_buffer_available (gclib_data_record_handle h)
 Get remaining contour buffer.
bool gclib_data_record_thread_running (gclib_data_record_handle h, size_t thread)
 Returns true if a given thread is running.
gclib_ethernet_status_t gclib_data_record_ethernet_status (gclib_data_record_handle h, char handle)
 Get ethernet handle status.
gclib_result gclib_data_record_bytes (gclib_data_record_handle h, char *data_record, size_t len)
 Copy data record to user buffer.
bool gclib_data_record_motor_off (gclib_data_record_handle h, char axis)
 Get motor off status.
bool gclib_data_record_latch_armed (gclib_data_record_handle h, char axis)
 Get latch armed.
bool gclib_data_record_final_deceleration (gclib_data_record_handle h, char axis)
 Returns true when axis is in final deceleration.
bool gclib_data_record_stopping (gclib_data_record_handle h, char axis)
 Returns true if axis is stopping.
bool gclib_data_record_slewing (gclib_data_record_handle h, char axis)
 Returns true if axis is slewing.
gclib_mode_of_motion_t gclib_data_record_mode_of_motion (gclib_data_record_handle h, char axis)
 Returns the mode of motion being profiled.
bool gclib_data_record_negative_direction_move (gclib_data_record_handle h, char axis)
 Returns true if axis velocity is negative.
bool gclib_data_record_moving (gclib_data_record_handle h, char axis)
 Returns true if motion is being profiled.
int gclib_data_record_home_phase (gclib_data_record_handle h, char axis)
 Returns home phase when in GCLIB_HOME mode.
bool gclib_data_record_stepper_mode (gclib_data_record_handle h, char axis)
 Returns true if axis is configured as a stepper motor.
bool gclib_data_record_home_input (gclib_data_record_handle h, char axis)
 Returns the state of the home input.
bool gclib_data_record_reverse_limit (gclib_data_record_handle h, char axis)
 Returns the state of the reverse limit.
bool gclib_data_record_forward_limit (gclib_data_record_handle h, char axis)
 Returns the state of the forward limit.
bool gclib_data_record_latch_input (gclib_data_record_handle h, char axis)
 Returns the state of the latch input.
bool gclib_data_record_latch_occurred (gclib_data_record_handle h, char axis)
 Returns whether the latch was triggered.
uint8_t gclib_data_record_stop_code (gclib_data_record_handle h, char axis)
 Returns a code indicating why the motor has stopped. See the SC command reference for details.
int32_t gclib_data_record_reference_position (gclib_data_record_handle h, char axis)
 Returns the reference position.
int32_t gclib_data_record_position (gclib_data_record_handle h, char axis)
 Returns the position.
int32_t gclib_data_record_position_error (gclib_data_record_handle h, char axis)
 Returns the position error.
int32_t gclib_data_record_aux_position (gclib_data_record_handle h, char axis)
 Returns the auxiliary position.
int32_t gclib_data_record_velocity (gclib_data_record_handle h, char axis)
 Returns the velocity.
double gclib_data_record_torque (gclib_data_record_handle h, char axis)
 Returns the torque.
double gclib_data_record_analog_input (gclib_data_record_handle h, char axis)
 Returns the analog input.
uint8_t gclib_data_record_halls (gclib_data_record_handle h, char axis)
 Returns the hall state.
int32_t gclib_data_record_variable (gclib_data_record_handle h, char axis)
 Returns the value of a user variable for an axis.
bool gclib_data_record_hall_error (gclib_data_record_handle h, char axis)
 Returns true if the amplifier for this axis has triggered a hall error.
bool gclib_data_record_peak_current (gclib_data_record_handle h, char axis)
 Returns true if the amplifier for this axis has triggered a peak current error.
bool gclib_data_record_over_current (gclib_data_record_handle h, size_t amp)
 Returns over current status.
bool gclib_data_record_over_voltage (gclib_data_record_handle h, size_t amp)
 Returns over voltage status.
bool gclib_data_record_over_temp (gclib_data_record_handle h, size_t amp)
 Returns over temperature status.
bool gclib_data_record_under_voltage (gclib_data_record_handle h, size_t amp)
 Returns under voltage status.
bool gclib_data_record_electronic_lock_out (gclib_data_record_handle h, size_t amp)
 Returns electronic lockout (ELO) status for a bank.
uint16_t gclib_data_record_coordinated_move_segment_count (gclib_data_record_handle h, char plane)
 Returns the segment count for the current move.
uint16_t gclib_data_record_coordinated_move_status (gclib_data_record_handle h, char plane)
 Returns the coordinated move status word.
bool gclib_data_record_coordinated_move_final_deceleration (gclib_data_record_handle h, char plane)
 Returns true if in final deceleration.
bool gclib_data_record_coordinated_move_stopping (gclib_data_record_handle h, char plane)
 Returns true if stopping.
bool gclib_data_record_coordinated_move_slewing (gclib_data_record_handle h, char plane)
 Returns true if slewing.
bool gclib_data_record_coordinated_move_moving (gclib_data_record_handle h, char plane)
 Returns true if moving.
int32_t gclib_data_record_coordinated_move_distance (gclib_data_record_handle h, char plane)
 Returns the distance covered in the current move.
uint16_t gclib_data_record_coordinated_move_buffer_available (gclib_data_record_handle h, char plane)
 Returns the available buffer space.
void gclib_set_compat ()
gclib_result gclib_set_timeout (gclib_handle h, size_t timeout)

Detailed Description

Defines the interface for the Galil C Library (GCLIB).

Definition in file gclib.h.