Package 

Class MachineButtonsManager

  • All Implemented Interfaces:
    se.cpacsystems.externalinput.MachineButtonsContract

    
    public class MachineButtonsManager
     implements MachineButtonsContract
                        

    Class used for connecting towards MachineButton service.

    The machine buttons are external to the unit where the input is coming from CAN.

    The manager can be used for setting button config and registering listener for button events.

    • Method Summary

      Modifier and Type Method Description
      void connect() Connect to the machine button service in the platform.se.cpacsystems.machinebuttons system application is available for both SID and CoPilot2The intent package name is used in order to distinguish which platform component to start.
      void disconnect() Disconnect from the machine button service.
      void setConfig(Array<int> config) Set configuration of the machine buttons.
      void setOnEventListener(MachineButtonsManager.OnEventListener listener) Register a listener for button events.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MachineButtonsManager

        MachineButtonsManager(Context appC)
    • Method Detail

      • connect

         void connect()

        Connect to the machine button service in the platform.se.cpacsystems.machinebuttons system application is available for both SID and CoPilot2The intent package name is used in order to distinguish which platform component to start.

        Permission needed: "se.cpacsystems.permission.MACHINE_BUTTONS"

      • disconnect

         void disconnect()

        Disconnect from the machine button service.

      • setConfig

         void setConfig(Array<int> config)

        Set configuration of the machine buttons.

        Permission needed: se.cpacsystems.permission.MACHINE_BUTTONS_CONFIG

        Parameters:
        config - Config as an int array.
      • setOnEventListener

         void setOnEventListener(MachineButtonsManager.OnEventListener listener)

        Register a listener for button events.

        Listener events are run on the thread where the listener were registered. This assumesthere is a looper associated with the thread. If not, it defaults to the main thread.

        Parameters:
        listener - the listener