Legrand / Raritan / Server Technology Xerus™ JSON-RPC API: luaservice::Manager Interface Reference

Legrand / Raritan / Server Technology Xerus™ JSON-RPC API

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
luaservice::Manager Interface Reference

There is a single manager instance. More...

`import <LuaService.idl;`

## Public Member Functions
int | setScript (in string name, in string script, in ScriptOptions options)
| Upload a script to instance.
int | getScript (in string name, out string script)
| To download a script file to user.
vector< string > | getScriptNames ()
| Returns all script names in a string vector.
int | deleteScript (in string name)
| Deletes a script.
int | setScriptOptions (in string name, in ScriptOptions options)
| Sets new options for a script.
int | getScriptOptions (in string name, out ScriptOptions options)
| Returns the options for a script.
Environment | getEnvironment ()
| To query the environment information.
int | getScriptOutput (in string name, in long iAddr, out long oAddr, out long nAddr, out string oString, out boolean more)
| To get output from a script as a string.
int | clearScriptOutput (in string name)
| Clear the output buffer of a script.
int | startScript (in string name)
| To start a script.
int | startScriptWithArgs (in string name, in map< string, string > arguments)
| To start a script with arguments.
int | terminateScript (in string name)
| To stop a script.
int | getScriptState (in string name, out ScriptState state)
| Returns the state for a single script.
map< string, ScriptState > | getScriptStates ()
| Returns the state for all scripts.

## Public Attributes
constant int | NO_ERROR = 0
| Error codes.
constant int | ERR_INVALID_NAME = 1
| script name is invalid
constant int | ERR_NO_SUCH_SCRIPT = 2
| script name not found
constant int | ERR_MAX_SCRIPT_NUMBERS_EXCEEDED = 3
| maximum amount of stored script files is reached
constant int | ERR_MAX_SCRIPT_SIZE_EXCEEDED = 4
| maximum size of a script file is reached
constant int | ERR_MAX_ALL_SCRIPT_SIZE_EXCEEDED = 5
| maximum size of all script files is reached
constant int | ERR_NOT_TERMINATED = 6
| script is not terminated
constant int | ERR_NOT_RUNNING = 7
| script is not running
constant int | ERR_INVALID_ADDR = 8
| address parameter is wrong
constant int | ERR_TOO_MANY_ARGUMENTS = 10
| too many arguments
constant int | ERR_ARGUMENT_NOT_VALID = 11
| the argument has one or more invalid characters

## Detailed Description

There is a single manager instance.

Definition at line 96 of file LuaService.idl.

## Member Function Documentation

## ◆ clearScriptOutput()

int luaservice::Manager::clearScriptOutput | ( | in string | name | ) |

Clear the output buffer of a script.

Parameters

  name | The name of the script

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if file name is invalid
  ERR_NO_SUCH_SCRIPT if there is no script with the name

## ◆ deleteScript()

int luaservice::Manager::deleteScript | ( | in string | name | ) |

Deletes a script.

Parameters

  name | The name of the script

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if script name is invalid
  ERR_NO_SUCH_SCRIPT if there is no script with the name
  ERR_NOT_TERMINATED if try to delete a running script

## ◆ getEnvironment()

Environment luaservice::Manager::getEnvironment | ( |  | ) |

To query the environment information.

Returns
  a struct with the environment information

## ◆ getScript()

int luaservice::Manager::getScript | ( | in string | name,
|  | out string | script )

To download a script file to user.

Parameters

  name | The name of an existing script

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if script name is invalid
  ERR_NO_SUCH_SCRIPT if there is no script with the name

## ◆ getScriptNames()

vector< string > luaservice::Manager::getScriptNames | ( |  | ) |

Returns all script names in a string vector.

If there are no scripts the vector is empty.

Returns
  A vector with all script names.

## ◆ getScriptOptions()

int luaservice::Manager::getScriptOptions | ( | in string | name,
|  | out ScriptOptions | options )

Returns the options for a script.

Parameters

  name | The name of the script
  options | The return value

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if script name is invalid
  ERR_NO_SUCH_SCRIPT if there is no script with the name

## ◆ getScriptOutput()

int luaservice::Manager::getScriptOutput | ( | in string | name,
|  | in long | iAddr,
|  | out long | oAddr,
|  | out long | nAddr,
|  | out string | oString,
|  | out boolean | more )

To get output from a script as a string.

The output is stored in a string buffer with a defined size. The buffer is addressable with an (virtual) address. The address will be increased ervery time when the buffer will be filled.

To get the output for the first time just call with address zero and then use the returned nAddr argument.

If iAddr is negative then the last n bytes will be returned, e.g. -9 returns the last 9 characters. If iAddr is zero then the whole available buffer will be returned. If iAddr is positive then the returned buffer starts at this address. If iAddr is equal to nAddr then there is no data available If iAddr and oAddr is not equal then there were data lost (execption: first call with zero).

Parameters

  name | The name of the script
  iAddr | The virtual start address where the returned output should begin.
  oAddr | The virtual address from where the string starts.
  nAddr | The virtual address for the next query.
  more | A boolean whitch indicates if there is more data available.

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if file name is invalid
  ERR_NO_SUCH_SCRIPT if there is no script with the name
  ERR_INVALID_ADDR if iAddr is negative and the absolute value of parameter iAddr is greater as the limit

## ◆ getScriptState()

int luaservice::Manager::getScriptState | ( | in string | name,
|  | out ScriptState | state )

Returns the state for a single script.

