Package io.helins.linux.i2c
Class I2CTransaction
- java.lang.Object
-
- io.helins.linux.i2c.I2CTransaction
-
public class I2CTransaction extends Object
Class representing an I2C transaction for carrying out several uninterrupted IO operations.Sometimes, only one message per transaction is supported, which defeat the purpose of having transactions.
-
-
Field Summary
Fields Modifier and Type Field Description intlengthHow many messages this transaction holds.static intMAX_LENGTHThe maximum number of messages a single transaction can carry out in theory.
-
Constructor Summary
Constructors Constructor Description I2CTransaction(int length)Creates a new transaction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description I2CMessagegetMessage(int index)Retrieves a message from this transaction for inspection of modification.
-
-
-
Field Detail
-
MAX_LENGTH
public static final int MAX_LENGTH
The maximum number of messages a single transaction can carry out in theory.- See Also:
- Constant Field Values
-
length
public final int length
How many messages this transaction holds.
-
-
Constructor Detail
-
I2CTransaction
public I2CTransaction(int length)
Creates a new transaction.- Parameters:
length- Number of messages.- Throws:
IllegalArgumentException- When the request number of messages is higher than what is supported.- See Also:
MAX_LENGTH
-
-
Method Detail
-
getMessage
public I2CMessage getMessage(int index)
Retrieves a message from this transaction for inspection of modification.- Parameters:
index- Which one.- Returns:
- The relevant message.
-
-