Depot Pertamina / Printer
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Printer.h Source File

Printer.h

00001 #ifndef _PRINTER_H_
00002 #define _PRINTER_H_
00003 
00004 #include "TMU220.h"
00005 #include <string>
00006 #include <vector>
00007 
00008 // =============================================================================
00009 class PrinterFormat
00010 {
00011 public:
00012     int id;
00013     string spbu;
00014     string telp;
00015     uint8_t first_nozle;
00016     int JumlahFillingPoint;
00017     vector<string> prodak;
00018     vector<string> alamat;
00019     vector<string> footer;
00020 };
00021 
00022 // =============================================================================
00023 class ResultParsing
00024 {
00025 public:
00026     bool valid;
00027     uint8_t id;
00028     float volume;
00029     int money;
00030     int ppu;
00031     string product;
00032     uint8_t type;
00033 };
00034 
00035 // =============================================================================
00036 class Printer
00037 {
00038 public:
00039     Printer(PinName tx_, PinName rx_, int baud_=9600);
00040     ~Printer();
00041 
00042     void init(const PrinterFormat &pf);
00043 
00044     void create_header();
00045     void TestPrint(const std::time_t &now);
00046     void PrintStruk(const std::time_t &now, const char *datain, const unsigned int &no_nota, const uint8_t &nozz,
00047                     const uint8_t pipa, const string &Nopol, const string &Odo);
00048     void PrintStruk(const std::time_t &now, const ResultParsing &res, const unsigned int &no_nota,
00049                     const string &Nopol, const string &Odo);
00050     void PrintStrukManual(const std::time_t &now, const ResultParsing &res, const unsigned int &no_nota);
00051     void DebugStruk(const std::time_t &now, const ResultParsing &res, const unsigned int &no_nota,
00052                     const string &Nopol, const string &Odo);
00053     void TestPrint2();
00054 
00055 private:
00056     TMU220 Tm;
00057     PrinterFormat Pf;
00058     string get_product(const uint8_t code);
00059     static const char * const days[];
00060     static const char * const mons[];
00061 };
00062 
00063 #endif // _PRINTER_H_
00064