Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix parsing code for Itron ACE3000 Typ 260, MT173 and added dump_file option #108

Merged
merged 2 commits into from
Jan 11, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions etc/vzlogger.conf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"skip": false, // if enabled, errors when opening meter will lead to meter being ignored
"protocol": "d0", // see 'vzlogger -h' for list of available protocols
"device": "/dev/ttyUSB0",
"dump_file": "/var/log/dumpD0.txt", // optional, if set logs all received/transmitted data to this file
"parity": "7E1", // oder 8N1
"baudrate": 9600, // oder 300
// "pullseq": "2F3F210D0A", // Pullsequenz in 'hex'
Expand Down
9 changes: 9 additions & 0 deletions include/protocols/MeterD0.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class MeterD0 : public vz::protocol::Protocol {
private:
std::string _host;
std::string _device;
std::string _dump_file;
int _baudrate;
int _baudrate_read;

Expand All @@ -60,6 +61,7 @@ class MeterD0 : public vz::protocol::Protocol {


int _fd; /* file descriptor of port */
FILE *_dump_fd;
struct termios _oldtio; /* required to reset port */

/**
Expand All @@ -71,6 +73,13 @@ class MeterD0 : public vz::protocol::Protocol {
*/
int _openSocket(const char *node, const char *service);
int _openDevice(struct termios *old_tio, speed_t baudrate);

enum DUMP_MODE {NONE, CTRL, DUMP_IN, DUMP_OUT};
DUMP_MODE _old_mode;
int _dump_pos;
void dump_file(DUMP_MODE mode, const char* str);
void dump_file(DUMP_MODE mode, const char* buf, size_t len);
void dump_file(const char &c){ dump_file(DUMP_IN, &c, 1);};
};

#endif /* _D0_H_ */