-
- 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceMachineButtonsManager.OnEventListenerMachineButtons event listener.
-
Constructor Summary
Constructors Constructor Description MachineButtonsManager(Context appC)
-
Method Summary
Modifier and Type Method Description voidconnect()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. voiddisconnect()Disconnect from the machine button service. voidsetConfig(Array<int> config)Set configuration of the machine buttons. voidsetOnEventListener(MachineButtonsManager.OnEventListener listener)Register a listener for button events. -
-
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
-
-
-
-