libepc is an EPC Tag Data encoding library for C++.
- Supporting encoding/decoding for EPC URI, EPC Tag URI and EPC Binary.
- Accordance with EPC Tag Data Standard 1.13.
- No external dependency except standard libary.
- GIAI(Global Indivisual Asset Identifier)
- GRAI(Global Returnable Asset Identifier)
- SGLN(GLobal Location Number)
- SGTIN(Serialised GLobal Trade Item Number)
- SSCC(Serial Shipping Container Code)
The code below creating a SGTIN object and printing EPC URI, EPC Tag URI and EPC binary of it.
#include "sgtin.h"
#include "status.h"
#include <iostream>
using namespace epc;
int main() {
SGTIN sgtin;
Status status;
std::tie(status, sgtin) = SGTIN::create("0614141", "812345", "6789");
if (status != Status::kOk) {
return 1;
}
std::cout << "EPC URI: " << sgtin.getURI() << std::endl;
std::cout << "EPC Tag URI: " << sgtin.getTagURI() << std::endl;
std::string bin;
std::tie(status, bin) = sgtin.getBinary();
if (status != Status::kOk) {
return 1;
}
std::cout << "EPC Binary: " << bin << std::endl;
return 0;
}
Output
EPC URI: urn:epc:id:sgtin:0614141.812345.6789
EPC Tag URI: urn:epc:tag:sgtin-96:0.0614141.812345.6789
EPC Binary: 3014257BF7194E4000001A85
For more information, See header files under the include/ directory.
This project supports CMake out of the box.
mkdir -p build && cd build
cmake .. && cmake --build .
mkdir -p build && cd build
cmake -DLIBEPC_BUILD_TESTS=ON .. && cmake --build . && ctest --verbose