Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Printer.h@1:f257e2e4e026, 2020-02-07 (annotated)
- Committer:
- mauuuuul
- Date:
- Fri Feb 07 08:22:28 2020 +0000
- Revision:
- 1:f257e2e4e026
- Parent:
- 0:7f3d28e53383
Penyesuaian printer trawas
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
irsanjul | 0:7f3d28e53383 | 1 | #ifndef _PRINTER_H_ |
irsanjul | 0:7f3d28e53383 | 2 | #define _PRINTER_H_ |
irsanjul | 0:7f3d28e53383 | 3 | |
irsanjul | 0:7f3d28e53383 | 4 | #include "TMU220.h" |
irsanjul | 0:7f3d28e53383 | 5 | #include <string> |
irsanjul | 0:7f3d28e53383 | 6 | #include <vector> |
irsanjul | 0:7f3d28e53383 | 7 | |
irsanjul | 0:7f3d28e53383 | 8 | // ============================================================================= |
irsanjul | 0:7f3d28e53383 | 9 | class PrinterFormat |
irsanjul | 0:7f3d28e53383 | 10 | { |
irsanjul | 0:7f3d28e53383 | 11 | public: |
irsanjul | 0:7f3d28e53383 | 12 | int id; |
irsanjul | 0:7f3d28e53383 | 13 | string spbu; |
irsanjul | 0:7f3d28e53383 | 14 | string telp; |
irsanjul | 0:7f3d28e53383 | 15 | uint8_t first_nozle; |
irsanjul | 0:7f3d28e53383 | 16 | int JumlahFillingPoint; |
irsanjul | 0:7f3d28e53383 | 17 | vector<string> prodak; |
irsanjul | 0:7f3d28e53383 | 18 | vector<string> alamat; |
irsanjul | 0:7f3d28e53383 | 19 | vector<string> footer; |
irsanjul | 0:7f3d28e53383 | 20 | }; |
irsanjul | 0:7f3d28e53383 | 21 | |
irsanjul | 0:7f3d28e53383 | 22 | // ============================================================================= |
irsanjul | 0:7f3d28e53383 | 23 | class ResultParsing |
irsanjul | 0:7f3d28e53383 | 24 | { |
irsanjul | 0:7f3d28e53383 | 25 | public: |
mauuuuul | 1:f257e2e4e026 | 26 | bool valid; |
mauuuuul | 1:f257e2e4e026 | 27 | uint8_t id; |
mauuuuul | 1:f257e2e4e026 | 28 | float volume; |
mauuuuul | 1:f257e2e4e026 | 29 | int money; |
mauuuuul | 1:f257e2e4e026 | 30 | int ppu; |
mauuuuul | 1:f257e2e4e026 | 31 | string product; |
mauuuuul | 1:f257e2e4e026 | 32 | uint8_t type; |
irsanjul | 0:7f3d28e53383 | 33 | }; |
irsanjul | 0:7f3d28e53383 | 34 | |
irsanjul | 0:7f3d28e53383 | 35 | // ============================================================================= |
irsanjul | 0:7f3d28e53383 | 36 | class Printer |
irsanjul | 0:7f3d28e53383 | 37 | { |
irsanjul | 0:7f3d28e53383 | 38 | public: |
irsanjul | 0:7f3d28e53383 | 39 | Printer(PinName tx_, PinName rx_, int baud_=9600); |
irsanjul | 0:7f3d28e53383 | 40 | ~Printer(); |
mauuuuul | 1:f257e2e4e026 | 41 | |
irsanjul | 0:7f3d28e53383 | 42 | void init(const PrinterFormat &pf); |
mauuuuul | 1:f257e2e4e026 | 43 | |
irsanjul | 0:7f3d28e53383 | 44 | void create_header(); |
mauuuuul | 1:f257e2e4e026 | 45 | void TestPrint(const std::time_t &now); |
mauuuuul | 1:f257e2e4e026 | 46 | void PrintStruk(const std::time_t &now, const char *datain, const unsigned int &no_nota, const uint8_t &nozz, |
mauuuuul | 1:f257e2e4e026 | 47 | const uint8_t pipa, const string &Nopol, const string &Odo); |
mauuuuul | 1:f257e2e4e026 | 48 | void PrintStruk(const std::time_t &now, const ResultParsing &res, const unsigned int &no_nota, |
mauuuuul | 1:f257e2e4e026 | 49 | const string &Nopol, const string &Odo); |
mauuuuul | 1:f257e2e4e026 | 50 | void PrintStrukManual(const std::time_t &now, const ResultParsing &res, const unsigned int &no_nota); |
mauuuuul | 1:f257e2e4e026 | 51 | void DebugStruk(const std::time_t &now, const ResultParsing &res, const unsigned int &no_nota, |
mauuuuul | 1:f257e2e4e026 | 52 | const string &Nopol, const string &Odo); |
mauuuuul | 1:f257e2e4e026 | 53 | void TestPrint2(); |
mauuuuul | 1:f257e2e4e026 | 54 | |
irsanjul | 0:7f3d28e53383 | 55 | private: |
irsanjul | 0:7f3d28e53383 | 56 | TMU220 Tm; |
irsanjul | 0:7f3d28e53383 | 57 | PrinterFormat Pf; |
irsanjul | 0:7f3d28e53383 | 58 | string get_product(const uint8_t code); |
irsanjul | 0:7f3d28e53383 | 59 | static const char * const days[]; |
irsanjul | 0:7f3d28e53383 | 60 | static const char * const mons[]; |
irsanjul | 0:7f3d28e53383 | 61 | }; |
irsanjul | 0:7f3d28e53383 | 62 | |
irsanjul | 0:7f3d28e53383 | 63 | #endif // _PRINTER_H_ |
irsanjul | 0:7f3d28e53383 | 64 |