[packages] add open2300, WS23XX weather station utilities

git-svn-id: svn://svn.openwrt.org/openwrt/packages@21115 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nunojpg 2010-04-23 23:09:18 +00:00
parent 433147a724
commit 6cc84b6561
3 changed files with 294 additions and 0 deletions

58
utils/open2300/Makefile Normal file
View File

@ -0,0 +1,58 @@
#
# Copyright (C) 2010 segal.di.ubi.pt
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=open2300
PKG_RELEASE:=1.11
PKG_VERSION:=1.11
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.ccccoimbra.com/open2300/
PKG_MD5SUM:=804576790840c3bc4a288f3e0f83ce4d
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/open2300
SECTION:=utils
CATEGORY:=Utilities
TITLE:=WS23XX weather station utilities
URL:=http://www.lavrsen.dk/twiki/bin/view/Open2300/WebHome
MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
endef
define Package/open2300/description
This is an utility suite used to communicate with and collect data from a WS23XX wheather station.
endef
define Package/open2300/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/open2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dump2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/log2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fetch2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wu2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/cw2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/history2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/histlog2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/xml2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/light2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/interval2300 $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/minmax2300 $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DATA) $(PKG_BUILD_DIR)/open2300-dist.conf $(1)/etc/
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib2300.so.1.11 $(1)/usr/lib/
ln -sf /usr/lib/lib2300.so.1.11 $(1)/usr/lib/lib2300.so
endef
$(eval $(call BuildPackage,open2300))

View File

@ -0,0 +1,68 @@
--- a/open2300.conf
+++ b/open2300.conf
@@ -0,0 +1,65 @@
+# open2300.conf
+#
+# Configuration files for open2300 weather station tools
+#
+# Default locations in which the programs will search for this file:
+# Programs search in this sequence:
+# 1. Path to config file including filename given as parameter (not supported by all tools)
+# 2. ./open2300.conf (current working directory)
+# 3. /jffs/etc/open2300.conf (typical DD-WRT location)
+# 4. /etc/open2300.conf (typical Linux location)
+#
+# All names are case sensitive!!!
+
+
+# Set to your serial port and time zone
+# For Windows use COM1, COM2, COM2 etc
+# For Linux use /dev/ttyS0, /dev/ttyS1 etc
+
+SERIAL_DEVICE /dev/tts/1 # /dev/ttyS0, /dev/ttyS1, COM1, COM2 etc
+TIMEZONE 1 # Hours Relative to UTC. East is positive, west is negative
+
+
+# Units of measure (set them to your preference)
+# The units of measure are ignored by wu2300 and cw2300 because both requires specific units
+
+WIND_SPEED m/s # select MPH (miles/hour), m/s, or km/h
+TEMPERATURE C # Select C or F
+RAIN mm # Select mm or IN
+PRESSURE hPa # Select hPa, mb or INHG
+
+
+#### Citizens Weather variables (used only by cw2300)
+# Format for latitude is
+# [2 digit degrees][2 digit minutes].[2 decimals minutes - NOT seconds][N for north or S for south]
+# Format for longitude is
+# [3 digit degrees][2 digit minutes].[2 decimals minutes - NOT seconds][E for east or W for west]
+# Use leading zeros to get the format ####.##N (lat) and #####.##E (long)
+
+CITIZEN_WEATHER_ID CW0000 # CW0000 should be replaced by HAM call or actual CW number
+CITIZEN_WEATHER_LATITUDE 5540.12N # DDMM.mmN or S - example 55 deg, 40.23 minutes north
+CITIZEN_WEATHER_LONGITUDE 01224.60E # DDDMM.mmE or W - example 12 deg, 24.60 minutes east
+
+APRS_SERVER rotate.aprs.net 14580 # These are the APRS servers and ports for
+APRS_SERVER first.aprs.net 14580 # Citizens Weather reporting.
+APRS_SERVER second.aprs.net 14580 # They they are tried in the entered order
+APRS_SERVER third.aprs.net 14580 # you may enter up to 5 alternate servers
+
+
+#### WEATHER UNDERGROUND variables (used only by wu2300)
+
+WEATHER_UNDERGROUND_ID WUID # ID received from Weather Underground
+WEATHER_UNDERGROUND_PASSWORD WUPASSWORD # Password for Weather Underground
+
+
+### MYSQL Settings (only used by mysql2300)
+
+#MYSQL_HOST localhost # Localhost or IP address/host name
+#MYSQL_USERNAME open2300 # Name of the MySQL user that has access to the database
+#MYSQL_PASSWORD mysql2300 # Password for the MySQL user
+#MYSQL_DATABASE open2300 # Named of your database
+#MYSQL_PORT 0 # TCP/IP Port number. Zero means default
+
+#PGSQL_CONNECT hostaddr='127.0.0.1'dbname='open2300'user='postgres'password='sql' # Connection string
+#PGSQL_TABLE weather # Table name
+#PGSQL_STATION open2300 # Unique station id

