Package com.mouseviator.fsuipc.helpers
Class LuaHelper.LuaControlRequest
java.lang.Object
com.mouseviator.fsuipc.datarequest.DataRequest
com.mouseviator.fsuipc.helpers.LuaHelper.LuaControlRequest
- All Implemented Interfaces:
IDataRequest<java.lang.String>
,IWriteOnlyRequest<java.lang.String>
- Enclosing class:
- LuaHelper
public static class LuaHelper.LuaControlRequest extends DataRequest implements IWriteOnlyRequest<java.lang.String>
This class implements Lua control request. It is a WRITE type request, writing a string at offset 0x0D70. This
string than identifies what should FSUIPC do with specified lua program. By default the control request will tell
FSUIPC to execute the given lua program. The lua program name can be set via constructor or via the
setValue(java.lang.String)
method. The command - what to do, is being set by constructor or by setCommand(com.mouseviator.fsuipc.helpers.LVarHelper.LuaControlRequestCommand)
method.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mouseviator.fsuipc.datarequest.IDataRequest
IDataRequest.RequestType
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COMMAND_SEPARATOR
This character si used to separate command and arguments when working with lua programs via FSUIPCFields inherited from class com.mouseviator.fsuipc.datarequest.DataRequest
BUFFER_LENGTH_BYTE, BUFFER_LENGTH_DOUBLE, BUFFER_LENGTH_FLOAT, BUFFER_LENGTH_INT, BUFFER_LENGTH_LONG, BUFFER_LENGTH_SHORT, dataBuffer, MAX_OFFSET_VALUE, MIN_OFFSET_VALUE, offset, type
-
Constructor Summary
Constructors Constructor Description LuaControlRequest(LuaHelper.LuaControlRequestCommand command, java.lang.String luaProgram)
Constructs new lua control request to perform specified command with specified lua program.LuaControlRequest(LuaHelper.LuaControlRequestCommand command, java.lang.String luaProgram, java.nio.charset.Charset charset)
Constructs new lua control request to perform specified command with specified lua program.LuaControlRequest(java.lang.String luaProgram)
Constructs new lua control request to execute given lua program.LuaControlRequest(java.lang.String luaProgram, java.nio.charset.Charset charset)
Constructs new lua control request to execute given lua program. -
Method Summary
Modifier and Type Method Description java.nio.charset.Charset
getCharset()
Returns the charset that is used to convert string containing lua program name and command to the byte array for FSUIPC.LuaHelper.LuaControlRequestCommand
getCommand()
Returns the command this control request is set to perform.void
setCharset(java.nio.charset.Charset charset)
Sets the charset to use when converting string value that should contain lua program name and command to the byte array for FSUIPC.void
setCommand(LuaHelper.LuaControlRequestCommand command)
This method will set the command - what should FSUIPC do with the Lvar this control request is referencing.void
setValue(java.lang.String value)
Will set the value - the name of the lua program that should be controlled by this control request.Methods inherited from class com.mouseviator.fsuipc.datarequest.DataRequest
convertStringToByteArray, copyByteArray, getDataBuffer, getDouble, getFloat, getInt, getLong, getOffset, getShort, getSize, getType, getZeroTerminatedString, putDouble, putDouble, putFloat, putFloat, putInt, putInt, putLong, putLong, putShort, putShort, setOffset, setType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mouseviator.fsuipc.datarequest.IDataRequest
getDataBuffer, getOffset, getSize, getType, setOffset, setType
Methods inherited from interface com.mouseviator.fsuipc.datarequest.IWriteOnlyRequest
getValue
-
Field Details
-
COMMAND_SEPARATOR
public static final java.lang.String COMMAND_SEPARATORThis character si used to separate command and arguments when working with lua programs via FSUIPC- See Also:
- Constant Field Values
-
-
Constructor Details
-
LuaControlRequest
public LuaControlRequest(java.lang.String luaProgram) throws java.security.InvalidParameterExceptionConstructs new lua control request to execute given lua program.- Parameters:
luaProgram
- Lua program to execute.- Throws:
java.security.InvalidParameterException
-
LuaControlRequest
public LuaControlRequest(java.lang.String luaProgram, java.nio.charset.Charset charset) throws java.security.InvalidParameterExceptionConstructs new lua control request to execute given lua program.- Parameters:
luaProgram
- Lua program to execute.charset
- Charset to use when encoding lua program name and command to the byte array fro FSUIPC.- Throws:
java.security.InvalidParameterException
-
LuaControlRequest
public LuaControlRequest(LuaHelper.LuaControlRequestCommand command, java.lang.String luaProgram) throws java.security.InvalidParameterExceptionConstructs new lua control request to perform specified command with specified lua program.- Parameters:
command
- A command - what to do with the given lua program.luaProgram
- Lua program to perform command with.- Throws:
java.security.InvalidParameterException
-
LuaControlRequest
public LuaControlRequest(LuaHelper.LuaControlRequestCommand command, java.lang.String luaProgram, java.nio.charset.Charset charset) throws java.security.InvalidParameterExceptionConstructs new lua control request to perform specified command with specified lua program.- Parameters:
command
- A command - whether to read/write to or create given Lvar.luaProgram
- Lua program to perform command with.charset
- Charset to use when encoding lua program name and command to the byte array for FSUIPC.- Throws:
java.security.InvalidParameterException
-
-
Method Details
-
setValue
public void setValue(java.lang.String value)Will set the value - the name of the lua program that should be controlled by this control request.LuaHelper.LuaControlRequestCommand.LUA
by default, unless other command was set by theLuaHelper.LuaControlRequest
constructor orsetCommand(com.mouseviator.fsuipc.helpers.LVarHelper.LuaControlRequestCommand)
. You must call thesetCommand(com.mouseviator.fsuipc.helpers.LVarHelper.LuaControlRequestCommand)
before this function in order for the command to be updated.- Specified by:
setValue
in interfaceIDataRequest<java.lang.String>
- Parameters:
value
- An lua program name this control command is referencing.
-
getCommand
Returns the command this control request is set to perform. This is, what should FSUIPC do with the specified lua program this control request is referencing to.- Returns:
- The command.
-
setCommand
This method will set the command - what should FSUIPC do with the Lvar this control request is referencing.- Parameters:
command
- The command.
-
getCharset
public java.nio.charset.Charset getCharset()Returns the charset that is used to convert string containing lua program name and command to the byte array for FSUIPC.- Returns:
- The charset used.
-
setCharset
public void setCharset(java.nio.charset.Charset charset)Sets the charset to use when converting string value that should contain lua program name and command to the byte array for FSUIPC. Call this beforesetValue(java.lang.String)
, otherwise the change will have no effect.- Parameters:
charset
- The charset to use.
-