| gclib 2.4.1 Galil Communications Library

Loading...
Searching...
No Matches
Functions
Memory
C (Legacy) » Controller

Manage controller memory, such as program and arrays. More...

## Functions
GCLIB_DEPRECATED GReturn | GProgramDownload (GCon g, GCStringIn program, GCStringIn preprocessor)
| Downloads a program to the controller's program buffer.
GCLIB_DEPRECATED GReturn | GProgramUpload (GCon g, GBufOut buffer, GSize buffer_len)
| Uploads a program from the controller's program buffer.
GCLIB_DEPRECATED GReturn | GArrayDownload (GCon g, const GCStringIn array_name, GOption first, GOption last, GCStringIn buffer)
| Downloads array data to a pre-dimensioned array in the controller's array table.
GCLIB_DEPRECATED GReturn | GArrayUpload (GCon g, const GCStringIn array_name, GOption first, GOption last, GOption delim, GBufOut buffer, GSize buffer_len)
| Uploads array data from the controller's array table.
GCLIB_DEPRECATED GReturn | GFirmwareDownload (GCon g, GCStringIn filepath)
| Upgrade firmware.
GCLIB_DEPRECATED GReturn | GProgramDownloadFile (GCon g, GCStringIn file_path, GCStringIn preprocessor)
| Program download from file.
GCLIB_DEPRECATED GReturn | GProgramUploadFile (GCon g, GCStringIn file_path)
| Program upload to file.
GCLIB_DEPRECATED GReturn | GArrayDownloadFile (GCon g, GCStringIn file_path)
| Array download from file.
GCLIB_DEPRECATED GReturn | GArrayUploadFile (GCon g, GCStringIn file_path, GCStringIn names)
| Array upload to file.
GCLIB_DEPRECATED GReturn | GSetupDownloadFile (GCon g, GCStringIn file_path, GOption options, GCStringOut info, GSize info_len)
| Download a saved controller configuration from a file.

## Detailed Description

Manage controller memory, such as program and arrays.

## Function Documentation

## ◆ GProgramDownload()

GCLIB_DEPRECATED GReturn GProgramDownload | ( | GCon | g,
|  | GCStringIn | program,
|  | GCStringIn | preprocessor )

Downloads a program to the controller's program buffer.

Deprecated
  This function is part of the deprecated C (Legacy) API, which will be removed in a future release. Use gclib_set_program() instead.

Parameters

  g | Connection's handle.
  program | Null-terminated program for download.
  preprocessor | Options string for preprocessing the program before sending it to the controller. Null allows the library to use defaults for the download. See the Program Preprocessor documentation for options.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

## ◆ GProgramUpload()

GCLIB_DEPRECATED GReturn GProgramUpload | ( | GCon | g,
|  | GBufOut | buffer,
|  | GSize | buffer_len )

Uploads a program from the controller's program buffer.

Deprecated
  This function is part of the deprecated C (Legacy) API, which will be removed in a future release. Use gclib_program() instead.

Parameters

  g | Connection's handle.
  buffer | Buffer to receive the controller's program. The data will be null terminated unless function returns G_BAD_LOST_DATA due to the buffer being too small to hold the data.
  buffer_len | The length of the receive buffer.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

## ◆ GArrayDownload()

GCLIB_DEPRECATED GReturn GArrayDownload | ( | GCon | g,
|  | const GCStringIn | array_name,
|  | GOption | first,
|  | GOption | last,
|  | GCStringIn | buffer )

Downloads array data to a pre-dimensioned array in the controller's array table.

Deprecated
  This function is part of the deprecated C (Legacy) API, which will be removed in a future release. Use gclib_set_array() instead.

Warning
  The array must already exist on the controller and be sufficient dimension to hold the desired array data, e.g. via DM.

Parameters

  g | Connection's handle.
  array_name | Null-terminated string containing the name of the array to download. Must match the array name used in DM.
  first | The first element of the array for sub-array downloads. G_BOUNDS to omit.
  last | The last element of the array for sub-array downloads. G_BOUNDS to omit.
  buffer | Buffer containing the null-terminated data to be sent to the controller. The array data may be separated with carriage return, carriage return + line feed, or a comma. No spaces.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

## ◆ GArrayUpload()

GCLIB_DEPRECATED GReturn GArrayUpload | ( | GCon | g,
|  | const GCStringIn | array_name,
|  | GOption | first,
|  | GOption | last,
|  | GOption | delim,
|  | GBufOut | buffer,
|  | GSize | buffer_len )

Uploads array data from the controller's array table.

Deprecated
  This function is part of the deprecated C (Legacy) API, which will be removed in a future release. Use gclib_array() instead.

Parameters

  g | Connection's handle.
  array_name | Null-terminated string containing the name of the array to upload.
  first | The first element of the array for sub-array uploads. G_BOUNDS to omit.
  last | The last element of the array for sub-array uploads. G_BOUNDS to omit.
  delim | Sets the delimeter between array elements in the returned data, G_CR specifies carriage return, G_COMMA specifies comma.
  buffer | Buffer to receive the uploaded data. The data will be null terminated unless function returns G_BAD_LOST_DATA due to the buffer being too small to hold the data.
  buffer_len | The length of the receive buffer.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

## ◆ GFirmwareDownload()

GCLIB_DEPRECATED GReturn GFirmwareDownload | ( | GCon | g,
|  | GCStringIn | filepath )

Upgrade firmware.

Deprecated
  This function is part of the deprecated C (Legacy) API, which will be removed in a future release. Use gclib_set_firmware() instead.