View File

@ -0,0 +1,168 @@
--- a/Makefile
+++ b/Makefile
@@ -15,91 +15,91 @@
prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
+libdir = ${prefix}/lib
#########################################
CC = gcc
-OBJ = open2300.o rw2300.o linux2300.o win2300.o
-LOGOBJ = log2300.o rw2300.o linux2300.o win2300.o
-FETCHOBJ = fetch2300.o rw2300.o linux2300.o win2300.o
-WUOBJ = wu2300.o rw2300.o linux2300.o win2300.o
-CWOBJ = cw2300.o rw2300.o linux2300.o win2300.o
-DUMPOBJ = dump2300.o rw2300.o linux2300.o win2300.o
-HISTOBJ = history2300.o rw2300.o linux2300.o win2300.o
-HISTLOGOBJ = histlog2300.o rw2300.o linux2300.o win2300.o
-DUMPBINOBJ = bin2300.o rw2300.o linux2300.o win2300.o
-XMLOBJ = xml2300.o rw2300.o linux2300.o win2300.o
-PGSQLOBJ = pgsql2300.o rw2300.o linux2300.o win2300.o
-LIGHTOBJ = light2300.o rw2300.o linux2300.o win2300.o
-INTERVALOBJ = interval2300.o rw2300.o linux2300.o win2300.o
-MINMAXOBJ = minmax2300.o rw2300.o linux2300.o win2300.o
-MYSQLHISTLOGOBJ = mysqlhistlog2300.o rw2300.o linux2300.o win2300.o
+LIB = lib2300
+LIB_C = rw2300.c linux2300.c
+LIBOBJ = rw2300.o linux2300.o
VERSION = 1.11
CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\"
-CC_LDFLAGS = -lm
-CC_WINFLAG =
-# For Windows - comment the two line above and un-comment the two lines below.
-#CC_LDFLAGS = -lm -lwsock32
-#CC_WINFLAG = -mwindows
+CC_LDFLAGS = -L. -lm -l2300
+LFLAGS = -shared -Wl,-soname
INSTALL = install
+MAKE_EXEC = $(CC) $(CFLAGS) $@.c -o $@ $(CC_LDFLAGS)
####### Build rules
-all: open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300 mysql2300 mysqlhistlog2300
+all: open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300
+#mysql2300 mysqlhistlog2300
-open2300 : $(OBJ)
- $(CC) $(CFLAGS) -o $@ $(OBJ) $(CC_LDFLAGS)
-
-dump2300 : $(DUMPOBJ)
- $(CC) $(CFLAGS) -o $@ $(DUMPOBJ) $(CC_LDFLAGS)
+lib2300 :
+ $(CC) -c -fPIC $(CFLAGS) $(LIB_C)
+ $(CC) $(LFLAGS),$@.so -o $@.so.$(VERSION) $(LIBOBJ)
+ ln -sf $@.so.$(VERSION) $@.so
+
+open2300 : $(LIB)
+ $(MAKE_EXEC)
-log2300 : $(LOGOBJ)
- $(CC) $(CFLAGS) -o $@ $(LOGOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
+dump2300 : $(LIB)
+ $(MAKE_EXEC)
-fetch2300 : $(FETCHOBJ)
- $(CC) $(CFLAGS) -o $@ $(FETCHOBJ) $(CC_LDFLAGS)
+log2300 : $(LIB)
+ $(MAKE_EXEC)
-wu2300 : $(WUOBJ)
- $(CC) $(CFLAGS) -o $@ $(WUOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
+fetch2300 : $(LIB)
+ $(MAKE_EXEC)
+
+srv2300 : $(LIB)
+ $(MAKE_EXEC)
+
+wu2300 : $(LIB)
+ $(MAKE_EXEC)
-cw2300 : $(CWOBJ)
- $(CC) $(CFLAGS) -o $@ $(CWOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
+cw2300 : $(LIB)
+ $(MAKE_EXEC)
-history2300 : $(HISTOBJ)
- $(CC) $(CFLAGS) -o $@ $(HISTOBJ) $(CC_LDFLAGS)
+history2300 : $(LIB)
+ $(MAKE_EXEC)
-histlog2300 : $(HISTLOGOBJ)
- $(CC) $(CFLAGS) -o $@ $(HISTLOGOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
+histlog2300 : $(LIB)
+ $(MAKE_EXEC)
-bin2300 : $(DUMPBINOBJ)
- $(CC) $(CFLAGS) -o $@ $(DUMPBINOBJ) $(CC_LDFLAGS)
+bin2300 : $(LIB)
+ $(MAKE_EXEC)
-xml2300 : $(XMLOBJ)
- $(CC) $(CFLAGS) -o $@ $(XMLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
+xml2300 : $(LIB)
+ $(MAKE_EXEC)
-mysql2300:
- $(CC) $(CFLAGS) -o mysql2300 mysql2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
+mysql2300: $(LIB)
+ $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/mysql -L/usr/lib/mysql $(CC_LDFLAGS) -lmysqlclient
-pgsql2300: $(PGSQLOBJ)
- $(CC) $(CFLAGS) -o $@ $(PGSQLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/pgsql -L/usr/lib/pgsql -lpq
+pgsql2300: $(LIB)
+ $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/pgsql -L/usr/lib/pgsql $(CC_LDFLAGS) -lpq
-light2300: $(LIGHTOBJ)
- $(CC) $(CFLAGS) -o $@ $(LIGHTOBJ) $(CC_LDFLAGS)
+light2300: $(LIB)
+ $(MAKE_EXEC)
-interval2300: $(INTERVALOBJ)
- $(CC) $(CFLAGS) -o $@ $(INTERVALOBJ) $(CC_LDFLAGS)
+interval2300: $(LIB)
+ $(MAKE_EXEC)
-minmax2300: $(MINMAXOBJ)
- $(CC) $(CFLAGS) -o $@ $(MINMAXOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
+minmax2300: $(LIB)
+ $(MAKE_EXEC)
-mysqlhistlog2300 :
- $(CC) $(CFLAGS) -o mysqlhistlog2300 mysqlhistlog2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
+mysqlhistlog2300 : $(LIB)
+ $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/mysql -L/usr/lib/mysql $(CC_LDFLAGS) -lmysqlclient
install:
mkdir -p $(bindir)
+ mkdir -p $(libdir)
+ $(INSTALL) $(LIB).so.$(VERSION) $(libdir)
+ ln -sf $(libdir)/$(LIB).so.$(VERSION) $(libdir)/$(LIB).so
+ $(INSTALL) srv2300 $(bindir)
$(INSTALL) open2300 $(bindir)
$(INSTALL) dump2300 $(bindir)
$(INSTALL) log2300 $(bindir)
@@ -111,14 +111,11 @@
$(INSTALL) light2300 $(bindir)
$(INSTALL) interval2300 $(bindir)
$(INSTALL) minmax2300 $(bindir)
- $(INSTALL) mysql2300 $(bindir)
- $(INSTALL) mysqlhistlog2300 $(bindir)
+# $(INSTALL) mysql2300 $(bindir)
+# $(INSTALL) mysqlhistlog2300 $(bindir)
uninstall:
- rm -f $(bindir)/open2300 $(bindir)/dump2300 $(bindir)/log2300 $(bindir)/fetch2300 $(bindir)/wu2300 $(bindir)/cw2300 $(bindir)/xml2300 $(bindir)/light2300 $(bindir)/interval2300 $(bindir)/minmax2300 $(bindir)/mysql2300 $(bindir)/mysqlhistlog2300
+ rm -f $(libdir)/$(LIB).* $(bindir)/open2300 $(bindir)/dump2300 $(bindir)/log2300 $(bindir)/fetch2300 $(bindir)/srv2300 $(bindir)/wu2300 $(bindir)/cw2300 $(bindir)/xml2300 $(bindir)/light2300 $(bindir)/interval2300 $(bindir)/minmax2300 $(bindir)/histlog2300 $(bindir)/mysql2300 $(bindir)/mysqlhistlog2300
clean:
- rm -f *~ *.o open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 mysql2300 pgsql2300 light2300 interval2300 minmax2300 mysql2300 mysqlhistlog2300
-
-cleanexe:
- rm -f *~ *.o open2300.exe dump2300.exe log2300.exe fetch2300.exe wu2300.exe cw2300.exe history2300.exe histlog2300.exe bin2300.exe xml2300.exe mysql2300.exe pgsql2300.exe light2300.exe interval2300.exe minmax2300.exe
\ No newline at end of file
+ rm -f *~ *.o *.so* open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 mysql2300 pgsql2300 light2300 interval2300 minmax2300 mysql2300 mysqlhistlog2300