- All Implemented Interfaces:
Encodable,Serializable,Comparable<CardType>,Constable
The products these cards come as, which bytes 0 to 2 of block 1 tell apart.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA personal Avanza Tarjeta Bus, which travels on a subscription and never spends.A personal Avanza Tarjeta Bus printed "Abono de transporte".A balance top up Avanza Tarjeta Bus, which pays each journey out of its balance.A balance top up Lazo card. -
Method Summary
Modifier and TypeMethodDescriptionchip()The chip this product comes on.static CardTypedecode(byte[] block) Decodes block 1, which says which product a card is.byte[]encode()Encodes this product into block 1, with its checksum.booleanWhether cards of this product travel on a subscription rather than a balance.keys(int sector) The keys of one sector of a card of this product, read from the table it carries.static CardTypeofValue(int value) The product with those three bytes.The sectors holding a subscription product on cards of this product, one product per sector.booleanWhether cards of this product rewrite block 10 on every journey.intvalue()Bytes 0 to 2 of block 1.static CardTypeReturns the enum constant of this class with the specified name.static CardType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
AVANZA_TOP_UP
A balance top up Avanza Tarjeta Bus, which pays each journey out of its balance. -
AVANZA_PERSONAL
A personal Avanza Tarjeta Bus, which travels on a subscription and never spends. -
AVANZA_PERSONAL_ABONO
A personal Avanza Tarjeta Bus printed "Abono de transporte". What separates it fromAVANZA_PERSONALis unknown; both behave the same here. -
LAZO_TOP_UP
A balance top up Lazo card.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
value
public int value()Bytes 0 to 2 of block 1.- Returns:
- the three bytes as one integer
-
chip
The chip this product comes on.- Returns:
- the chip
-
productSectors
The sectors holding a subscription product on cards of this product, one product per sector.- Returns:
- the sectors, empty on a product that pays each journey out of its balance
-
recordsJourneySummary
public boolean recordsJourneySummary()Whether cards of this product rewrite block 10 on every journey. A product that travels on a subscription does not maintain it, seeJourneySummary.personalBlock().- Returns:
- true when block 10 holds a journey summary
-
isPersonal
public boolean isPersonal()Whether cards of this product travel on a subscription rather than a balance.- Returns:
- true on a personal product
-
ofValue
The product with those three bytes.- Parameters:
value- bytes 0 to 2 of block 1 as one integer- Returns:
- the product
- Throws:
CardFormatException- if no known product has those bytes
-
decode
Decodes block 1, which says which product a card is.- Parameters:
block- the sixteen bytes- Returns:
- the product
- Throws:
CardFormatException- if the block is not sixteen bytes, its checksum does not match, bytes 3 to 14 are not zero, or no known product has those first three bytes
-
encode
public byte[] encode()Encodes this product into block 1, with its checksum. -
keys
The keys of one sector of a card of this product, read from the table it carries.Sectors 0 to 8 hold the same keys on every Avanza product, so any of them opens an Avanza card before block 1 has been read.
- Parameters:
sector- the sector, counting from zero- Returns:
- the keys, or empty for a sector the table does not cover, which is
every sector past the last one
Chip.sectors()counts - Throws:
IllegalArgumentException- if the sector is negative
-