diff --git a/Makefile b/Makefile index a03cda9..5ad2609 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,17 @@ +# Copyright (C) 2017-2019 Fredrik Öhrström +# +# This program 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 +# (at your option) any later version. +# +# This program 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 this program. If not, see . # To compile for Raspberry PI ARM: # make HOST=arm @@ -10,10 +24,12 @@ ifeq "$(HOST)" "arm" CXX=arm-linux-gnueabihf-g++ STRIP=arm-linux-gnueabihf-strip BUILD=build_arm + DEBARCH=armhf else CXX=g++ STRIP=strip BUILD=build + DEBARCH=amd64 endif ifeq "$(DEBUG)" "true" @@ -54,7 +70,23 @@ METERS_OBJS:=\ $(BUILD)/wmbus_utils.o all: $(BUILD)/wmbusmeters $(BUILD)/testinternals - $(STRIP_BINARY) + @$(STRIP_BINARY) + +dist: wmbusmeters_0.8_$(DEBARCH).deb + +wmbusmeters_0.8_$(DEBARCH).deb: + @mkdir -p $(BUILD)/debian/wmbusmeters/DEBIAN + @mkdir -p $(BUILD)/debian/wmbusmeters/usr/local/bin + @cp $(BUILD)/wmbusmeters $(BUILD)/debian/wmbusmeters/usr/local/bin + @rm -f $(BUILD)/debian/wmbusmeters/DEBIAN/control + @echo "Package: wmbusmeters" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control + @echo "Version: 0.8" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control + @echo "Maintainer: Fredrik Öhrström" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control + @echo "Architecture: $(DEBARCH)" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control + @echo "Description: A tool to read wireless mbus telegrams from utility meters." >> $(BUILD)/debian/wmbusmeters/DEBIAN/control + @(cd $(BUILD)/debian; dpkg-deb --build wmbusmeters .) + @mv $(BUILD)/debian/wmbusmeters_0.8_$(DEBARCH).deb . + @echo Built package $@ $(BUILD)/wmbusmeters: $(METERS_OBJS) $(BUILD)/main.o $(CXX) -o $(BUILD)/wmbusmeters $(METERS_OBJS) $(BUILD)/main.o $(DEBUG_LDFLAGS) -lpthread diff --git a/README.md b/README.md index 35432aa..c5a8e1a 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,11 @@ Binary generated: `./build_debug/wmbusmeters` Binary generated: `./build_arm_debug/wmbusmeters` +`make HOST=arm dist` + +(Work in progress...) +Binary generated: `./wmbusmeters_0.8_armhf.deb` + # System configuration Add yourself to the dialout group to get access to the newly plugged in im871A USB stick. diff --git a/meter_multical21.cc b/meter_multical21.cc index 0309502..0424701 100644 --- a/meter_multical21.cc +++ b/meter_multical21.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2017-2018 Fredrik Öhrström + Copyright (C) 2017-2019 Fredrik Öhrström This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -245,8 +245,10 @@ void MeterMultical21::processContent(Telegram *t) if (frame_type == 0x79) { + // This is a "compact frame" in wmbus lingo. + // (Other such frame_types are Ci=0x69, 0x6a, 0x6b and Ci=0x79, 0x7b, compact frames and format frames) // 0,1 = crc for format signature = hash over DRH (Data Record Header) - // The DRH is the dif(dife)vif(vife) bytes for all the records... + // The DRH is the dif(difes)vif(vifes) bytes for all the records... // This hash should be used to pick up a suitable format string. // Below, DRH is hardcoded to 02FF2004134413 uchar ecrc0 = t->content[3];