Parameters

  name | The script name
  state | The state of the script

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if file name is invalid
  ERR_NO_SUCH_SCRIPT if there is no script with the name

## ◆ getScriptStates()

map< string, ScriptState > luaservice::Manager::getScriptStates | ( |  | ) |

Returns the state for all scripts.

If the map is empty then there are no scripts on the machine.

Returns
  A map<string name, ScriptState state> with name and state for all available scripts.

## ◆ setScript()

int luaservice::Manager::setScript | ( | in string | name,
|  | in string | script,
|  | in ScriptOptions | options )

Upload a script to instance.

If there is a script with the same name the new script will replace the existing script (script must be in STAT_NEW or STAT_TERMINATED).

Parameters

  name | The name of the script file
  script | The script file packed in a string
  options | Options that can be set or not

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if script name is invalid
  ERR_MAX_SCRIPT_SIZE_EXCEEDED if the size of the new script is greater then the maximum file size
  ERR_MAX_ALL_SCRIPT_SIZE_EXCEEDED if maximum size of all script files is reached
  ERR_MAX_SCRIPT_NUMBERS_EXCEEDED if maximum amount of script files is reached
  ERR_NOT_TERMINATED if try to replace a running script

## ◆ setScriptOptions()

int luaservice::Manager::setScriptOptions | ( | in string | name,
|  | in ScriptOptions | options )

Sets new options for a script.

Parameters

  name | The name of the script
  options | The new options

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if script name is invalid
  ERR_NO_SUCH_SCRIPT if there is no script with the name
  ERR_TOO_MANY_ARGUMENTS if the size of the map is to big
  ERR_ARGUMENT_NOT_VALID if a string in the arguments is not

## ◆ startScript()

int luaservice::Manager::startScript | ( | in string | name | ) |

To start a script.

The function starts a lua script.

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if file name is invalid
  ERR_NO_SUCH_SCRIPT if there is no script with the name
  ERR_NOT_TERMINATED if the script is running or restarting

## ◆ startScriptWithArgs()

int luaservice::Manager::startScriptWithArgs | ( | in string | name,
|  | in map< string, string > | arguments )

To start a script with arguments.

The function starts a lua script. Additionally you can add arguments which are available from the lua script. This args will override the default arguments. All args are stored in a global table called ARGS in lua.

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if file name is invalid
  ERR_NO_SUCH_SCRIPT if there is no script with the name
  ERR_NOT_TERMINATED if the script is running or restarting
  ERR_TOO_MANY_ARGUMENTS if the size of the map is to big
  ERR_ARGUMENT_NOT_VALID if a string in the arguments is not valid

## ◆ terminateScript()

int luaservice::Manager::terminateScript | ( | in string | name | ) |

To stop a script.

This command stops a running or restarting script. After terminating the option autorestart will not be evaluated.

Returns
  NO_ERROR if OK
  ERR_INVALID_NAME if file name is invalid
  ERR_NO_SUCH_SCRIPT if there is no script with the name
  ERR_NOT_RUNNING if the script is not running or restarting

## Member Data Documentation

## ◆ ERR_ARGUMENT_NOT_VALID

constant int luaservice::Manager::ERR_ARGUMENT_NOT_VALID = 11

the argument has one or more invalid characters

Definition at line 109 of file LuaService.idl.

## ◆ ERR_INVALID_ADDR

constant int luaservice::Manager::ERR_INVALID_ADDR = 8

address parameter is wrong

Definition at line 107 of file LuaService.idl.

## ◆ ERR_INVALID_NAME

constant int luaservice::Manager::ERR_INVALID_NAME = 1

script name is invalid

Definition at line 100 of file LuaService.idl.

## ◆ ERR_MAX_ALL_SCRIPT_SIZE_EXCEEDED

constant int luaservice::Manager::ERR_MAX_ALL_SCRIPT_SIZE_EXCEEDED = 5

maximum size of all script files is reached

Definition at line 104 of file LuaService.idl.

## ◆ ERR_MAX_SCRIPT_NUMBERS_EXCEEDED

constant int luaservice::Manager::ERR_MAX_SCRIPT_NUMBERS_EXCEEDED = 3

maximum amount of stored script files is reached

Definition at line 102 of file LuaService.idl.

## ◆ ERR_MAX_SCRIPT_SIZE_EXCEEDED

constant int luaservice::Manager::ERR_MAX_SCRIPT_SIZE_EXCEEDED = 4

maximum size of a script file is reached

Definition at line 103 of file LuaService.idl.

## ◆ ERR_NO_SUCH_SCRIPT

constant int luaservice::Manager::ERR_NO_SUCH_SCRIPT = 2

script name not found

Definition at line 101 of file LuaService.idl.

## ◆ ERR_NOT_RUNNING

constant int luaservice::Manager::ERR_NOT_RUNNING = 7

script is not running

Definition at line 106 of file LuaService.idl.

## ◆ ERR_NOT_TERMINATED

constant int luaservice::Manager::ERR_NOT_TERMINATED = 6

script is not terminated

Definition at line 105 of file LuaService.idl.

## ◆ ERR_TOO_MANY_ARGUMENTS

constant int luaservice::Manager::ERR_TOO_MANY_ARGUMENTS = 10

too many arguments

Definition at line 108 of file LuaService.idl.

## ◆ NO_ERROR

constant int luaservice::Manager::NO_ERROR = 0

Error codes.

no Error

Definition at line 99 of file LuaService.idl.

The documentation for this interface was generated from the following file:

- LuaService.idl