Parameters

  g | Connection's handle.
  filepath | The full file path to the Galil-supplied firmware hex file. See http://www.galil.com/downloads/firmware

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

## ◆ GProgramDownloadFile()

GCLIB_DEPRECATED GReturn GProgramDownloadFile | ( | GCon | g,
|  | GCStringIn | file_path,
|  | GCStringIn | preprocessor )

Program download from file.

Deprecated
  This function is part of the deprecated C (Legacy) API, which will be removed in a future release.

Parameters

  g | Connection's handle.
  file_path | Null-terminated string containing the path to the program file.
  preprocessor | Options string for preprocessing the program before sending it to the controller. See GProgramDownload().

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

## ◆ GProgramUploadFile()

GCLIB_DEPRECATED GReturn GProgramUploadFile | ( | GCon | g,
|  | GCStringIn | file_path )

Program upload to file.

Deprecated
  This function is part of the deprecated C (Legacy) API, which will be removed in a future release.

Parameters

  g | Connection's handle.
  file_path | Null-terminated string containing the path to the program file, file will be overwritten if it exists.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

## ◆ GArrayDownloadFile()

GCLIB_DEPRECATED GReturn GArrayDownloadFile | ( | GCon | g,
|  | GCStringIn | file_path )

Array download from file.

Deprecated
  This function is part of the deprecated C (Legacy) API, which will be removed in a future release.

Downloads a csv file containing array data at file_path. If the arrays don't exist, they will be dimensioned.

Parameters

  g | Connection's handle.
  file_path | Null-terminated string containing the path to the array file.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

## ◆ GArrayUploadFile()

GCLIB_DEPRECATED GReturn GArrayUploadFile | ( | GCon | g,
|  | GCStringIn | file_path,
|  | GCStringIn | names )

Array upload to file.

Deprecated
  This function is part of the deprecated C (Legacy) API, which will be removed in a future release.

Uploads the entire controller array table or a subset and saves the data as a csv file specified by file_path.

Parameters

  g | Connection's handle.
  file_path | Null-terminated string containing the path to the array file, file will be overwritten if it exists.
  names | Null-terminated string containing the arrays to upload, delimited with space. "" or null uploads all arrays listed in LA.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

## ◆ GSetupDownloadFile()

GCLIB_DEPRECATED GReturn GSetupDownloadFile | ( | GCon | g,
|  | GCStringIn | file_path,
|  | GOption | options,
|  | GCStringOut | info,
|  | GSize | info_len )

Download a saved controller configuration from a file.

Deprecated
  This function is part of the deprecated C (Legacy) API, which will be removed in a future release.

Parameters

  g | Connection's handle.
  file_path | Null-terminated string containing the path to the gcb file.
  options | Bit mask to determine what configuration data to download. See below for all options.
  info | Optional pointer to a buffer to store the controller info. If no info is needed, specify as NULL.
  info_len | Length of optional info buffer. If no info is needed, specify as NULL.

Returns
  The success status or error code of the function. If the options parameter is set to 0, the return value will be a bit mask indicating which sectors in the specified GCB are not empty. Otherwise, see gclib_errors.h for possible error values.

Note
  By default, GSetupDownloadFile() will stop immediately if an error is encountered downloading data. This can be overridden in the options parameter. For example, you may want to override the error if you have a backup from an 8-axis controller and want to restore the parameters for the first 4 axes to a 4-axis controller.

If both info and info_len are not NULL, the controller information will be provided regardless of the options parameter.

The options parameter is a bit mask. If options is set to 0, GSetupDownloadFile() will return a bit mask indicating which sectors in the specified GCB are not empty. The following contains a list of all currently available options:

Bit | Value | Function | Description
--- | --- | --- | ---
1 | 0x0002 | Restore parameters | KPA, KIA, KDA, etc...
3 | 0x0008 | Restore variables | Variables are listed by the LV command
4 | 0x0010 | Restore arrays | Arrays are listed by the LA command
5 | 0x0020 | Restore program | The program is listed by the LS command
31 | 0x8000 | Ignore errors | Ignore invalid parameter errors and continue restoring data. GSetupDownloadFile() will still stop immediately if a connection issue or other fatal error is encountered

Usage example:

GCon g;
GOption opt = 0;
GCStringOut info;
GSize info_len = 4096;
GReturn rc = G`
// Call GSetupDownloadFile() with options set to 0 so we can get the non-empty sector bit mask
opt = GSetupDownloadFile(g, "C:\\path\\to\\gcb\\file.gcb", 0, NULL, NULL);
info = (GCStringOut)malloc(sizeof(GCStringOut) * info_len);
// Call GSetupDownloadFile() with the bit mask returned in the previous function call
rc = GSetupDownloadFile(g, "C:\\path\\to\\gcb\\file.gcb", opt, info, info_len);
printf("Info:\n\n%s", info);
GClose(g);
free(info);
return rc;
GReturn
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
Definition gclib_compat.h:94
GOption
int GOption
Option integer for various formatting, etc.
Definition gclib_compat.h:97
GSize
unsigned int GSize
Size of buffers, etc.
Definition gclib_compat.h:96
GCon
struct Context * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
Definition gclib_compat.h:95
GCStringOut
char * GCStringOut
C-string output from the library. Implies null-termination.
Definition gclib_compat.h:98
GClose
GCLIB_DEPRECATED GReturn GClose(GCon g)
Closes a connection to a Galil Controller.
GSetupDownloadFile
GCLIB_DEPRECATED GReturn GSetupDownloadFile(GCon g, GCStringIn file_path, GOption options, GCStringOut info, GSize info_len)
Download a saved controller configuration from a file.