summaryrefslogtreecommitdiff
path: root/easytool/easycard.h
diff options
context:
space:
mode:
Diffstat (limited to 'easytool/easycard.h')
-rw-r--r--easytool/easycard.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/easytool/easycard.h b/easytool/easycard.h
index 9d547f8..7da1015 100644
--- a/easytool/easycard.h
+++ b/easytool/easycard.h
@@ -11,4 +11,37 @@
extern const struct value_string easy_tt_names[];
extern const struct value_string taipei_mrt_stn_id[];
+/* Sector 0 of Block 2 seems to contain manufacturing timestamp */
+struct easy_block2sec0 {
+ uint8_t unknown[6];
+ uint8_t timestamp[3];
+ uint8_t unknown2[7];
+} __attribute__ ((packed));
+
+/* Sector 2 of Block 15 */
+struct easy_block15sec2 {
+ uint8_t unknown[11];
+ uint8_t day_of_month;
+ uint8_t unknown2; /* always 0x3d? */
+ uint16_t sum_of_day; /* sum of all shop purchases on a day */
+ uint8_t unknown3;
+} __attribute__ ((packed));
+
+
+/* storage of a transaction log record on the transponder itself */
+struct easy_log_rec {
+ uint8_t trans_id;
+ uint8_t unknown;
+ uint8_t timestamp[3]; /* seconds since January 1st 1970 / 256 */
+ uint8_t trans_type;
+ uint16_t amount; /* transaction amount / value */
+ uint16_t remaining; /* remaining value on card _after_ trans */
+ uint8_t unknown2;
+ uint8_t station_code; /* MRT station code */
+ uint16_t reader_code; /* unique code of RFID reader */
+ uint8_t unknown3[2];
+} __attribute__ ((packed));
+
+time_t easy_timestamp2time(const uint8_t *easy_ts);
+
#endif /* EASYCARD_H */
personal git repositories of Harald Welte. Your mileage may vary