vzlogger/include/protocols/d0.h

67 lines
1.9 KiB
C
Raw Permalink Normal View History

2011-05-18 19:42:13 +02:00
/**
* Plaintext protocol according to DIN EN 62056-21
2011-05-18 19:42:13 +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
*
* @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/>.
*/
#ifndef _D0_H_
#define _D0_H_
2011-05-18 19:42:13 +02:00
#define D0_BUFFER_LENGTH 1024
#include <termios.h>
typedef struct {
char *host;
char *device;
int baudrate;
int fd; /* file descriptor of port */
struct termios oldtio; /* required to reset port */
} meter_handle_d0_t;
/* forward declarations */
struct meter;
struct reading;
int meter_init_d0(struct meter *mtr, list_t options);
void meter_free_d0(struct meter *mtr);
int meter_open_d0(struct meter *mtr);
int meter_close_d0(struct meter *mtr);
size_t meter_read_d0(struct meter *mtr, struct reading *rds, size_t n);
2011-05-18 19:42:13 +02: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);
int meter_d0_open_device(const char *device, struct termios *old_tio, speed_t baudrate);
#endif /* _D0_H_ */