-
Notifications
You must be signed in to change notification settings - Fork 271
Suica
This page was translated from Japanese. The original version is at http://sourceforge.jp/projects/felicalib/wiki/suica
The following information is based on information from Dennosuke, and guisa's package (page3.nifty.com/slokar/pasori/gsuica).
In general, Suica/ICOCA/PiTaPa/PASMO/TOICA are the same format. Suica contains two service codes: entrance/exit records and history. The following explanation refers only to the history. The service code is 0x090f (In IruCa the system code changes to 0xde80, but the format is basically the same as those of Suica.)
Each entry is 16 bytes. The format is as follows.
- 0: Terminal Type
- 1: Processing
- 2-3: ??
- 4-5: Date (first 7 bits are year, next 4 are month, remaining 5 are day)
- 6 : Entered LineCode
- 7 : Entered Station Order
- 8 : Exited LineCode
- 9 : Exited Station Order
- 10-11: Balance (little endian)
- 12-14: Serial Number
- 15: Region
Only the balance is little endian, so please be cautious.
In the case of sales of goods or buses, the format changes in the following ways.
- Sale of Goods: The 6th to 7th bytes are the time. The first 5 bits are the hour the next 6 are the minute, the last 5 are unclear (there are not enough bits for it to be the seconds?)
- When the processing values are 70, 73, 74, 75, 198, 203, it represents a sale of goods.
- Bus: The Entered LineCode and Entered Station Order are removed, and the Exited LineCode and Exited Station Orer become 16 bits (the 6th-7th and 8th-9th bytes, respectively)
- When the processing values are 13, 15, 31, 35, it represents a bus.
The terminal type values are as follows:
- 3: Fare Adjustment Machine
- 4: Portable Terminal
- 5: vehicle terminal
- 7: Ticket Machine
- 8: Ticket Machine
- 9: Deposit Machine
- 18: Ticket Machine
- 20: Ticket Machine, etc.
- 21: Ticket Machine, etc.
- 22: Ticket Gate
- 23: Simple Ticket Gate
- 24,25: Booth Terminal
- 26: Ticket Gate Terminal
- 27: Cellular Phone
- 28: Connection Adjustment Machine
- 29: Transfer Adjustment Machine
- 31: Simple Deposit Machine
- 70: VIEW ALTTE
- 72: VIEW ALTTE
- 199: Sale of Goods Terminal
- 200: Vending Machine
Processing values are as follows
- 1: Fare Payment (Exit from Ticket Gate)
- 2: Charge
- 3: Purchase Ticket (Purchase magnetic ticket)
- 4: Payment
- 5: Payment (Admission Payment)
- 6: Booth Exit (Process at stationmaster booth)
- 7: New (Issue New)
- 8: Deduction (Booth deduction)
- 13: Bus (PiTaPa type)
- 15: Bus (IruCa type)
- 17: Re-issue (Re-issue process)
- 19: Payment (Shinkansen Use)
- 20: Entry A (Autocharge upon entrance)
- 21: Exit A (Autocharge upon exit)
- 31: Deposit (Bus Charge)
- 35: Purchase Ticket (Purchase special bus/streetcar ticket)
- 70: Sale of Goods
- 72: Bonus (Bonus Charge)
- 73: Deposit (Register Deposit)
- 74: Cancel Sale of Goods
- 75: Admission and Goods (Sale of admission and goods)
- 198: Goods and Cash (Purchase goods with part cash)
- 203: Admission Goods and Cash (Purchase admission and goods with part cash)
- 132: Payment (Third party payment)
- 133: Payment (Third party admission payment)
Can be looked up through cybernation station code database at: http://www.denno.net/SFCardFan/
When terminal type is other than 0xc7, 0xc8, 0x05. Station name can be looked up via AreaCode, LineCode and StationCode. In this case, the folowing AreaCode is needed for the following LineCodes:
- over 0x7f : 0 (JR Line)
- over 0x80 and region is 0: 1 (Kanto (East Japan) public/private railway)
- over 0x80 and region is 1: 2 (Kansai (West Japan) public/private railway)
When terminal type is 0xc7, 0xc8.
Stores can be searched via the 4 bytes of AreaCode, TerminalCode, LineCode, StationCode. The AreaCodes are: 1: Suica/PASMO, 2: ICOCA, 4:IruCa. However, because the AreaCode is not recorded in the history, and a code is shared between Suica/PASMO, it is impossible to determine the store name with 100% accuracy.
When terminal type is 0x05.
Here, the IruCa bus stop code table should be looked at, using LineCodes and station order as a key.