2011-05-18 19:42:13 +02:00
|
|
|
/**
|
2011-09-10 00:00:26 +02:00
|
|
|
* Plaintext protocol according to DIN EN 62056-21
|
2011-05-18 19:42:13 +02:00
|
|
|
*
|
2011-09-10 00:00:26 +02:00
|
|
|
* This protocol uses OBIS to identify the readout data
|
|
|
|
* And is also sometimes called "D0"
|
2011-05-18 19:42:13 +02:00
|
|
|
*
|
2011-05-25 00:40:20 +02:00
|
|
|
* @package vzlogger
|
2011-05-18 19:42:13 +02:00
|
|
|
* @copyright Copyright (c) 2011, The volkszaehler.org project
|
|
|
|
* @license http://www.gnu.org/licenses/gpl.txt GNU Public License
|
|
|
|
* @author Steffen Vogel <info@steffenvogel.de>
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* This file is part of volkzaehler.org
|
|
|
|
*
|
|
|
|
* volkzaehler.org 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
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* volkzaehler.org 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 volkszaehler.org. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2011-09-10 00:00:26 +02:00
|
|
|
#ifndef _D0_H_
|
|
|
|
#define _D0_H_
|
2011-05-18 19:42:13 +02:00
|
|
|
|
2011-10-15 23:58:50 +02:00
|
|
|
#define D0_BUFFER_LENGTH 1024
|
|
|
|
|
2011-06-11 23:42:58 +02:00
|
|
|
#include <termios.h>
|
|
|
|
|
|
|
|
typedef struct {
|
2011-11-21 00:38:05 +01:00
|
|
|
char *host;
|
|
|
|
char *device;
|
|
|
|
int baudrate;
|
|
|
|
|
2011-06-11 23:42:58 +02:00
|
|
|
int fd; /* file descriptor of port */
|
|
|
|
struct termios oldtio; /* required to reset port */
|
2011-09-10 00:00:26 +02:00
|
|
|
} meter_handle_d0_t;
|
2011-06-11 23:42:58 +02:00
|
|
|
|
2011-11-21 00:38:05 +01:00
|
|
|
/* forward declarations */
|
|
|
|
struct meter;
|
|
|
|
struct reading;
|
2011-10-07 22:26:03 +02:00
|
|
|
|
2011-11-21 00:38:05 +01:00
|
|
|
int meter_init_d0(struct meter *mtr, list_t options);
|
2012-02-03 15:24:16 +01:00
|
|
|
void meter_free_d0(struct meter *mtr);
|
2011-10-07 22:26:03 +02:00
|
|
|
int meter_open_d0(struct meter *mtr);
|
2011-11-21 00:38:05 +01:00
|
|
|
int meter_close_d0(struct meter *mtr);
|
2011-10-07 22:26:03 +02:00
|
|
|
size_t meter_read_d0(struct meter *mtr, struct reading *rds, size_t n);
|
2011-05-18 19:42:13 +02:00
|
|
|
|
2011-12-06 02:35:14 +01:00
|
|
|
/**
|
|
|
|
* Open socket
|
|
|
|
*
|
|
|
|
* @param node the hostname or ASCII encoded IP address
|
|
|
|
* @param the ASCII encoded portnum or service as in /etc/services
|
|
|
|
* @return file descriptor, <0 on error
|
|
|
|
*/
|
|
|
|
int meter_d0_open_socket(const char *node, const char *service);
|
2011-10-16 00:12:53 +02:00
|
|
|
|
2012-02-10 10:10:00 +01:00
|
|
|
int meter_d0_open_device(const char *device, struct termios *old_tio, speed_t baudrate);
|
|
|
|
|
2011-09-10 00:00:26 +02:00
|
|
|
#endif /* _D0_H_ */
|