more splitting
This commit is contained in:
parent
b68d09513f
commit
597c34712c
3 changed files with 17 additions and 44 deletions
|
@ -40,52 +40,42 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "list.h"
|
||||
#include "obis.h"
|
||||
#include "reading.h"
|
||||
|
||||
/* meter types */
|
||||
/* meter protocols */
|
||||
#include "file.h"
|
||||
#include "exec.h"
|
||||
#include "random.h"
|
||||
#include "s0.h"
|
||||
#include "d0.h"
|
||||
#include "fluksov2.h"
|
||||
#ifdef SML_SUPPORT
|
||||
#include "sml.h"
|
||||
#endif /* SML_SUPPORT */
|
||||
|
||||
typedef union reading_id {
|
||||
obis_id_t obis;
|
||||
char *string;
|
||||
char *uuid;
|
||||
} reading_id_t;
|
||||
|
||||
typedef struct reading {
|
||||
float value;
|
||||
struct timeval time;
|
||||
reading_id_t identifier;
|
||||
|
||||
struct reading *next; /* pointer for linked list */
|
||||
} reading_t;
|
||||
|
||||
typedef enum {
|
||||
typedef enum meter_procotol {
|
||||
meter_protocol_file = 1,
|
||||
meter_protocol_exec,
|
||||
meter_protocol_random,
|
||||
meter_protocol_s0,
|
||||
meter_protocol_d0,
|
||||
meter_protocol_sml
|
||||
meter_protocol_sml,
|
||||
meter_protocol_fluksov2
|
||||
} meter_protocol_t;
|
||||
|
||||
typedef struct meter {
|
||||
char id[5];
|
||||
meter_protocol_t protocol;
|
||||
int interval;
|
||||
|
||||
meter_protocol_t protocol;
|
||||
|
||||
union {
|
||||
meter_handle_file_t file;
|
||||
meter_handle_exec_t exec;
|
||||
meter_handle_random_t random;
|
||||
meter_handle_s0_t s0;
|
||||
meter_handle_d0_t d0;
|
||||
meter_handle_fluksov2_t fluksov2;
|
||||
#ifdef SML_SUPPORT
|
||||
meter_handle_sml_t sml;
|
||||
#endif /* SML_SUPPORT */
|
||||
|
@ -108,31 +98,12 @@ typedef struct {
|
|||
|
||||
/* prototypes */
|
||||
|
||||
/**
|
||||
* Converts timeval structure to double
|
||||
*
|
||||
* @param tv the timeval structure
|
||||
* @return the double value
|
||||
*/
|
||||
double tvtod(struct timeval tv);
|
||||
|
||||
/**
|
||||
* Converts double to timeval structure
|
||||
*
|
||||
* @param ts the double value
|
||||
* @return the timeval strucure
|
||||
*/
|
||||
struct timeval dtotv(double ts);
|
||||
|
||||
/**
|
||||
* Get list of available meter types
|
||||
*/
|
||||
const meter_details_t * meter_get_protocols();
|
||||
|
||||
const meter_details_t * meter_get_details(meter_protocol_t protocol);
|
||||
|
||||
int meter_lookup_protocol(const char *name, meter_protocol_t *protocol);
|
||||
|
||||
/**
|
||||
* Initialize meter
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@ VERSION = 1:0:0
|
|||
|
||||
lib_LIBRARIES = libmtr.a
|
||||
|
||||
libmtr_a_SOURCES = meter.c d0.c s0.c random.c file.c exec.c ltqnorm.c obis.c options.c
|
||||
libmtr_a_SOURCES = meter.c d0.c s0.c random.c file.c exec.c fluksov2.c ltqnorm.c obis.c options.c reading.c
|
||||
libmtr_a_LDFLAGS = -version-info $(VERSION)
|
||||
|
||||
# SML support
|
||||
|
|
|
@ -75,12 +75,12 @@ ARFLAGS = cru
|
|||
libmtr_a_AR = $(AR) $(ARFLAGS)
|
||||
libmtr_a_LIBADD =
|
||||
am__libmtr_a_SOURCES_DIST = meter.c d0.c s0.c random.c file.c exec.c \
|
||||
ltqnorm.c obis.c options.c sml.c
|
||||
fluksov2.c ltqnorm.c obis.c options.c reading.c sml.c
|
||||
@SML_SUPPORT_TRUE@am__objects_1 = sml.$(OBJEXT)
|
||||
am_libmtr_a_OBJECTS = meter.$(OBJEXT) d0.$(OBJEXT) s0.$(OBJEXT) \
|
||||
random.$(OBJEXT) file.$(OBJEXT) exec.$(OBJEXT) \
|
||||
ltqnorm.$(OBJEXT) obis.$(OBJEXT) options.$(OBJEXT) \
|
||||
$(am__objects_1)
|
||||
fluksov2.$(OBJEXT) ltqnorm.$(OBJEXT) obis.$(OBJEXT) \
|
||||
options.$(OBJEXT) reading.$(OBJEXT) $(am__objects_1)
|
||||
libmtr_a_OBJECTS = $(am_libmtr_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
|
@ -195,8 +195,8 @@ AM_CFLAGS = -Wall -D_REENTRANT -std=gnu99 $(am__append_2)
|
|||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
AM_LDFLAGS =
|
||||
lib_LIBRARIES = libmtr.a
|
||||
libmtr_a_SOURCES = meter.c d0.c s0.c random.c file.c exec.c ltqnorm.c \
|
||||
obis.c options.c $(am__append_1)
|
||||
libmtr_a_SOURCES = meter.c d0.c s0.c random.c file.c exec.c fluksov2.c \
|
||||
ltqnorm.c obis.c options.c reading.c $(am__append_1)
|
||||
libmtr_a_LDFLAGS = -version-info $(VERSION)
|
||||
all: all-am
|
||||
|
||||
|
@ -278,11 +278,13 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d0.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exec.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fluksov2.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ltqnorm.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/meter.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obis.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reading.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s0.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sml.Po@am__quote@
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue