Crates.io | aei_tag_parser |
lib.rs | aei_tag_parser |
version | 1.2.2 |
source | src |
created_at | 2022-10-28 15:52:44.872701 |
updated_at | 2023-11-04 07:06:40.987998 |
description | A simple tool and library to parse AEI RFID tags |
homepage | https://github.com/tbornon/aei-tag-parser |
repository | https://github.com/tbornon/aei-tag-parser |
max_upload_size | |
id | 700505 |
size | 38,139 |
This library provides a way to deserialize RFID AEI tags used in railway industry to identify wagons. It can be used both a CLI util or a library
Deserialize one or multiple tags passed as parameters :
# One tag :
$ aei-tag-parser 9EA488C030426A179000000000000331
# Output :
# 9EA488C030426A179000000000000331 : Initials : IOCC Car number : 3088
# Multiple tags :
$ aei-tag-parser 2F3E06C007DB1E139000000000000331 9EA488C030426A179000000000000331 9EA488C5320CC01B9000000000000331
# Output :
# 2F3E06C007DB1E139000000000000331 : Initials : QNSL Car number : 502
# 9EA488C030426A179000000000000331 : Initials : IOCC Car number : 3088
# 9EA488C5320CC01B9000000000000331 : Initials : IOCC Car number : 85123
Tag deserialization from a file :
# tags.txt content :
$ cat tags.txt
# Output :
# 2F3E06C007DB1E139000000000000331
# 9EA488C030426A179000000000000331
# 9EA488C5320CC01B9000000000000331
$ aei-tag-parser -f test.txt
# Output :
# 2F3E06C007DB1E139000000000000331 : Initials : QNSL Car number : 502
# 9EA488C030426A179000000000000331 : Initials : IOCC Car number : 3088
# 9EA488C5320CC01B9000000000000331 : Initials : IOCC Car number : 85123
Tag deserialization from a UNIX pipe :
# tags.txt content :
$ cat tags.txt
# Output :
# 2F3E06C007DB1E139000000000000331
# 9EA488C030426A179000000000000331
# 9EA488C5320CC01B9000000000000331
$ cat tags.txt | aei-tag-parser
# Output :
# 2F3E06C007DB1E139000000000000331 : Initials : QNSL Car number : 502
# 9EA488C030426A179000000000000331 : Initials : IOCC Car number : 3088
# 9EA488C5320CC01B9000000000000331 : Initials : IOCC Car number : 85123
This project can also be used as an external library. Documentation is available here : https://docs.rs/aei_tag_parser/latest/aei_tag_parser/
let tag_str : String = String::from("9EA488C030426A179000000000000331");
let tag : AEITagData = AEITagData::new(&tag_str);
println!("Tag {} content is : \r\n\tInitials: {}\r\n\tCar number: {}", &tag_str, tag.equipment_initial(), tag.car_number());
To install the CLI util, you must have Rust installed (cf RustUp).
Then you can simply do :
$ cargo install aei_tag_parser