| gclib 2.4.1 Galil Communications Library

Loading...
Searching...
No Matches
Functions
Memory
C » Controller

Manage controller firmware, program, and arrays. More...

## Functions
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.

## Detailed Description

Manage controller firmware, program, and arrays.

## Function Documentation

## ◆ gclib_program()

gclib_result gclib_program | ( | gclib_handle | h,
|  | char * | program,
|  | size_t | len )

Get the controller's current program.

Parameters

  h | Handle to an open connection.
  program | Output buffer for program.
  len | Length of output buffer.

Returns
  GCLIB_BUFFER_TOO_SMALL if program does not fit in buffer.

## ◆ gclib_set_program()

gclib_result gclib_set_program | ( | gclib_handle | h,
|  | const char * | program,
|  | const char * | insert )

Set the program on the controller.

Parameters

  h | Handle to an open connection.
  program | Program to write to controller memory. Lines may be separated by \r, \r\n, or \n.
  insert | Either a line number or a label name to start downloading from.

Returns
  GCLIB_INVALID_ARGUMENT if program is not accepted by controller (for example, if a program is already running).

## ◆ gclib_array()

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.

Parameters

  h | Handle to an open connection.
  name | Array name on controller.
  buf | Output buffer for comma-separated array values.
  len | Length of output buffer.
  start | Index to start reading array.
  end | Index to stop reading array.

Returns
  GCLIB_INVALID_ARGUMENT if array does not exist on controller.

## ◆ gclib_set_array()

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.

Array will be automatically dimensioned unless one of the following is true:

- Start or end are nonzero
- Controller is currently recording arrays
- Modbus array write is enabled

Parameters

  h | Handle to open connection.
  name | Array name on controller (will be dimensioned if not present).
  buf | Array buffer. Elements may be separated by ,, \r, or \r\n. Do not use spaces.
  start | Index to start writing over an existing array. Leave 0 to
  end | Index to stop writing over an existing array.

Returns
  GCLIB_INVALID_ARGUMENT if array does not exist but cannot be automatically dimensioned, or start / end are invalid for array.

## ◆ gclib_set_firmware()

gclib_result gclib_set_firmware | ( | gclib_handle | h,
|  | const char * | file_path )

Set the firmware on the controller.

Parameters

  h | Handle to open connection.
  file_path | Path to firmware file.

Returns
  GCLIB_INVALID_ARGUMENT if firmware file cannot be opened, or is rejected by the controller.