-
public class CanManager
-
-
Field Summary
Fields Modifier and Type Field Description public final static MachineSignalEMPTY_SIGNALpublic final static MachineSignalDefinitionEMPTY_DEFINITIONpublic final static GflMsgEMPTY_FRAME
-
Constructor Summary
Constructors Constructor Description CanManager(Context context)
-
Method Summary
Modifier and Type Method Description MachineSignalreadSignal(int signalId)Read a machine signal with the provided signalId.Throws SecurityException if caller don't holdsse.cpacsystems.permission. booleanwriteSignal(int signalId, double value)Write a machine signal with the provided id to the provided value.Throws SecurityException if caller don't holdsse.cpacsystems.permission. intsetupRxSignal(MachineSignalDefinition rxSignal)Setup a machine signal to receive.Throws SecurityException if caller don't holdsse.cpacsystems.permission. intsetupTxSignal(MachineSignalDefinition txSignal)Setup a machine signal to transmit.Throws SecurityException if caller don't holdsse.cpacsystems.permission. GflHandlerregisterFrame(CanBus canBus, int frameId, boolean extended, byte maxQueueSize)Register the intent to receive can messages with the specified address.Throws SecurityException if caller don't holdsse.cpacsystems.permission. GflMsgreadGflMsg(GflHandler handler)Read frame from a registered GflHandler. booleanwriteFrame(CanBus canBus, int frameId, boolean extended, Array<byte> data)Write a can messages on the specified can-bus with the specified address.Throws SecurityException if caller don't holdsse.cpacsystems.permission. booleanunregisterFrame(GflHandler handler)Unregister a previously registered frame.Throws SecurityException if caller don't holdsse.cpacsystems.permission. MachineSignalDefinitiongetRxSignalDefinition(int signalId)Retrieve the definition of the rx machine signal identified by the provided gsl id. MachineSignalDefinitiongetTxSignalDefinition(int signalId)Retrieve the definition of the tx machine signal identified by the provided gsl id. longgetBusFrameCount(CanBus canBus)Retrieve the number of frames received for the given can bus since start of serviceor the last call to resetBusFrameCount() longgetRxSignalFrameCount(int signalId)Retrieve the number of frames received for the given gsl signal since start of serviceor the last call to resetRxSignalFrameCount() booleanresetBusFrameCount(CanBus canBus)Reset the number of frames received for the given can bus. booleanresetRxSignalFrameCount(int signalId)Reset the number of frames received for the given gsl signal.This call affects all signals defined on the same frame id. booleanisConnected()-
-
Constructor Detail
-
CanManager
CanManager(Context context)
-
-
Method Detail
-
readSignal
MachineSignal readSignal(int signalId)
Read a machine signal with the provided signalId.Throws SecurityException if caller don't holdsse.cpacsystems.permission.READ_MACHINE_SIGNAL
- Parameters:
signalId- Id of the desired signal
-
writeSignal
boolean writeSignal(int signalId, double value)
Write a machine signal with the provided id to the provided value.Throws SecurityException if caller don't holdsse.cpacsystems.permission.WRITE_MACHINE_SIGNAL
- Parameters:
signalId- The id of the signal to writevalue- The value to write
-
setupRxSignal
int setupRxSignal(MachineSignalDefinition rxSignal)
Setup a machine signal to receive.Throws SecurityException if caller don't holdsse.cpacsystems.permission.READ_MACHINE_SIGNAL
- Parameters:
rxSignal- Definition of the signal to transmit
-
setupTxSignal
int setupTxSignal(MachineSignalDefinition txSignal)
Setup a machine signal to transmit.Throws SecurityException if caller don't holdsse.cpacsystems.permission.WRITE_MACHINE_SIGNAL
- Parameters:
txSignal- Definition of the desired signal
-
registerFrame
GflHandler registerFrame(CanBus canBus, int frameId, boolean extended, byte maxQueueSize)
Register the intent to receive can messages with the specified address.Throws SecurityException if caller don't holdsse.cpacsystems.permission.READ_MACHINE_SIGNAL
- Parameters:
canBus- The bus (CAN1-CAN6) to receive messages onframeId- The address of messages to receiveextended- True for extended addressing and false for standardmaxQueueSize- The maximum number of messages to save
-
readGflMsg
GflMsg readGflMsg(GflHandler handler)
Read frame from a registered GflHandler.
- Parameters:
handler- a GflHandler returned from registerFrame()
-
writeFrame
boolean writeFrame(CanBus canBus, int frameId, boolean extended, Array<byte> data)
Write a can messages on the specified can-bus with the specified address.Throws SecurityException if caller don't holdsse.cpacsystems.permission.WRITE_MACHINE_SIGNAL
- Parameters:
canBus- The bus (CAN4,CAN5,CAN6) to receive messages onframeId- The address of messages to receiveextended- True for extended addressing and false for standarddata- Data to transmit
-
unregisterFrame
boolean unregisterFrame(GflHandler handler)
Unregister a previously registered frame.Throws SecurityException if caller don't holdsse.cpacsystems.permission.READ_MACHINE_SIGNAL
- Parameters:
handler- a GflHandler returned from registerFrame()
-
getRxSignalDefinition
MachineSignalDefinition getRxSignalDefinition(int signalId)
Retrieve the definition of the rx machine signal identified by the provided gsl id.
- Parameters:
signalId- the Id of the requested signal.
-
getTxSignalDefinition
MachineSignalDefinition getTxSignalDefinition(int signalId)
Retrieve the definition of the tx machine signal identified by the provided gsl id.
- Parameters:
signalId- the Id of the requested signal.
-
getBusFrameCount
long getBusFrameCount(CanBus canBus)
Retrieve the number of frames received for the given can bus since start of serviceor the last call to resetBusFrameCount()
- Parameters:
canBus- the can bus to retrieve statistics for.
-
getRxSignalFrameCount
long getRxSignalFrameCount(int signalId)
Retrieve the number of frames received for the given gsl signal since start of serviceor the last call to resetRxSignalFrameCount()
- Parameters:
signalId- the Id of the requested signal.
-
resetBusFrameCount
boolean resetBusFrameCount(CanBus canBus)
Reset the number of frames received for the given can bus.
- Parameters:
canBus- the Id of the bus to reset.
-
resetRxSignalFrameCount
boolean resetRxSignalFrameCount(int signalId)
Reset the number of frames received for the given gsl signal.This call affects all signals defined on the same frame id.
- Parameters:
signalId- the Id of the signal to reset the counter for.
-
isConnected
boolean isConnected()
-
-
-
-