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.
  • Field Details

    • COMMAND_SEPARATOR

      public static final java.lang.String COMMAND_SEPARATOR
      This 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.InvalidParameterException
      Constructs 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.InvalidParameterException
      Constructs 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.InvalidParameterException
      Constructs 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.InvalidParameterException
      Constructs 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 the LuaHelper.LuaControlRequest constructor or setCommand(com.mouseviator.fsuipc.helpers.LVarHelper.LuaControlRequestCommand). You must call the setCommand(com.mouseviator.fsuipc.helpers.LVarHelper.LuaControlRequestCommand) before this function in order for the command to be updated.
      Specified by:
      setValue in interface IDataRequest<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

      public void setCommand​(LuaHelper.LuaControlRequestCommand command)
      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 before setValue(java.lang.String), otherwise the change will have no effect.
      Parameters:
      charset - The charset to use.