2018-04-01 06:53:37 +00:00
|
|
|
/*
|
2019-02-24 13:08:51 +00:00
|
|
|
Copyright (C) 2017-2019 Fredrik Öhrström
|
2018-04-01 06:53:37 +00:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2017-09-02 21:26:57 +00:00
|
|
|
|
|
|
|
#include"cmdline.h"
|
|
|
|
#include"meters.h"
|
2019-06-20 12:28:52 +00:00
|
|
|
#include"wmbus.h"
|
2017-09-02 21:26:57 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
struct Printer {
|
2019-02-26 22:40:44 +00:00
|
|
|
Printer(bool json,
|
|
|
|
bool fields,
|
|
|
|
char separator,
|
|
|
|
bool meterfiles, string &meterfiles_dir,
|
|
|
|
bool use_logfile, string &logfile,
|
|
|
|
vector<string> shell_cmdlines,
|
2019-06-20 12:28:52 +00:00
|
|
|
bool overwrite,
|
|
|
|
MeterFileNaming naming);
|
2017-09-02 21:26:57 +00:00
|
|
|
|
2019-10-20 17:19:17 +00:00
|
|
|
void print(Telegram *t, Meter *meter, vector<string> *more_json);
|
2017-09-02 21:26:57 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2019-02-26 22:40:44 +00:00
|
|
|
bool json_, fields_;
|
|
|
|
bool use_meterfiles_;
|
2019-01-27 23:03:25 +00:00
|
|
|
string meterfiles_dir_;
|
2019-02-26 22:40:44 +00:00
|
|
|
bool use_logfile_;
|
|
|
|
string logfile_;
|
2018-03-05 10:29:25 +00:00
|
|
|
char separator_;
|
2018-11-02 12:50:12 +00:00
|
|
|
vector<string> shell_cmdlines_;
|
2019-02-24 16:31:32 +00:00
|
|
|
bool overwrite_;
|
2019-06-20 12:28:52 +00:00
|
|
|
MeterFileNaming naming_;
|
2018-11-02 12:50:12 +00:00
|
|
|
|
|
|
|
void printShells(Meter *meter, vector<string> &envs);
|
2019-06-20 12:28:52 +00:00
|
|
|
void printFiles(Meter *meter, Telegram *t, string &human_readable, string &fields, string &json);
|
2018-11-02 12:50:12 +00:00
|
|
|
|
2017-09-02 21:26:57 +00:00
|
|
|
};
|