Skip to content

Commit

Permalink
fix parsing code for Itron ACE300 Typ 260. Added dump_file option to …
Browse files Browse the repository at this point in the history
…write communication to D0 device into a file
  • Loading branch information
mbehr1 committed Jan 11, 2015
1 parent 1d27228 commit 1fa7980
Show file tree
Hide file tree
Showing 4 changed files with 387 additions and 122 deletions.
1 change: 1 addition & 0 deletions etc/vzlogger.conf
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
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_ */

0 comments on commit 1fa7980

Please sign in to comment.