Class Scripts
Provides access to scripting methods of the pigpio library. Scripts are used by the pigpio daemon to execute a set of instructions to speedup GPIO instructions. Unused in the managed model of this library but provided for reference purposes.
Inherited Members
Namespace: Unosquare.PiGpio.NativeMethods
Syntax
public static class Scripts
Methods
GpioDeleteScript(UInt32)
This function deletes a stored script.
The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
Declaration
public static int GpioDeleteScript(uint script_id)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | script_id |
|
Returns
Type | Description |
---|---|
Int32 | The result code. 0 for success. See the ResultCode enumeration. |
GpioRunScript(UInt32, UInt32, UInt32[])
This function runs a stored script.
The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or PI_TOO_MANY_PARAM.
param is an array of up to 10 parameters which may be referenced in the script as p0 to p9.
Declaration
public static int GpioRunScript(uint script_id, uint numPar, uint[] param)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | script_id |
|
UInt32 | numPar | 0-10, the number of parameters. |
UInt32[] | param | an array of parameters. |
Returns
Type | Description |
---|---|
Int32 | The result code. 0 for success. See the ResultCode enumeration. |
GpioScriptStatus(UInt32, UInt32[])
This function returns the run status of a stored script as well as the current values of parameters 0 to 9.
The function returns greater than or equal to 0 if OK, otherwise PI_BAD_SCRIPT_ID.
The run status may be
The current value of script parameters 0 to 9 are returned in param.
Declaration
public static int GpioScriptStatus(uint script_id, uint[] param)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | script_id |
|
UInt32[] | param | an array to hold the returned 10 parameters. |
Returns
Type | Description |
---|---|
Int32 | The result code. 0 for success. See the ResultCode enumeration. |
Remarks
PI_SCRIPT_INITING PI_SCRIPT_HALTED PI_SCRIPT_RUNNING PI_SCRIPT_WAITING PI_SCRIPT_FAILED.
GpioStopScript(UInt32)
This function stops a running script.
The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
Declaration
public static int GpioStopScript(uint script_id)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | script_id |
|
Returns
Type | Description |
---|---|
Int32 | The result code. 0 for success. See the ResultCode enumeration. |
GpioStoreScript(String)
This function stores a null terminated script for later execution.
See [[http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts]] for details.
The function returns a script id if the script is valid, otherwise PI_BAD_SCRIPT.
Declaration
public static int GpioStoreScript(string script)
Parameters
Type | Name | Description |
---|---|---|
String | script | the text of the script. |
Returns
Type | Description |
---|---|
Int32 | The result code. 0 for success. See the ResultCode enumeration. |
GpioUpdateScript(UInt32, UInt32, UInt32[])
This function sets the parameters of a script. The script may or may not be running. The first numPar parameters of the script are overwritten with the new values.
The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or PI_TOO_MANY_PARAM.
param is an array of up to 10 parameters which may be referenced in the script as p0 to p9.
Declaration
public static int GpioUpdateScript(uint script_id, uint numPar, uint[] param)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | script_id |
|
UInt32 | numPar | 0-10, the number of parameters. |
UInt32[] | param | an array of parameters. |
Returns
Type | Description |
---|---|
Int32 | The result code. 0 for success. See the ResultCode enumeration. |
RawDumpScript(UInt32)
Used to print a readable version of a script to stderr.
Not intended for general use.
Declaration
public static void RawDumpScript(uint scriptId)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | scriptId |
|