|
From: <ma...@us...> - 2011-08-14 14:28:21
|
Revision: 407
http://openautomation.svn.sourceforge.net/openautomation/?rev=407&view=rev
Author: makki1
Date: 2011-08-14 14:28:13 +0000 (Sun, 14 Aug 2011)
Log Message:
-----------
Simple ETS4 .knxproj parser-tool
Added Paths:
-----------
tools/
tools/ets4tools/
tools/ets4tools/ets4parser.pl
Added: tools/ets4tools/ets4parser.pl
===================================================================
--- tools/ets4tools/ets4parser.pl (rev 0)
+++ tools/ets4tools/ets4parser.pl 2011-08-14 14:28:13 UTC (rev 407)
@@ -0,0 +1,152 @@
+#!/usr/bin/perl -w
+# a simple ETS4 project-parser, just a skeleton playing with and printing out some data
+#
+# (C) 2011 Michael Markstaller <de...@wi...> / Elaborated Networks GmbH
+# All Rights Reserved
+#
+# 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 2 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, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
+use XML::Simple;
+use Data::Dumper;
+use POSIX;
+
+no warnings qw(uninitialized);
+
+if (! glob("P-*/0.xml")) { # unzip
+ my $projectfile = glob("*.knxproj");
+ `unzip -o $projectfile`;
+ print "unzipped $projectfile\n";
+}
+
+my $file0 = glob("P-*/0.xml");
+open(my $fh, "<:encoding(ISO-8859-1)", $file0) || die "can't open file: $!";
+open(my $knxmfh, "<:encoding(ISO-8859-1)", 'knx_master.xml') || die "can't open file: $!";
+
+#special case: only one MG/GA etc. fixed with forcearray
+my $proj = XMLin($fh, ForceArray => ['GroupRange','GroupAddress','Area','Line','DeviceInstance','ComObjectInstanceRef','Send','Receive']);
+my $knxmaster = XMLin($knxmfh, KeyAttr => "Id");
+$Data::Dumper::Indent = 1;
+#print Dumper($proj->{Project}->{Installations}->{Installation}->{GroupAddresses});
+#print Dumper($knxmaster);
+
+my %groupaddresses;
+
+for my $HG ( @{ $proj->{Project}->{Installations}->{Installation}->{GroupAddresses}->{GroupRanges}->{GroupRange} } ) {
+ print floor($HG->{RangeStart}/2048);
+ print " $HG->{Name}\n";
+ for my $MG ( @{$HG->{GroupRange}} ) {
+ print " ";
+ print floor(($MG->{RangeEnd}-$HG->{RangeStart})/256);
+ print " $MG->{Name}\n";
+ for my $GA ( @{$MG->{GroupAddress}} ) {
+ print " ";
+ print $GA->{Address};
+ print " $GA->{Name} $GA->{Id}\n";
+ $groupaddresses{$GA->{Id}}{'Address'} = $GA->{Address};
+ $groupaddresses{$GA->{Id}}{'Name'} = $GA->{Name};
+ }
+ }
+}
+
+print "\nTopology\n\n";
+
+for my $Area ( @{ $proj->{Project}->{Installations}->{Installation}->{Topology}->{Area} } ) {
+ print "Area $Area->{Address} $Area->{Name} \n";
+ parseDevices($Area);
+ for my $Line ( @{ $Area->{Line} } ) {
+ print "Line $Area->{Address}.$Line->{Address} $Line->{Name} \n";
+ #Parse devices
+ parseDevices($Line);
+ }
+}
+
+sub parseDevices {
+ $line = shift;
+ return unless defined $line->{DeviceInstance};
+ for my $Device ( @{ $line->{DeviceInstance} } ) {
+ print " Device $Device->{Address} $Device->{Description} \n";
+ for my $Comobj ( @{$Device->{ComObjectInstanceRefs}->{ComObjectInstanceRef}} ) {
+ # if $Comobj->{DatapointType} is undef we could now look on ProductRefId="M-0001_H-hp.5F00199-1_P-5WG1.20141.2D1AB01" Hardware2ProgramRefId="M-0001_H-hp.5F00199-1_HP-8027-01-79C2"
+ # open M-xxxx/Hardware.xml - get the real product-xml, open M-0001_A-8027-01-79C2.xml
+ # and get at least the size from there: ComObjectTable->ComObject->ObjectSize
+ for my $Conn ( @{ $Comobj->{Connectors}->{Send} } ) {
+ $groupaddresses{$Conn->{GroupAddressRefId}}{'DatapointType'} = $Comobj->{DatapointType} if defined $Comobj->{DatapointType};
+ print " GA ".addr2str($groupaddresses{$Conn->{GroupAddressRefId}}{Address},1) ." :". $Comobj->{DatapointType} ."\n";
+ }
+ for my $Conn ( @{ $Comobj->{Connectors}->{Receive} } ) {
+ $groupaddresses{$Conn->{GroupAddressRefId}}{'DatapointType'} = $Comobj->{DatapointType} if defined $Comobj->{DatapointType};
+ print " GA ".addr2str($groupaddresses{$Conn->{GroupAddressRefId}}{Address},1) ." :". $Comobj->{DatapointType} ."\n";
+ }
+ }
+ }
+}
+
+# dump resulting GA-Hash
+for (keys %groupaddresses) {
+ print "GA " . addr2str($groupaddresses{$_}{Address},1);
+ print "\t " . $groupaddresses{$_}{Name};
+ # DatapointType can be DPT or DPST(subtype)
+ if ($groupaddresses{$_}{DatapointType} =~ m/^DPT/) {
+ printf("\t %d.000 \t",$knxmaster->{MasterData}->{DatapointTypes}->{DatapointType}->{$groupaddresses{$_}{DatapointType}}->{Number});
+ print $knxmaster->{MasterData}->{DatapointTypes}->{DatapointType}->{$groupaddresses{$_}{DatapointType}}->{Text};
+ } elsif ($groupaddresses{$_}{DatapointType} =~ m/^DPST/) {
+ my ($dummy,$parentDPT,$subDPT) = split(/-/,$groupaddresses{$_}{DatapointType},3);
+ printf("\t %d.%03d \t",$parentDPT,$subDPT);
+ print $knxmaster->{MasterData}->{DatapointTypes}->{DatapointType}->{"DPT-".$parentDPT}->{DatapointSubtypes}->{DatapointSubtype}->{$groupaddresses{$_}{DatapointType}}->{Name};
+ print "\t" . $knxmaster->{MasterData}->{DatapointTypes}->{DatapointType}->{"DPT-".$parentDPT}->{DatapointSubtypes}->{DatapointSubtype}->{$groupaddresses{$_}{DatapointType}}->{Text};
+ } else { #guess default
+ print "\tis unknown";
+ # assume default 1.001
+ }
+ print "\n";
+ # fill own config etc here
+}
+
+print "ETS: ". $proj->{ToolVersion} ."\n";
+
+#Version-check 4.0.1387.12605
+my @etsversion = split(/\./, $proj->{ToolVersion});
+if ($etsversion[2] < 1387) {
+ print "error ETS " . $proj->{ToolVersion} . " too old - must be 4.0.3 or higher\n";
+ exit;
+}
+
+
+# addr2str: Convert an integer to an EIB address string, in the form "1/2/3" or "1.2.3"
+sub addr2str {
+ my $a = $_[0];
+ my $b = $_[1] || 0; # 1 if local (group) address, else physical address
+ my $str ;
+ if ($b == 1) { # logical address used
+ $str = sprintf "%d/%d/%d", ($a >> 11) & 0xf, ($a >> 8) & 0x7, $a & 0xff;
+ }
+ else { # physical address used
+ $str = sprintf "%d.%d.%d", $a >> 12, ($a >> 8) & 0xf, $a & 0xff;
+ }
+ return $str;
+}
+
+# str2addr: Convert an EIB address string in the form "1/2/3" or "1.2.3" to an integer
+sub str2addr {
+ my $str = $_[0];
+ if ($str =~ /(\d+)\/(\d+)\/(\d+)/) { # logical address
+ return ($1 << 11) | ($2 << 8) | $3;
+ } elsif ($str =~ /(\d+)\.(\d+)\.(\d+)/) { # physical address
+ return ($1 << 12) | ($2 << 8) | $3;
+ } else {
+ #bad
+ return;
+ }
+}
Property changes on: tools/ets4tools/ets4parser.pl
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-09-07 18:11:34
|
Revision: 413
http://openautomation.svn.sourceforge.net/openautomation/?rev=413&view=rev
Author: makki1
Date: 2011-09-07 18:11:25 +0000 (Wed, 07 Sep 2011)
Log Message:
-----------
russconnectd - initial commit. A small daemon to interface russ amp with eibd
Added Paths:
-----------
tools/russconnectd/
tools/russconnectd/release/
tools/russconnectd/release/russconnectd-0.1.tar.gz
tools/russconnectd/trunk/
tools/russconnectd/trunk/AUTHORS
tools/russconnectd/trunk/COPYING
tools/russconnectd/trunk/ChangeLog
tools/russconnectd/trunk/INSTALL
tools/russconnectd/trunk/Makefile.am
tools/russconnectd/trunk/NEWS
tools/russconnectd/trunk/README
tools/russconnectd/trunk/TODO.tasks
tools/russconnectd/trunk/configure.ac
tools/russconnectd/trunk/debian/
tools/russconnectd/trunk/debian/README
tools/russconnectd/trunk/debian/README.Debian
tools/russconnectd/trunk/debian/changelog
tools/russconnectd/trunk/debian/compat
tools/russconnectd/trunk/debian/control
tools/russconnectd/trunk/debian/copyright
tools/russconnectd/trunk/debian/docs
tools/russconnectd/trunk/debian/files
tools/russconnectd/trunk/debian/init.d
tools/russconnectd/trunk/debian/rules
tools/russconnectd/trunk/debian/russconnectd.default
tools/russconnectd/trunk/debian/source/
tools/russconnectd/trunk/debian/source/format
tools/russconnectd/trunk/intltool-extract.in
tools/russconnectd/trunk/intltool-merge.in
tools/russconnectd/trunk/intltool-update.in
tools/russconnectd/trunk/openwrt/
tools/russconnectd/trunk/openwrt/russconnectd/
tools/russconnectd/trunk/openwrt/russconnectd/Makefile
tools/russconnectd/trunk/openwrt/russconnectd/files/
tools/russconnectd/trunk/openwrt/russconnectd/files/init
tools/russconnectd/trunk/po/
tools/russconnectd/trunk/po/ChangeLog
tools/russconnectd/trunk/po/LINGUAS
tools/russconnectd/trunk/po/Makefile.in.in
tools/russconnectd/trunk/po/POTFILES.in
tools/russconnectd/trunk/russ_galist.ods
tools/russconnectd/trunk/src/
tools/russconnectd/trunk/src/Makefile.am
tools/russconnectd/trunk/src/main.c
Added: tools/russconnectd/release/russconnectd-0.1.tar.gz
===================================================================
(Binary files differ)
Property changes on: tools/russconnectd/release/russconnectd-0.1.tar.gz
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: tools/russconnectd/trunk/AUTHORS
===================================================================
--- tools/russconnectd/trunk/AUTHORS (rev 0)
+++ tools/russconnectd/trunk/AUTHORS 2011-09-07 18:11:25 UTC (rev 413)
@@ -0,0 +1 @@
+Michael Markstaller <de...@wi...>
\ No newline at end of file
Added: tools/russconnectd/trunk/COPYING
===================================================================
--- tools/russconnectd/trunk/COPYING (rev 0)
+++ tools/russconnectd/trunk/COPYING 2011-09-07 18:11:25 UTC (rev 413)
@@ -0,0 +1,675 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to ...
[truncated message content] |
|
From: <ma...@us...> - 2012-01-09 18:39:49
|
Revision: 648
http://openautomation.svn.sourceforge.net/openautomation/?rev=648&view=rev
Author: mayerch
Date: 2012-01-09 18:39:38 +0000 (Mon, 09 Jan 2012)
Log Message:
-----------
Added directory structure for the http://knx-user-forum.de/ iconset.
Added Paths:
-----------
tools/knx-uf-iconset/
tools/knx-uf-iconset/release/
tools/knx-uf-iconset/trunk/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-03-07 22:55:41
|
Revision: 724
http://openautomation.svn.sourceforge.net/openautomation/?rev=724&view=rev
Author: makki1
Date: 2012-03-07 22:55:34 +0000 (Wed, 07 Mar 2012)
Log Message:
-----------
Tool to read electricity-meter easymeter (SML) by NetFritz
Added Paths:
-----------
tools/sml-meter/
tools/sml-meter/easymeter.pl
Added: tools/sml-meter/easymeter.pl
===================================================================
--- tools/sml-meter/easymeter.pl (rev 0)
+++ tools/sml-meter/easymeter.pl 2012-03-07 22:55:34 UTC (rev 724)
@@ -0,0 +1,94 @@
+#!/usr/bin/perl
+#
+# Holt die Daten vom SML-Zaehler Easymeter Q3C
+# es wird die obere optische Schnittstelle ausgelesen
+# dort liefert der Zaehler alle 2sec. einen Datensatz
+# wird von CRON jede Minute aufgerufen
+# http://wiki.volkszaehler.org/software/sml
+# 03.2012 by NetFritz
+#
+use Device::SerialPort;
+use RRDs;
+#
+my $port = Device::SerialPort->new("/dev/usbserial-2-4") || die $!;
+$port->databits(8);
+$port->baudrate(9600);
+$port->parity("none");
+$port->stopbits(1);
+$port->handshake("none");
+$port->write_settings;
+$port->dtr_active(1);
+$port->purge_all();
+$port->read_char_time(0); # don't wait for each character
+$port->read_const_time(1000); # 1 second per unfulfilled "read" call
+#
+# OBIS-Kennzahl und Anzahl der Zeichen von Anfang OBIS bis Messwert, Messwertwertlaenge immer 8 Zeichen
+%obis_len = (
+'01010801FF' => 42, # Aktueller Zählerstand T1 + Bezug
+'02020805FF' => 42, # Aktueller Zählerstand T5 - Abgabe
+'00010700FF' => 24 # Momentane Summe der Leistung +-
+);
+my $pos = 0;
+my $hexval;
+my @hexdec;
+while ($i < 3) { # wenn 540 chars gelesen werden wird mit last abgebrochen, wenn nicht wird Schleife 2 mal widerholt
+ my ($count,$saw)=$port->read(540); # will read 540 chars
+ if ($count == 540) { # wurden 540 chars gelesen ?
+ my $x=uc(unpack('H*',$saw)); # nach hex wandeln
+ # print "$count <> $x\n "; # gibt die empfangenen Daten in Hex aus
+ #
+ foreach $key(keys%obis_len){
+ $pos=index($x,$key); # pos von OBIS holen
+ $value = substr($x,$pos+$obis_len{$key},8); # Messwert
+ $value{$key} = hexstr_to_signed32int($value)/100; # von hex nach 32bit integer
+ }
+ last; # while verlassen
+ }
+ else {
+ $i++;
+ redo; # bei Fehler while nochmal
+ }
+}
+#
+@hexdec = encode_dpt9($value{'00010700FF'});
+$hexval = sprintf("%x", $hexdec[0]) . " " . sprintf("%x", $hexdec[1]);
+system("groupwrite ip:127.0.0.1 5/0/12 $hexval");
+#
+@hexdec = encode_dpt9($value{'01010801FF'});
+$hexval = sprintf("%x", $hexdec[0]) . " " . sprintf("%x", $hexdec[1]);
+system("groupwrite ip:127.0.0.1 5/0/13 $hexval");
+#
+@hexdec = encode_dpt9($value{'02020805FF'});
+$hexval = sprintf("%x", $hexdec[0]) . " " . sprintf("%x", $hexdec[1]);
+system("groupwrite ip:127.0.0.1 5/0/14 $hexval");
+#
+RRDs::update("/var/www/rrd/Zaehler_Leistung.rrd", "N: $value{'00010700FF'}");
+#
+#
+# --- Sub Konvertiert hex string to 32 bit signed integer ----------
+sub hexstr_to_signed32int {
+ my ($hexstr) = @_;
+ die "Invalid hex string: $hexstr"
+ if $hexstr !~ /^[0-9A-Fa-f]{1,8}$/;
+ my $num = hex($hexstr);
+ return $num >> 31 ? $num - 2 ** 32 : $num;
+}
+# --- Sub 2byte signed float --------------------------------------
+sub encode_dpt9 {
+ my $state = shift;
+ my $data;
+
+ my $sign = ($state <0 ? 0x8000 : 0);
+ my $exp = 0;
+ my $mant = 0;
+
+ $mant = int($state * 100.0);
+ while (abs($mant) > 2047) {
+ $mant /= 2;
+ $exp++;
+ }
+ $data = $sign | ($exp << 11) | ($mant & 0x07ff);
+ return $data >> 8, $data & 0xff;
+}
+# Ende
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-05-07 18:51:28
|
Revision: 794
http://openautomation.svn.sourceforge.net/openautomation/?rev=794&view=rev
Author: j-n-k
Date: 2012-05-07 18:51:21 +0000 (Mon, 07 May 2012)
Log Message:
-----------
Inital commit for knxdmxd - A KNX-DMX controller using OLA
Added Paths:
-----------
tools/knxdmxd/
tools/knxdmxd/Makefile
tools/knxdmxd/knxdmxd
tools/knxdmxd/knxdmxd.c
tools/knxdmxd/knxdmxd.conf
Added: tools/knxdmxd/Makefile
===================================================================
--- tools/knxdmxd/Makefile (rev 0)
+++ tools/knxdmxd/Makefile 2012-05-07 18:51:21 UTC (rev 794)
@@ -0,0 +1,7 @@
+CC = g++
+CFLAGS = -Wall -Os
+LIBS = -L. -L/usr/lib -L/home/jan/ola-0.8.18/ola -lpthread -leibclient -lolacommon -lola -ljson
+
+knxdmxd: knxdmxd.c
+ $(CC) $(CFLAGS) knxdmxd.c $(LIBS) -o knxdmxd
+
Added: tools/knxdmxd/knxdmxd
===================================================================
(Binary files differ)
Property changes on: tools/knxdmxd/knxdmxd
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: tools/knxdmxd/knxdmxd.c
===================================================================
--- tools/knxdmxd/knxdmxd.c (rev 0)
+++ tools/knxdmxd/knxdmxd.c 2012-05-07 18:51:21 UTC (rev 794)
@@ -0,0 +1,653 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * knxdmxd.c
+ * Copyright (C) Jan N. Klug 2012 <jan...@ru...>
+ * Daemon skeleton by Michael Markstaller 2011 <de...@wi...>
+ *
+ * knxdmxd 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.
+ *
+ * knxdmxd 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 <http://www.gnu.org/licenses/>.
+ */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <string.h>
+#include <signal.h>
+#include <getopt.h>
+#include <json/json.h>
+
+#include <ola/Logging.h>
+#include <ola/DmxBuffer.h>
+#include <ola/StreamingClient.h>
+#include <ola/StringUtils.h>
+
+//#include <assert.h>
+
+#include <arpa/inet.h>
+//#include <netinet/in.h>
+//#include <sys/socket.h>
+
+#include <pthread.h>
+#include <eibclient.h>
+
+#include <iostream>
+#include <fstream>
+#include <map>
+
+/*#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/xml_parser.hpp>
+#include <boost/foreach.hpp>*/
+
+#define DEBUG 1
+#define DAEMON_NAME "knxdmxd"
+#define USAGESTRING "\n"\
+ "\t-d Run as daemon/No debug output\n"\
+ "\t-p <pidfile> PID-filename\n"\
+ "\t-u <eib url> URL to contact eibd like local:/tmp/eib or ip:192.168.0.101\n"\
+ "\t-c <config-file> Config-File\n"
+#define NUM_THREADS 4
+#define MAX_ZONES 31
+#define RETRY_TIME 5
+#define BUFLEN 1024
+#define POLLING_INTERVAL 10
+#define FADING_INTERVAL 50000
+
+using namespace std;
+//namespace bpt = boost::property_tree;
+typedef vector<string> svector;
+
+void daemonShutdown();
+
+eibaddr_t readgaddr (const char *addr) {
+ int a, b, c;
+ if (sscanf (addr, "%d/%d/%d", &a, &b, &c) == 3)
+ return ((a & 0x01f) << 11) | ((b & 0x07) << 8) | ((c & 0xff));
+ if (sscanf (addr, "%d/%d", &a, &b) == 2)
+ return ((a & 0x01f) << 11) | ((b & 0x7FF));
+ if (sscanf (addr, "%x", &a) == 1)
+ return a & 0xffff;
+ syslog(LOG_WARNING,"invalid group address format %s", addr);
+ daemonShutdown();
+ return 0;
+}
+
+int readdaddr (const string addr) {
+ int universe, channel;
+ sscanf( (char*)addr.c_str(), "%d.%d", &universe, &channel);
+ if (channel==-1) { // default universe is 1
+ channel = universe;
+ universe = 1;
+ }
+ return (universe << 9) + channel;
+}
+
+namespace knxdmxd {
+
+class Fixture {
+ public:
+ Fixture() {};
+ Fixture(const string str);
+
+ void Patch(map<int, svector >& patchMap, const string channel, const int DMX, const int KNX);
+ void Patch(map<int, svector >& patchMap, const string channel, const string DMX, const string KNX);
+ void SetFadeTime(const float t);
+ void PatchFadeTime(const int KNX);
+ void Update(const int KNX, const int val);
+ void Refresh(map<int, ola::DmxBuffer>& output);
+ private:
+ string name;
+ map <string, int> channelKNX;
+ map <string, int> channelDMX;
+ map <string, int> channelValue;
+ map <string, float> channelFloatValue;
+ float fadeTime, fadeStep;
+ int fadeTimeKNX;
+};
+
+Fixture::Fixture(const string str) {
+ name=str;
+ syslog(LOG_DEBUG, "Created Fixture '%s'", (char *)str.c_str());
+}
+
+void Fixture::Patch(map<int, svector>& patchMap, const string channel, const int DMX, const int KNX) {
+ channelKNX[channel] = KNX;
+ channelDMX[channel] = DMX;
+
+ syslog(LOG_DEBUG, "Fixture '%s': Patched channel '%s' (KNX %d to DMX %d) ", (char *)name.c_str(), (char *)channel.c_str(), KNX, DMX);
+
+ svector assignedChannels = patchMap[KNX]; // check if already patched
+ for (vector<string>::iterator i = assignedChannels.begin(); i != assignedChannels.end(); ++i) {
+ if ((*i)==name) { // already patched;
+ return;
+ }
+ }
+
+ patchMap[KNX].push_back(name); // no, add to patchMap
+
+}
+
+void Fixture::Patch(map<int, svector>& patchMap, const string channel, const string DMX, const string KNX) {
+ Patch(patchMap, channel, readdaddr(DMX), readgaddr((char *) KNX.c_str()));
+}
+
+void Fixture::SetFadeTime(const float t) {
+ fadeTime = t;
+ fadeStep = (t<=0) ? 256 : 256/(t*1e6/FADING_INTERVAL);
+ syslog(LOG_DEBUG, "Fixture '%s': Set Fadetime to %.2f s'(%.2f steps/interval)", (char *)name.c_str(), fadeTime, fadeStep);
+}
+
+void Fixture::PatchFadeTime(const int KNX) {
+ fadeTimeKNX = KNX;
+}
+
+void Fixture::Update(const int KNX, const int val) {
+ for(std::map<string, int>::const_iterator i = channelKNX.begin(); i != channelKNX.end(); ++i) {
+ if (i->second == KNX) {
+ channelValue[i->first] = val;
+ syslog(LOG_DEBUG, "Updated channel '%s' to %d", (char *)i->first.c_str(), val);
+ }
+ }
+}
+
+void Fixture::Refresh(map<int, ola::DmxBuffer>& output) {
+ for(std::map<string, int>::const_iterator i = channelDMX.begin(); i != channelDMX.end(); ++i) {
+ int dmxuniverse = (int) (i->second / 512) , dmxchannel = i->second % 512;
+ int oldValue = output[dmxuniverse].Get(dmxchannel);
+ int newValue = channelValue[i->first];
+ if (oldValue<newValue) {
+ channelFloatValue[i->first] += fadeStep;
+ if (channelFloatValue[i->first]>newValue) {
+ channelFloatValue[i->first] = newValue;
+ }
+ output[dmxuniverse].SetChannel(dmxchannel, (int) channelFloatValue[i->first]);
+ }
+ if (oldValue>newValue) {
+ channelFloatValue[i->first] -= fadeStep;
+ if (channelFloatValue[i->first]<newValue) {
+ channelFloatValue[i->first] = newValue;
+ }
+ output[dmxuniverse].SetChannel(dmxchannel, (int) channelFloatValue[i->first]);
+ }
+ }
+}
+
+}
+
+pthread_mutex_t zonelock = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t initlock = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t standbylock = PTHREAD_MUTEX_INITIALIZER;
+
+string eibd_url = "local:/tmp/eib";
+string conf_file = "knxdmxd.conf";
+int pidFilehandle;
+string pidfilename = "/var/run/dmxknxd.pid";
+
+map<int, ola::DmxBuffer> dmxWriteBuffer;
+map<string, knxdmxd::Fixture> fixtureList;
+map<int, svector> patchMap;
+
+void daemonShutdown() {
+ //FIXME: clean exit pthread_exit(NULL); pthread_cancel(..);
+ //close(udpSocket);
+ syslog(LOG_INFO, "%s daemon exiting", DAEMON_NAME);
+ fprintf(stderr, "%s daemon exiting", DAEMON_NAME);
+ close(pidFilehandle);
+ unlink((char *)pidfilename.c_str());
+ exit(EXIT_SUCCESS);
+}
+
+void signal_handler(int sig) {
+ switch(sig) {
+ case SIGHUP:
+ syslog(LOG_WARNING, "Received SIGHUP signal.");
+ break;
+ case SIGTERM:
+ syslog(LOG_WARNING, "Received SIGTERM signal.");
+ daemonShutdown();
+ break;
+ case SIGINT:
+ syslog(LOG_WARNING, "Received SIGINT signal.");
+ daemonShutdown();
+ break;
+ default:
+ syslog(LOG_WARNING, "Unhandled signal (%d) %s", sig, strsignal(sig));
+ break;
+ }
+}
+
+/*void *sendKNXdgram(int type, int dpt, eibaddr_t dest, unsigned char val) {
+ int len = 0;
+ EIBConnection *con;
+ unsigned char buf[255] = { 0, 0x80 };
+ buf[1] = type; //0x40 response, 0x80 write
+ syslog(LOG_DEBUG,"Send KNX dgram Type %d DPT %d dest %d val %d",type,dpt,dest,val);
+ con = EIBSocketURL ((char *)eibd_url.c_str());
+ if (!con)
+ syslog(LOG_WARNING,"sendknxdgram: Open failed");
+ if (EIBOpenT_Group (con, dest, 1) == -1)
+ syslog(LOG_WARNING,"sendknxdgram: Connect failed");
+ switch (dpt)
+ {
+ case 0:
+ len=1;
+ //for(i = 0; i < strlen(val)/2; i++)
+ //raw value: nothing for now
+ break;
+ case 1:
+ buf[1] |= val & 0x3f;
+ len=2;
+ break;
+ case 3:
+ // EIS2/DPT3 4bit dim
+ buf[1] |= val & 0x3f;
+ len=2;
+ break;
+ case 5:
+ buf[2] = val*255/100;
+ len=3;
+ break;
+ case 51:
+ case 5001:
+ buf[2] = val;
+ len=3;
+ break;
+ case 6:
+ case 6001:
+ //FIXME: This is basically wrong but as we get a uchar we expect the sender to know..
+ buf[2] = val;
+ len=3;
+ break;
+ }
+
+ len = EIBSendAPDU (con, len, buf);
+ if (len == -1)
+ syslog (LOG_WARNING,"sendknxdram: Request failed");
+ EIBClose (con);
+ usleep(50*1000); //throttle a little (50ms/max 20tps)
+ return 0;
+} */
+
+void sigtime(int signo)
+{
+ for(std::map<string, knxdmxd::Fixture>::const_iterator i = fixtureList.begin(); i != fixtureList.end(); ++i) {
+ fixtureList[i->first].Refresh(dmxWriteBuffer);
+ }
+ signal(SIGALRM, sigtime);
+}
+
+void *worker(void *) {
+ syslog(LOG_DEBUG, "Internal worker thread started");
+
+ signal(SIGALRM, sigtime);
+
+ itimerval itm;
+ itm.it_interval.tv_sec=0;
+ itm.it_value.tv_sec = 0;
+ itm.it_interval.tv_usec = FADING_INTERVAL; // 20 ms is enough
+ itm.it_value.tv_usec = FADING_INTERVAL;
+ setitimer(ITIMER_REAL,&itm,0);
+
+ while (1) {
+ sleep(POLLING_INTERVAL);
+ }
+
+ pthread_exit(NULL);
+}
+
+/*void *sendKNXresponse(eibaddr_t dest, int zone, int func) {
+ syslog(LOG_DEBUG, "KNX response %d zone %d func %d", dest,zone,func);
+ pthread_mutex_lock (&zonelock);
+ switch (func) {
+ case 0:
+ case 20:
+ sendKNXdgram (0x40,1,dest,zones[zone].zonepower);
+ break;
+ case 1:
+ case 21:
+ sendKNXdgram (0x40,51,dest,zones[zone].srcid);
+ break;
+ case 2:
+ case 22:
+ sendKNXdgram (0x40,5,dest,zones[zone].volume*2);
+ break;
+ case 3:
+ case 23:
+ if (zones[zone].bass<10)
+ sendKNXdgram (0x40,51,dest,zones[zone].bass-10+256);
+ else
+ sendKNXdgram (0x40,51,dest,zones[zone].bass-10);
+ break;
+ case 4:
+ case 24:
+ if (zones[zone].treble<10)
+ sendKNXdgram (0x40,51,dest,zones[zone].treble-10+256);
+ else
+ sendKNXdgram (0x40,51,dest,zones[zone].treble-10);
+ break;
+ case 5:
+ case 25:
+ sendKNXdgram (0x40,1,dest,zones[zone].loudness);
+ break;
+ case 6:
+ case 26:
+ if (zones[zone].balance<10)
+ sendKNXdgram (0x40,51,dest,zones[zone].balance-10+256);
+ else
+ sendKNXdgram (0x40,51,dest,zones[zone].balance-10);
+ break;
+ case 27:
+ sendKNXdgram (0x40,1,dest,zones[zone].partymode);
+ break;
+ case 28:
+ sendKNXdgram (0x40,1,dest,zones[zone].dnd);
+ break;
+ case 29:
+ sendKNXdgram (0x40,5,dest,zones[zone].onvolume*2);
+ break;
+ }
+ pthread_mutex_unlock (&zonelock);
+ return 0;
+}
+*/
+void *handleKNXdgram(eibaddr_t dest, unsigned char* buf, int len){
+ unsigned char val;
+ switch (buf[1] & 0xC0) {
+ case 0x00:
+// sendKNXresponse (dest,zone+(controller*ZONES_PER_CONTROLLER),func);
+ break;
+ case 0x40:
+ //FIXME: response dunno
+ break;
+ case 0x80:
+ if (buf[1] & 0xC0) {
+ if (len == 2)
+ val = buf[1] & 0x3F;
+ else
+ val = buf[2];
+ svector uFixtures = patchMap.find(dest)->second;
+ for (unsigned int i=0; i < uFixtures.size(); i++) {
+ fixtureList[uFixtures[i]].Update(dest, val);
+ }
+ syslog(LOG_DEBUG, "Received %d @ %d, updated %d fixtures", val, dest, (int) uFixtures.size());
+ }
+ break;
+ }
+ return 0;
+}
+
+
+void *olahandler(void *) { // thread just reliably sends the data to DMX via OLA
+ syslog(LOG_DEBUG, "OLA sender thread started");
+
+ ola::InitLogging(ola::OLA_LOG_WARN, ola::OLA_LOG_STDERR);
+
+ while (1) { // retry forever
+
+ ola::StreamingClient ola_client;
+
+ if (!ola_client.Setup()) { // setup client
+ syslog(LOG_WARNING, "OLA: Client setup failed");
+ sleep(RETRY_TIME);
+ continue;
+ }
+
+ syslog(LOG_INFO, "OLA: Client connected");
+
+ while (1) { // loop forever
+ int error_flag=0;
+ for(std::map<int, ola::DmxBuffer>::const_iterator i = dmxWriteBuffer.begin(); i != dmxWriteBuffer.end(); ++i) {
+ int universe = i->first;
+ if (!ola_client.SendDmx(universe, i->second)) { // send all universes
+ syslog(LOG_WARNING, "OLA: failed to send universe %d", universe);
+ error_flag = 1;
+ break; // something went wrong
+ }
+ }
+ if (error_flag==1) {
+ sleep(RETRY_TIME);
+ break;
+ }
+
+ usleep(20000);
+ }
+
+ ola_client.Stop(); // close the client
+ }
+
+ pthread_exit(NULL);
+}
+
+
+void *knxhandler(void *) {
+ syslog(LOG_DEBUG, "KNX reader thread started");
+ int len;
+ EIBConnection *con;
+ eibaddr_t dest;
+ eibaddr_t src;
+ unsigned char buf[255];
+
+ while (1) //retry infinite
+ {
+ con = EIBSocketURL ((char *)eibd_url.c_str());
+ if (!con) {
+ syslog(LOG_WARNING, "eibd: Open failed");
+ sleep(RETRY_TIME);
+ continue;
+ }
+
+ if (EIBOpen_GroupSocket (con, 0) == -1) {
+ syslog(LOG_WARNING, "eibd: Connect failed");
+ sleep(RETRY_TIME);
+ continue;
+ }
+
+ while (1)
+ {
+ len = EIBGetGroup_Src (con, sizeof (buf), buf, &src, &dest);
+ if (len == -1) {
+ syslog(LOG_WARNING, "eibd: Read failed");
+ sleep(RETRY_TIME);
+ break;
+ }
+ if (len < 2) {
+ syslog(LOG_WARNING, "eibd: Invalid Packet");
+ break;
+ }
+ if (buf[0] & 0x3 || (buf[1] & 0xC0) == 0xC0) {
+ syslog(LOG_WARNING, "eibd: Unknown APDU from %d to %d",src,dest);
+ break;
+ } else {
+ if ( patchMap.count(dest)<=0 ) //not for us
+ continue;
+ handleKNXdgram(dest,buf,len);
+ }
+ }
+ syslog(LOG_WARNING,"eibd: closed connection"); //break in read-loop
+ EIBClose (con);
+ }
+ pthread_exit(NULL);
+}
+
+void load_config() {
+
+/* bpt::ptree config;
+
+ read_xml(conf_file, config);
+
+ BOOST_FOREACH( bpt::ptree::value_type const& e, config) {
+ if( e.first == "fixture" ) {
+ string name = e.second.get<std::string>("<xmlattr>.name");
+ knxdmxd::Fixture f(name);
+ BOOST_FOREACH( bpt::ptree::value_type const& c, e.second) {
+ if (c.first == "channel") {
+ f.Patch(patchMap, c.second.data(), c.second.get<std::string>("<xmlattr>.dmx"), c.second.get<std::string>("<xmlattr>.knx"));
+ }
+ if (c.first == "fading") {
+ float t;
+ string content = c.second.data();
+ sscanf((char*) content.c_str(), "%f", &t);
+ f.SetFadeTime((int) (t*1.e6));
+ }
+ }
+ fixtureList[name] = f;
+ }
+
+ } */
+ struct json_object *config;
+
+ config = json_object_from_file((char *)conf_file.c_str());
+ // first all fixtures
+ struct json_object *fixtures = json_object_object_get(config, "fixtures");
+
+ int fixturenum = json_object_array_length(fixtures);
+
+ for (int i=0; i<fixturenum; i++) { // read all
+ // get fixture
+ struct json_object *fixture = json_object_array_get_idx(fixtures, i);
+
+ // get name & create
+ string fname(json_object_get_string(json_object_object_get(fixture, "name")));
+ knxdmxd::Fixture f(fname);
+
+ // get channels & patch them
+ struct json_object *channels = json_object_object_get(fixture, "channels");
+ int channelnum = json_object_array_length(channels);
+ for (int j=0; j<channelnum; j++) { // read all
+ // get channel
+ struct json_object *channel = json_object_array_get_idx(channels, j);
+ string cname(json_object_get_string(json_object_object_get(channel, "name")));
+ string cdmx(json_object_get_string(json_object_object_get(channel, "dmx")));
+ string cknx(json_object_get_string(json_object_object_get(channel, "knx")));
+ f.Patch(patchMap, cname, cdmx, cknx);
+ }
+
+ // get fading
+ struct json_object *fading = json_object_object_get(fixture, "fading");
+ float ftime = (fading) ? json_object_get_double(json_object_object_get(fading, "time")) : 0;
+ f.SetFadeTime(ftime);
+
+ fixtureList[fname] = f;
+ }
+
+ return;
+}
+
+int main(int argc, char **argv) {
+ int daemonize = 0;
+ int c;
+ //char *p;
+ char pidstr[255];
+
+ while ((c = getopt (argc, argv, "d:p:u:c:")) != -1)
+ switch (c) {
+ case 'd':
+ daemonize = 1;
+ break;
+ case 'p':
+ pidfilename.assign(optarg);
+ break;
+ case 'u':
+ eibd_url.assign(optarg);
+ break;
+ case 'c':
+ conf_file.assign(optarg);
+ break;
+ case '?':
+ //FIXME: check arguments better, print_usage
+ fprintf (stderr, "Unknown option `-%c'.\nUsage: %s %s", optopt, argv[0], USAGESTRING);
+ return 1;
+ default:
+ abort ();
+ }
+
+ //FIXME: clean shutdown in sub-thread with signals?
+ signal(SIGHUP, signal_handler);
+ signal(SIGTERM, signal_handler);
+ signal(SIGINT, signal_handler);
+ signal(SIGQUIT, signal_handler);
+
+ if (!daemonize) {
+ setlogmask(LOG_UPTO(LOG_DEBUG));
+ openlog(DAEMON_NAME, LOG_CONS | LOG_NDELAY | LOG_PERROR | LOG_PID, LOG_USER);
+ syslog(LOG_DEBUG, "startup with debug; pidfile: %s, eibd: %s",
+ (char *)pidfilename.c_str(), (char *)eibd_url.c_str());
+ } else {
+ setlogmask(LOG_UPTO(LOG_INFO));
+ openlog(DAEMON_NAME, LOG_CONS, LOG_USER);
+ }
+
+ syslog(LOG_INFO, "using config-file %s", (char *)conf_file.c_str());
+
+ load_config();
+
+ pid_t pid, sid;
+
+ if (daemonize) {
+ syslog(LOG_INFO, "starting daemon");
+
+ pid = fork();
+ if (pid < 0) {
+ exit(EXIT_FAILURE);
+ }
+ if (pid > 0) {
+ exit(EXIT_SUCCESS);
+ }
+ umask(0);
+ sid = setsid();
+ if (sid < 0) {
+ exit(EXIT_FAILURE);
+ }
+ if ((chdir("/")) < 0) {
+ exit(EXIT_FAILURE);
+ }
+ close(STDIN_FILENO);
+ close(STDOUT_FILENO);
+ close(STDERR_FILENO);
+ }
+ //FIXME: output errors to stderr, change order
+ pidFilehandle = open((char *)pidfilename.c_str(), O_RDWR|O_CREAT, 0600);
+ if (pidFilehandle == -1 )
+ {
+ syslog(LOG_INFO, "Could not open pidfile %s, exiting", (char *)pidfilename.c_str());
+ fprintf(stderr, "Could not open pidfile %s, exiting", (char *)pidfilename.c_str());
+ exit(EXIT_FAILURE);
+ }
+ if (lockf(pidFilehandle,F_TLOCK,0) == -1)
+ {
+ syslog(LOG_INFO, "Could not lock pidfile %s, exiting", (char *)pidfilename.c_str());
+ fprintf(stderr, "Could not lock pidfile %s, exiting", (char *)pidfilename.c_str());
+ exit(EXIT_FAILURE);
+ }
+ sprintf(pidstr,"%d\n",getpid());
+ c = write(pidFilehandle, pidstr, strlen(pidstr));
+
+ int knxthread, olathread, workerthread;
+ pthread_t threads[NUM_THREADS];
+ // PTHREAD_CREATE_DETACHED?
+ knxthread = pthread_create(&threads[1], NULL, knxhandler, NULL); //id, thread attributes, subroutine, arguments
+ olathread = pthread_create(&threads[2], NULL, olahandler, NULL); //id, thread attributes, subroutine, arguments
+ workerthread = pthread_create(&threads[3], NULL, worker, NULL); //id, thread attributes, subroutine, arguments
+ syslog(LOG_DEBUG,"Threads created: %d %d %d",knxthread, olathread, workerthread);
+ //TODO: Maybe another console/TCP-server/Logging thread?
+ while (1) {
+// syslog(LOG_DEBUG, "%s daemon running", DAEMON_NAME);
+ sleep(POLLING_INTERVAL);
+ }
+ syslog(LOG_INFO, "%s daemon exiting", DAEMON_NAME);
+ // TODO: Free any allocated resources before exiting - we never get here though -> signal handler
+ exit(EXIT_SUCCESS);
+}
Added: tools/knxdmxd/knxdmxd.conf
===================================================================
--- tools/knxdmxd/knxdmxd.conf (rev 0)
+++ tools/knxdmxd/knxdmxd.conf 2012-05-07 18:51:21 UTC (rev 794)
@@ -0,0 +1,50 @@
+{ "fixtures": [
+ { "name" : "Treppe",
+ "channels" : [
+ { "name": "oben",
+ "knx" : "1/7/170",
+ "dmx" : "1.0"
+ },
+ { "name": "mitte",
+ "knx" : "1/7/170",
+ "dmx" : "1.1"
+ },
+ { "name": "unten",
+ "knx" : "1/7/170",
+ "dmx" : "1.2"
+ }
+ ],
+ "fading" : {
+ "knx" : "1/6/170",
+ "time": "1.7"
+ }
+ },
+ { "name" : "Kueche",
+ "channels" : [
+ { "name": "R",
+ "knx" : "1/7/141",
+ "dmx" : "1.10"
+ },
+ { "name": "G",
+ "knx" : "1/7/142",
+ "dmx" : "1.11"
+ },
+ { "name": "B",
+ "knx" : "1/7/143",
+ "dmx" : "1.12"
+ }
+ ],
+ "fading" : {
+ "knx" : "1/6/141",
+ "time": "3.0"
+ }
+ },
+ { "name" : "Test",
+ "channels" : [
+ { "name": "TestC",
+ "knx": "1/7/170",
+ "dmx" : "1.100"
+ }
+ ]
+ } ]
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jum...@us...> - 2012-06-06 11:10:02
|
Revision: 861
http://openautomation.svn.sourceforge.net/openautomation/?rev=861&view=rev
Author: jumi2006
Date: 2012-06-06 11:09:51 +0000 (Wed, 06 Jun 2012)
Log Message:
-----------
Added Paths:
-----------
tools/d0-IEC62056-meter/
tools/d0-IEC62056-meter/iec62056-meter.pl
Added: tools/d0-IEC62056-meter/iec62056-meter.pl
===================================================================
--- tools/d0-IEC62056-meter/iec62056-meter.pl (rev 0)
+++ tools/d0-IEC62056-meter/iec62056-meter.pl 2012-06-06 11:09:51 UTC (rev 861)
@@ -0,0 +1,145 @@
+#!/usr/bin/perl
+# Zaehlerabfrage fuer Zaehler nach Protokoll IEC 62056-21 / OBIS
+# Ein Anfrage-Telegramm ist mit 300 Baud, 7 Bit, 1 Stoppbit
+# und gerader Paritaet zu senden. Das ist der Initialmodus von Geraeten,
+# die das Protokoll IEC 62056-21 implementieren.
+# Ein Wechsel der Geschwindigkeit ist umgesetzt.
+# Basis des Scripts von volkszaehler.org / Autor: Andreas Schulze & Bugfix: Eric Schanze
+# DPT9 sub: makki / www.knx-user-forum.de
+# Baudwechsel: panzaeron / www.knx-user-forum.de
+# Erweiterung um RRD,KNX-Anbindung und gezielte Wertsuche auf Wiregate:
+# JuMi2006 / www.knx-user-forum.de
+# Version: 0.1.5
+# Datum: 02.06.2012
+
+use warnings;
+use strict;
+use RRDs;
+
+### KONFIGURATION ###
+my $device = "/dev/Zaehler_HZ"; #Port (/dev/ttyUSB...)
+my $rrdpath = "/var/www/rrd"; #Pfad fuer RRDs
+my $counterid = "HZ"; #Grundname fuer RRDs
+my $baudrate = "4800"; #Baudrate fuer Zaehlerauslesung
+my %channels = ( #Obis-Zahl => Gruppenadresse
+ "16.7"=>"6/1/1", #akt. Leistung
+ "32.7"=>"6/1/11", #Spannung L1
+ "52.7"=>"6/1/21", #Spannung L2
+ "31.7"=>"6/1/10", #Stromstaerke L1
+ "51.7"=>"6/1/20", #Stromstaerke L2
+ "71.7"=>"6/1/30", #Stromstarke L3
+ "72.7"=>"6/1/32", #Spannung L3
+ "1.8.1"=>"6/1/0" #Zaehlerstand gesamt
+ );
+my @countermodes = (5,15,60,1440); #Aufloesungen fuer COUNTER RRDs in Minuten (1440 = Tagesverbrauch)
+
+### ENDE KONFIGURATION ###
+
+my %speedrate = ( #Je nach Geschwindigkeit andere Befehel an Zaehler senden
+ "300"=>"'\x06\x30\x30\x30\x0d\x0a'",
+ "600"=>"'\x06\x30\x31\x30\x0d\x0a'",
+ "1200"=>"'\x06\x30\x32\x30\x0d\x0a'",
+ "2400"=>"'\x06\x30\x33\x30\x0d\x0a'",
+ "4800"=>"'\x06\x30\x34\x30\x0d\x0a'",
+ "9600"=>"'\x06\x30\x35\x30\x0d\x0a'"
+ );
+
+my $ack = $speedrate{$baudrate};
+#print ($baudrate,"->",$ack);
+
+### DATEN EMPFANGEN ###
+my @buffer = qx(echo '\x2f\x3f\x21\x0d\x0a' | socat -T 1 - $device,raw,echo=0,b300,parenb=1,parodd=0,cs7,cstopb=0; sleep 1; echo $ack | socat -T 1 - $device,raw,echo=0,b300,parenb=1,parodd=0,cs7,cstopb=0; socat -T 1 - $device,raw,echo=0,b$baudrate,parenb=1,parodd=0,cs7,cstopb=0);
+#print @buffer;
+
+foreach (@buffer)
+{
+ foreach my $obis(%channels)
+ {
+ my $obiskey = $obis."\(";
+ if ($_ =~ /\Q$obiskey\E/)
+ {
+ $_ =~ m/[^(]+\(([^*]+)\*([^)]+)/;
+ my $value = $1;
+ my $unit = $2;
+ my $ga = $channels{$obis};
+ print ($obis,"\n");
+ print ($value,"\n");
+ print ($unit,"\n");
+ print ($ga,"\n");
+ if ($unit =~ /\Qh\E/)
+ {
+ &rrd_counter ($obis,$value)
+ }
+ else
+ {
+ &rrd_gauge ($obis,$value)
+ }
+ &knx_write ($ga,$value);
+ }
+ }
+}
+
+### SUBS ###
+
+sub rrd_counter
+{
+print ("COUNTER","\n");
+foreach (@countermodes)
+{
+my $obisname = $_[0];
+my $value = $_[1];
+$obisname =~ tr/./-/;
+my $rrdname = $counterid."_".$obisname."_".$_."\.rrd";
+print ($rrdname,"\n");
+my $rrdfile = $rrdpath."\/".$rrdname;
+unless (-e $rrdfile)
+{
+RRDs::create ($rrdfile,"DS:value:COUNTER:".(($_*60)+600).":0:10000000000","RRA:AVERAGE:0.5:1:365","RRA:AVERAGE:0.5:7:300","-s ".($_*60));
+}
+my $countervalue = int($value*$_*60);
+RRDs::update("$rrdfile", "N:$countervalue");
+}
+}
+
+sub rrd_gauge
+{
+print ("GAUGE","\n");
+my $obisname = $_[0];
+my $value = $_[1];
+$obisname =~ tr/./-/;
+my $rrdname = $counterid."_".$obisname."\.rrd";
+print ($rrdname,"\n");
+my $rrdfile = $rrdpath."\/".$rrdname;
+unless (-e $rrdfile)
+{
+RRDs::create ($rrdfile,"DS:value:GAUGE:900:0:10000000000","RRA:AVERAGE:0.5:1:2160","RRA:AVERAGE:0.5:5:2016","RRA:AVERAGE:0.5:15:2880","RRA:AVERAGE:0.5:60:8760");
+}
+RRDs::update("$rrdfile", "N:$value");
+}
+
+sub knx_write
+{
+### Wert in DPT9 umwandeln und in Konsole ausgeben
+my @hexdec = encode_dpt9($_[1]);
+my $hexval = sprintf("%x", $hexdec[0]) . " " . sprintf("%x", $hexdec[1]);
+print ($hexval,"\n");
+system("groupwrite ip:localhost $_[0] $hexval");
+}
+
+sub encode_dpt9
+{
+# 2byte signed float
+my $state = shift;
+my $data;
+my $sign = ($state <0 ? 0x8000 : 0);
+my $exp = 0;
+my $mant = 0;
+$mant = int($state * 100.0);
+while (abs($mant) > 2047)
+{
+$mant /= 2;
+$exp++;
+}
+$data = $sign | ($exp << 11) | ($mant & 0x07ff);
+return $data >> 8, $data & 0xff;
+}
Property changes on: tools/d0-IEC62056-meter/iec62056-meter.pl
___________________________________________________________________
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2014-02-18 20:04:37
|
Revision: 2082
http://sourceforge.net/p/openautomation/code/2082
Author: makki1
Date: 2014-02-18 20:04:34 +0000 (Tue, 18 Feb 2014)
Log Message:
-----------
Add qHSmon
Added Paths:
-----------
tools/qHSMon/
tools/qHSMon/HSMonitor.ico
tools/qHSMon/LICENSE.GPL
tools/qHSMon/Makefile
tools/qHSMon/Makefile.Debug
tools/qHSMon/Makefile.Release
tools/qHSMon/README.de.txt
tools/qHSMon/README.txt
tools/qHSMon/debug/
tools/qHSMon/images/
tools/qHSMon/images/config.png
tools/qHSMon/images/copy.png
tools/qHSMon/images/cut.png
tools/qHSMon/images/new.png
tools/qHSMon/images/open.png
tools/qHSMon/images/paste.png
tools/qHSMon/images/save.png
tools/qHSMon/main.cpp
tools/qHSMon/qHSMon.pro
tools/qHSMon/qHSMon.pro.user
tools/qHSMon/qHSMon.rc
tools/qHSMon/release/
tools/qHSMon/res.qrc
tools/qHSMon/window.cpp
tools/qHSMon/window.h
Added: tools/qHSMon/HSMonitor.ico
===================================================================
(Binary files differ)
Index: tools/qHSMon/HSMonitor.ico
===================================================================
--- tools/qHSMon/HSMonitor.ico 2014-02-18 03:35:15 UTC (rev 2081)
+++ tools/qHSMon/HSMonitor.ico 2014-02-18 20:04:34 UTC (rev 2082)
Property changes on: tools/qHSMon/HSMonitor.ico
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: tools/qHSMon/LICENSE.GPL
===================================================================
--- tools/qHSMon/LICENSE.GPL (rev 0)
+++ tools/qHSMon/LICENSE.GPL 2014-02-18 20:04:34 UTC (rev 2082)
@@ -0,0 +1,675 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+...
[truncated message content] |
|
From: <ma...@us...> - 2012-06-25 21:03:46
|
Revision: 895
http://openautomation.svn.sourceforge.net/openautomation/?rev=895&view=rev
Author: makki1
Date: 2012-06-25 21:03:39 +0000 (Mon, 25 Jun 2012)
Log Message:
-----------
smstools - simple php for plugin - 1/2
Added Paths:
-----------
tools/scripts/
tools/scripts/sendsms.php
Added: tools/scripts/sendsms.php
===================================================================
--- tools/scripts/sendsms.php (rev 0)
+++ tools/scripts/sendsms.php 2012-06-25 21:03:39 UTC (rev 895)
@@ -0,0 +1,141 @@
+<?php
+/*
+ * small PHP to post SMS into smstools3/smsd
+ * make sure you have an sms-flat if this is open ;)
+ * (C) 2012 Michael Markstaller and see below: signed off by me: either freeware or GPL
+ *
+ * this script (www-data) needs write-access to /var/spool/sms/outgoing!
+ *
+ * based on various sources on the net, see:
+ * http://smstools3.kekekasvi.com/index.php?p=fileformat
+ * http://smstools3.kekekasvi.com/topic.php?id=384
+ * http://smstools3.kekekasvi.com/topic.php?id=320
+ * http://mteixeira.wordpress.com/2010/03/11/email-to-sms-gateway-in-linux/
+ */
+$to = "017x"; // default-number if not in post/get
+$use_utf = true;
+
+if ($use_utf)
+ header('Content-type: text/html; charset=UTF-8');
+print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">
+<html>
+<head>
+<title>SMS Test</title>
+<!-- <meta http-equiv=\"Content-Type\" content=\"text/html;charset=iso-8859-15\"> -->
+</head>
+<body>
+";
+if ($use_utf)
+ print "<font size='1'>Raw header used to set charset to UTF-8</font><br><br>\n";
+$charset = $_POST['charset'] ? $_POST['charset'] : $_GET['charset'];
+$text = $_POST['text'] ? $_POST['text'] : $_GET['text'];
+$to = $_POST['to'] ? $_POST['to'] : $_GET['to'];
+
+if ($charset != "" && $text != "")
+{
+ print "
+ charset: $charset<br>
+ text: $text<br>
+";
+
+ $filename = "/var/spool/sms/outgoing/smstest-" .str_replace(".", "", uniqid(mt_rand(), true));
+ if (($handle = fopen($filename .".LOCK", "w")) != false)
+ {
+ $l = strlen($st = "To: $to\n");
+ fwrite($handle, $st);
+ if ($charset == "UNICODE")
+ {
+ $l += strlen($st = "Alphabet: UCS\n");
+ fwrite($handle, $st);
+ $text = mb_convert_encoding($text, "UCS-2BE", "UTF-8");
+ }
+ else
+ if ($charset == "ISO")
+ $text = mb_convert_encoding($text, "ISO-8859-15", "UTF-8");
+ if ($_POST['flash'] != "")
+ {
+ $l += strlen($st = "Flash: yes\n");
+ fwrite($handle, $st);
+ }
+ /* do we need this? questionable.. */
+ $l += strlen($st = "Adjustment: +");
+ fwrite($handle, $st);
+ $pad = 14 - $l % 16 + 16;
+ while ($pad-- > 0)
+ fwrite($handle, "+");
+ fwrite($handle, "\n\n$text");
+ fclose($handle);
+
+ if (($handle = fopen($filename .".LOCK", "r")) == false)
+ print "Unable to read message file.<br>";
+ else
+ {
+ print "<hr><pre>\n";
+ while (!feof($handle))
+ echo fgets($handle, 1024);
+ print "</pre>\n";
+ fclose($handle);
+ }
+
+ $tmpfilename = tempnam("/tmp", "smstest-");
+ exec("/usr/bin/hexdump -C < $filename.LOCK > $tmpfilename");
+ if (($handle = fopen($tmpfilename, "r")) == false)
+ print "Unable to create dump.<br>";
+ else
+ {
+ print "<hr><pre>\n";
+ while (!feof($handle))
+ echo fgets($handle, 1024);
+ print "</pre>\n";
+ fclose($handle);
+ unlink($tmpfilename);
+ }
+
+ if ($_POST['showonly'] == "")
+ {
+ if (rename($filename .".LOCK", $filename) == true)
+ print "Message placed to the spooler,<br>filename: $filename<br>\n";
+ else
+ print "FAILED!<br>\n";
+ }
+ else
+ unlink($filename .".LOCK");
+ }
+ else
+ print "FAILED!<br>\n";
+
+ if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
+ $result = 'https://';
+ else
+ $result = 'http://';
+ $result .= $_SERVER['HTTP_HOST'] .$_SERVER['PHP_SELF'];
+ print "<hr><a href='$result'>Back</a>\n";
+}
+else
+{
+ print " <form name='test' id='test' method='post'";
+ if ($use_utf)
+ print " accept-charset='UTF-8'";
+ print ">
+ Send a message using:<br>
+ <input type='radio' name='charset' value='ISO' checked>ISO<br>
+ <input type='radio' name='charset' value='UNICODE'>UNICODE<br>
+ <input type='radio' name='charset' value='Unmodified'>No charset conversion here<br>
+ <br>
+ <input type='checkbox' name='flash' value='Y'>Flash<br>
+ <input type='checkbox' name='showonly' value='Y' checked>Show only the message file dump<br>
+ <br>
+ To:<br>
+ <input type='text' name='to' maxlength='70' value='$to' size='40'>
+ Text:<br>
+ <input type='text' name='text' maxlength='150' value='This is a test message.' size='40'>
+ <br>
+ <input type='submit' value='Submit'>
+ </form>
+";
+}
+print "
+</body>
+</html>
+";
+?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jum...@us...> - 2012-10-31 15:30:52
|
Revision: 1087
http://openautomation.svn.sourceforge.net/openautomation/?rev=1087&view=rev
Author: jumi2006
Date: 2012-10-31 15:30:38 +0000 (Wed, 31 Oct 2012)
Log Message:
-----------
* initial commit of ebus-project
* todo: build a stable ebus daemon for various devices
* buggy but working ebus-connection to wiregate via perl
Added Paths:
-----------
tools/ebus/
tools/ebus/perl/
tools/ebus/perl/eBus_plugin.pl
tools/ebus/perl/ebusd.pl
Added: tools/ebus/perl/eBus_plugin.pl
===================================================================
--- tools/ebus/perl/eBus_plugin.pl (rev 0)
+++ tools/ebus/perl/eBus_plugin.pl 2012-10-31 15:30:38 UTC (rev 1087)
@@ -0,0 +1,669 @@
+# Beta fuer eBus-Anbindung von Heizungen/Waermepumpen
+# Diese Beta bezieht sich auf eine Vaillant VWS 82-3 Waermepumpe
+# Fuer jeden Befehl wurde vorher eine sub erstellt die die Daten an die richtige Stelle setzt und
+# richtig codiert. Dies laesst sich bestimmt noch schlanker gestalten in dem man die Konfigurationszeilen erweitert.
+# Der generelle Aufbau eines eBus-Telegramms: QQ ZZ PB SB NN DB1...DBx CRC
+# QQ = Quelladresse, ZZ = Zieladresse, PB = Primaerbefehl, SB = Sekundarbefehl, NN = Anzahl der Datenbytes, DB1...DBx = Datenbytes, CRC = Checksummenbyte.
+# Teils liegen die Daten die es zu senden gibt an unterschiedlichen Stellen, in der Konfiguration sind diese dann leer (z.B. DB2="").
+#
+# Wiregte-Socket-Einstellungen:
+# Socket 1: "-" und "Socket: /dev/ttyUSB0" (hier eigenen Adapter) und "Optionen: raw,b2400,echo=0"
+# Socket 1: "udp-datagram" und "Socket: localhost:50110 und "Optionen: bind=localhost:50111,reuseaddr"
+# aktiviert und bidirektional
+#
+# Das Perl-Modul EBus.pm muss installiert sein, vergleiche hierzu:
+# http://knx-user-forum.de/253728-post64.html
+#
+# Ein separater eBus-Daemon ist erforderlich !!!
+#
+# 29.10.2012
+# JuMi2006 (http://knx-user-forum.de)
+# Version 0.2
+#return;
+
+$plugin_info{$plugname.'_cycle'} = 300;
+use warnings;
+use strict;
+use EBus;
+
+my ($string,$data,@data,$QQ,$ZZ,$PB,$SB,$DB,$DB1);
+my $debug = 2; # 0=zero log messages / 1=all log messages / 2=only value messages
+
+################################
+#### Vaillant Konfiguration ####
+################################
+# QQ = Quelle ; ZZ = Ziel ; PB = Primarbefehl ; SB = Sekundaerbefehl ; DB = Anzhal Datenbytes ; DB1 = Datenbyte 1 ff.
+# name = Name der Sub in der die Befehle entschl\x9Fsselt werden
+# FIXME !!! Nicht f\x9Fr jeden Befehl eine neue Sub erstellen, alle Daten in der Konfiguration ablegen
+
+my @sets;
+push @sets, { name => "RT_soll", GA => "0/5/101", QQ => "FF", ZZ => "50", PB => "B5", SB => "05", DB => "02", DB1 => "01", DB2 => "" };
+push @sets, { name => "RT_min", GA => "0/5/102", QQ => "FF", ZZ => "50", PB => "B5", SB => "05", DB => "02", DB1 => "0A", DB2 => "" };
+
+push @sets, { name => "HK_mode", GA => "0/5/110", QQ => "FF", ZZ => "50", PB => "B5", SB => "05", DB => "02", DB1 => "02", DB2 => "" };
+push @sets, { name => "HK_party", GA => "0/5/111", QQ => "FF", ZZ => "50", PB => "B5", SB => "05", DB => "02", DB1 => "05", DB2 => "" };
+push @sets, { name => "HK_spar", GA => "0/5/112", QQ => "FF", ZZ => "50", PB => "B5", SB => "05", DB => "02", DB1 => "07", DB2 => "" };
+
+push @sets, { name => "WW_mode", GA => "0/5/120", QQ => "FF", ZZ => "25", PB => "B5", SB => "09", DB => "04", DB1 => "0E", DB2 => "2B", DB3 => "00", DB4 => ""};
+push @sets, { name => "WW_soll", GA => "0/5/121", QQ => "FF", ZZ => "25", PB => "B5", SB => "09", DB => "05", DB1 => "0E", DB2 => "82", DB3 => "00", DB4 => "", DB5 => "" };
+push @sets, { name => "WW_min", GA => "0/5/122", QQ => "FF", ZZ => "25", PB => "B5", SB => "09", DB => "05", DB1 => "0E", DB2 => "82", DB3 => "00", DB4 => "", DB5 => "" };
+push @sets, { name => "WW_load", GA => "0/5/123", QQ => "10", ZZ => "FE", PB => "B5", SB => "05", DB => "02", DB1 => "06", DB2 => "" };
+
+push @sets, { name => "HK_curve", GA => "0/5/131", QQ => "FF", ZZ => "50", PB => "B5", SB => "05", DB => "03", DB1 => "0B", DB2 => "", DB3 => "00" };
+push @sets, { name => "AT_off", GA => "0/5/132", QQ => "FF", ZZ => "50", PB => "B5", SB => "09", DB => "04", DB1 => "0E", DB2 => "36", DB3 => "00", DB4 => "", DB5 => "00" };
+push @sets, { name => "HK_int", GA => "0/5/133", QQ => "10", ZZ => "08", PB => "B5", SB => "05", DB => "05", DB1 => "0E", DB2 => "7C", DB3 => "00", DB4 => "", DB5 => "FF" };
+
+push @sets, { name => "HOL_temp", GA => "0/5/140", QQ => "FF", ZZ => "FE", PB => "B5", SB => "05", DB => "02", DB1 => "2A", DB2 => ""};
+push @sets, { name => "HOL_date", GA => "0/5/141", QQ => "FF", ZZ => "FE", PB => "B5", SB => "0B", DB => "08", DB1 => "01", DB2 => "Nr", DB3 => "ST", DB4 => "SM", DB5 => "SJ", DB6 => "ET", DB7 => "EM", DB8 => "EJ"};###FIXME DATATYP
+
+push @sets, { name => "ZH_hk", GA => "0/5/151", QQ => "FF", ZZ => "08", PB => "B5", SB => "09", DB => "04", DB1 => "0E", DB2 => "63", DB3 => "00", DB4 => "" };
+push @sets, { name => "ZH_ww", GA => "0/5/152", QQ => "FF", ZZ => "08", PB => "B5", SB => "09", DB => "04", DB1 => "0E", DB2 => "64", DB3 => "00", DB4 => "" };
+push @sets, { name => "ZH_int", GA => "0/5/153", QQ => "FF", ZZ => "08", PB => "B5", SB => "09", DB => "04", DB1 => "0E", DB2 => "63", DB3 => "00", DB4 => "" }; #FIXME
+push @sets, { name => "ZH_hys", GA => "0/5/154", QQ => "FF", ZZ => "08", PB => "B5", SB => "09", DB => "05", DB1 => "0E", DB2 => "7E", DB3 => "00", DB4 => "", DB5 => "00" }; #FIXME
+### Ende Vaillant Konfiguration ###
+
+################################
+#### Konfiguration einlesen ####
+################################
+foreach my $set (@sets) {
+$plugin_subscribe{$set->{GA}}{$plugname} = 1; # An Gruppenadresse anmelden
+
+if ($msg{'apci'} eq "A_GroupValue_Write" && $msg{'dst'} eq $set->{GA} && defined $msg{'value'}) # Auf eintreffendes KNX-Telegramm reagiern + anhand der GA filtern
+
+{
+my $val = $msg{'value'}; # Wert aus Telegramm filtern
+my $subname = $set->{name}; # $subname bekommt den Namen der entsprecheden sub
+my $subref = \&$subname; # jetzt wird $subref die entsprechende sub zugewiesen
+plugin_log($plugname, "Befehlsgruppe: $set->{name} Value: $val"); # Logging der Befehlsgruppe
+my $command = addCRC(&$subref($val)); # Befehls-Sub ausf\xFChren und CRC anh\xE4ngen
+
+&send ($command."AA"); # Befehl senden
+#&send ($command); # Befehl senden
+}
+}
+
+#########################################
+#### P L U G I N - S o c k e t ##########
+#### Writes collected Data to Plugin ####
+#########################################
+# socat - udp:localhost:50201 ###########
+
+my $socknum = 1000;
+my $daemon_recv_ip = "localhost"; # Empfangsport (UDP, siehe in Socket-Einstellungen)
+my $daemon_recv_port = "50201"; # Empfangsport (UDP, siehe in Socket-Einstellungen)
+
+if (!$socket[1000]) { # socket erstellen
+ $socket[1000] = IO::Socket::INET->new(
+ Proto => "udp",
+ LocalAddr => $daemon_recv_ip,
+ LocalPort => $daemon_recv_port,
+ reuseaddr => 1
+ )
+ or return ("open of $daemon_recv_ip : $daemon_recv_port failed: $!");
+
+ $socksel->add($socket[1000]); # add socket to select
+ $plugin_socket_subscribe{$socket[1000]} = $plugname; # subscribe plugin
+ plugin_log($plugname,'Socket verbunden. Daemon-Plugin Socket Nummer: ' . 1000);
+ #return "opened Socket 1000";
+}
+
+#############################################
+#### e B U S - S o c k e t ##################
+#### Reads and writes "hot" to SerialPort ###
+#############################################
+# socat /dev/ttyUSB0,raw,b2400,echo=0 udp-datagram:localhost:50110,bind=localhost:50111,reuseaddr
+
+my $socknum = 999;
+my $send_ip = "localhost"; # Sendeport (UDP, siehe in Socket-Einstellungen)
+my $send_port = "50111"; # Sendeport (UDP, siehe in Socket-Einstellungen)
+my $recv_ip = "localhost"; # Empfangsport (UDP, siehe in Socket-Einstellungen)
+my $recv_port = "50110"; # Empfangsport (UDP, siehe in Socket-Einstellungen)
+
+### Socket einrichten ###
+
+if (!$socket[999]) { # socket erstellen
+$socket[999] = IO::Socket::INET->new(
+ Proto => "udp",
+ PeerAddr => $send_ip,
+ PeerPort => $send_port,
+ LocalAddr => $recv_ip,
+ LocalPort => $recv_port,
+ ReuseAddr => 1
+ )
+ or return ("open of $recv_ip : $recv_port failed: $!");
+
+ $socksel->add($socket[999]); # add socket to select
+#
+# $plugin_socket_subscribe{$socket[$socknum]} = $plugname; # subscribe plugin
+ plugin_log($plugname,'Socket verbunden. eBus-Socket Nummer: ' . 999);
+# return "opened Socket $socknum";
+}
+###
+
+###############
+### M A I N ###
+###############
+
+###############################
+#### R E C I V E D A T A #####
+###############################
+
+if ($fh) # Auf ankommende UDP-Daten reagieren (socket_subscribe)
+{
+my $recived = <$fh>; # Einlesen Zeilenweile
+
+ # DEBUG-MESSAGES-START
+ if ($debug == "1"){
+ my $len = length $recived; # Laenge feststellen (DEBUG)
+ plugin_log($plugname,"Length of FH: $len"); # L\x8Ange ausgeben
+ plugin_log($plugname,"$recived")} # empfangene Daten ausgeben
+ # DEBUG-MESSAGES-END
+
+my @strings = split(/SYNC/, $recived); # Datenpacket in Array packen. Separator is "SYNC" -> comes from daemon !!!
+
+foreach my $string (@strings) # Jedes Telegram aus dem Array durchlaufen
+{
+ # DEBUG-MESSAGES-START
+ if ($debug == "1")
+ {plugin_log($plugname,"$string"); # Telegramm ausgeben (QQZZPBSB....)
+ my $string_format =~ s/(.{2})/$1/g; # Telegramm formatieren
+ plugin_log($plugname,"Telegramm: $string") # Telegramm formatiert ausgeben (QQ ZZ PB SB ...)
+ }
+ # DEBUG-MESSAGES-END
+
+ &check($string); # Telegramm an die Sub zum auswerten (&check) uebergeben
+}
+}
+
+###################
+### S E N D E N ###
+###################
+
+sub send {
+if ($debug = 1) {plugin_log($plugname, "Sub Senden erreicht !");}
+my $cmd = shift;
+my $sync = 0;
+ while ($sync < 2)
+ {
+ my $buf;
+ recv($socket[999],$buf,1,0); # unbuffered read from socket
+ #recv($socket[$socknum],$buf,1,0); # unbuffered read from socket
+ #read($socket[$socknum],$buf,1);
+ my $bufhex = $buf;
+ $bufhex =~ s/(.)/sprintf("%.2X",ord($1))/eg;
+ plugin_log($plugname, "Buffer: $bufhex");
+ #if ($debug == "2") { plugin_log($plugname, "Buffer: $bufhex");}
+
+ if ($bufhex eq "AA") # AA = SYNC ... hier warten wir jetzt auf das SYNC Zeichen und senden dann
+ {
+ $sync++;
+ plugin_log($plugname, "Sync Zeichen gelesen");
+ #if ($debug == "2") { plugin_log($plugname, "Sync Zeichen gelesen");}
+ my $raw = $cmd;
+ $raw =~ s/([0-9a-f]{2})/chr( hex( $1 ) )/gie; # !!! Umwandlung des Hex-Strings
+ plugin_log($plugname, "send: $cmd");
+ #if ($debug == "2") { plugin_log($plugname, "send: $cmd");}
+ syswrite($socket[999], $raw);
+ select(undef, undef, undef, 1.5);
+ #last; # Nun aber raus aus der Schleife
+ }
+ else
+ {redo;}
+ }
+
+}
+
+
+##################################
+#### V A I L L A N T S U B S ####
+##################################
+#lassen sich bestimmt noch optimieren in dem man die Konfiguration etwas erweitert
+
+### Sparen bis ... 30min = 0,5 Stunden (21:30Uhr = 21,5) ###
+sub HK_spar
+{
+foreach my $set(@sets){
+if ($set->{name} eq "HK_spar")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+$val = encode_d1c ($val);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$val;
+return $message;
+}
+}
+}
+###
+
+### Ferientemperatur ###
+sub HOL_temp
+{
+foreach my $set(@sets){
+if ($set->{name} eq "HOL_temp")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+$val = encode_d1b ($val);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$val;
+return $message;
+}
+}
+}
+###
+
+### Raumtemperatur Soll ###
+sub RT_soll
+{
+foreach my $set(@sets){
+if ($set->{name} eq "RT_soll")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+$val = encode_d1b ($val);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$val;
+return $message;
+}
+}
+}
+###
+
+### Raumtemperatur Absenkung ###
+sub RT_min
+{
+foreach my $set(@sets){
+if ($set->{name} eq "RT_min")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+$val = encode_d1b ($val);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$val;
+return $message;
+}
+}
+}
+###
+
+### 1-Heizen, 2-Aus, 3-Auto, 4-Eco, 5-Absenken ###
+sub HK_mode
+{
+foreach my $set(@sets){
+if ($set->{name} eq "HK_mode")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",int($input));
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$val;
+return $message;
+}
+}
+}
+###
+
+### Heizkurve 0,20 etc ###
+sub HK_curve
+{
+foreach my $set(@sets){
+if ($set->{name} eq "HK_curve")
+{
+my $input = $_[0];
+$input *= 100;
+my $val = (sprintf "%02d",$input);
+$val = encode_d1b($val);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$val.$set->{DB3};
+return $message;
+}
+}
+}
+###
+
+### 0-Partymodus aus, 1-Partymodus an ###
+sub HK_party
+{
+foreach my $set(@sets){
+if ($set->{name} eq "HK_party")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$val;
+return $message;
+}
+}
+}
+###
+
+### Betriebsmodus WW 1-aus, 2-an, 3-auto ###
+sub WW_mode
+{
+foreach my $set(@sets){
+if ($set->{name} eq "WW_mode")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$set->{DB2}.$set->{DB3}.$val;
+return $message;
+}
+}
+}
+###
+
+### 0-Speicherladung abbrechen, 1-Speicherladung ###
+sub WW_load
+{
+foreach my $set(@sets){
+if ($set->{name} eq "WW_load")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$val;
+return $message;
+}
+}
+}
+###
+
+
+### Energieintegral setzen ###
+sub HK_int
+{
+foreach my $set(@sets){
+if ($set->{name} eq "HK_int")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+$val = encode_d1b($val);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$set->{DB2}.$set->{DB3}.$val.$set->{DB3};
+return $message;
+}
+}
+}
+###
+
+### Au\xDFentemperatur Abschaltgrenze ###
+sub AT_off
+{
+foreach my $set(@sets){
+if ($set->{name} eq "AT_off")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+$val = encode_d1b($val);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$set->{DB2}.$set->{DB3}.$val.$set->{DB3};
+return $message;
+}
+}
+}
+###
+
+### Solltemperatur WW-Speicher ###
+sub WW_soll
+{
+foreach my $set(@sets){
+if ($set->{name} eq "WW_soll")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+$val = encode_d2c($val);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$set->{DB2}.$set->{DB3}.$val;
+return $message;
+}
+}
+}
+###
+
+### Min.-Temperatur WW-Speicher ###
+sub WW_min
+{
+foreach my $set(@sets){
+if ($set->{name} eq "WW_min")
+{
+my $input = $_[0];
+my $val = (sprintf "%02d",$input);
+$val = encode_d2c($val);
+my $message = $set->{QQ}.$set->{ZZ}.$set->{PB}.$set->{SB}.$set->{DB}.$set->{DB1}.$set->{DB2}.$set->{DB3}.$val;
+return $message;
+}
+}
+}
+###
+
+
+############################
+#### S U B F I L T E R ####
+############################
+# Prueft die UDP-Daten auf verwertbare Datens\x8Atze
+
+sub check {
+$string = shift;
+chomp $string;
+my @bytes = $string =~ /..?/sg; # Telegramm in einzelne Bestandteile zerlegen -> Array
+if ($debug == "1"){plugin_log($plugname,"String: @bytes")}
+$QQ = $bytes[0]; # Quelladresse
+$ZZ = $bytes[1]; # Zieladresse
+$PB = $bytes[2]; # Primaerbefehl
+$SB = $bytes[3]; # Sekundaerbefehl
+$DB = $bytes[4]; # Anzahl DatenBytes
+$DB1 = $bytes[5]; # Erstes Datenbyte zur Typunterscheidung von Telegrammen
+
+$data = substr $string,8,((2*$DB)+2); # Datenbytes extrahieren
+my @data_bytes = $data =~ /..?/sg; # Datenbytes in Array ablegen $data_bytes[0] = Anzahl der Datenbytes
+
+
+### Read Values ###
+# Datum/Uhrzeit 10FEB516080000(58)(08)(28)(10)(07)(12)C7
+if ($SB eq 16 && $DB == 8){
+ my $ss = $data_bytes[2];
+ my $mm = $data_bytes[3];
+ my $hh = $data_bytes[4];
+ my $dd = $data_bytes[5];
+ my $mon = $data_bytes[6];
+ my $yy = $data_bytes[8];
+ my $wday = $data_bytes[7];
+if ($debug == "1"){plugin_log($plugname,"Datenbytes:@data_bytes")};
+if ($debug == "2" or $debug == "1"){plugin_log($plugname,"datetime: $dd.$mon.$yy $hh:$mm:$ss")};
+}
+
+
+# Vorlauf SOLL: 1008B510090002(32)000000000002 DATA1c
+if ($SB == 10 && $DB == 9){
+ my $val = decode_d1c($data_bytes[3]);
+if ($debug == "1"){plugin_log($plugname,"Datenbytes:@data_bytes")}
+if ($debug == "2" or $debug == "1"){plugin_log($plugname,"Vorlauf SOLL: $val Grad")}
+knx_write("0/5/202", $val, 9.001); # GA,Wert,DPT
+}
+
+# Vorlauf K\x89ltekreis IST: 1008B5042700(15)00 DATA1b
+if ($SB == 5 && $DB == 4 && $DB1 == 27){
+ my $val = decode_d1b($data_bytes[3],$data_bytes[4]);
+if ($debug == "1"){plugin_log($plugname,"Datenbytes:@data_bytes")}
+if ($debug == "2" or $debug == "1"){plugin_log($plugname,"Kaeltekreis Vorlauf: $val Grad")}
+knx_write("0/5/203", $val, 9.001); # GA,Wert,DPT
+}
+
+# WW / Heizen: 1008B50427(00)1500
+if ($SB == 5 && $DB == 4 && $DB1 == 27){
+
+ my $val = $data_bytes[2];
+if ($debug == "1"){plugin_log($plugname,"Datenbytes:@data_bytes")}
+if ($val == 0)
+{
+if ($debug == "2" or $debug == "1"){plugin_log($plugname,"Betriebsart: Heizbetrieb")}
+}
+else
+{
+if ($debug == "2" or $debug == "1"){plugin_log($plugname,"Betriebsart: Warmwasser")}
+}}
+
+# Aussentemperatur: 10FE070009(F009)043813161001 DATA2b
+if ($PB == 7 && $SB == 0 && $DB == 9){
+
+ my $val = decode_d2b($data_bytes[1],$data_bytes[2]);
+if ($debug == "1"){plugin_log($plugname,"Datenbytes:@data_bytes")}
+if ($debug == "2" or $debug == "1"){plugin_log($plugname,"Aussentemperatur: $val Grad")}
+knx_write("0/5/200", $val, 9.001); # GA,Wert,DPT
+}
+
+###SEARCH FOR INFO###
+# 1008B509040E....
+if ($SB == 9 && $DB == 4){
+plugin_log($plugname,"search B50904$data_bytes[1]: $data_bytes[2] $data_bytes[3] $data_bytes[4]")
+}
+
+###SEARCH FOR INFO###
+# 1008B5090329....
+if ($SB == 9 && $DB == 3 && $DB1 == 29){
+plugin_log($plugname,"search B50903$data_bytes[1]: $data_bytes[2] $data_bytes[3]")
+}
+
+###SEARCH FOR INFO###
+# Befehl auf dem Bus ???
+if ($QQ eq "FF"){
+plugin_log($plugname,"Befehl gelesen: $string")
+}
+
+### End Read Values ####
+
+#my $telegrams = plugin_info($plugname,"eBus")#;
+#my @known = split(/\n/, $telegrams); #Array aus $telegrams erstellen/auslesen##
+#
+#if ( grep /^$string$/, @known ) {
+# # vorhanden
+#}
+#else {
+# push @known,$string;
+#}
+#
+#$telegrams = join ("\n",@known);
+#plugin_info($plugname,"eBus") = $telegrams;
+#plugin_log($plugname,"$telegrams");
+###LOG to FILE
+#my $file='/root/temp.log';
+#open (in,"<$file") || die $!;
+#while (<in>){
+#$_= @lines;
+#}
+#close in;
+
+
+
+
+}
+
+
+############################################
+### D A T E N K O N V E R T I E R U N G ####
+############################################
+
+
+### BCD ###
+#FIX ME !!!!!
+
+#sub decode_bcd {
+# return (unpack "H*", pack "C*",hex($_[0]));
+# #unpack "H*", $_[0]; ####?????
+#}
+
+sub decode_bcd {
+ my $z = $_[0];
+ my $high = hex($z) >> 4;
+ my $low = hex($z) & 15;
+ return $high * 10 + $low;
+}
+
+sub encode_bcd {
+ return pack 'H*', join '', $_[0];
+}
+
+### DATA1b ###
+
+sub decode_d1b{ #1byte signed
+ my $val = hex(shift);
+ return $val > 127 ? $val-256 : $val;
+}
+
+sub encode_d1b { #### F I X M E !!!!!
+ my $y = shift;
+ $y *= 256;
+ $y = $y & 0xffff if ($y < 0);
+ my $hb = int $y/256;
+ return (sprintf("%0.2X", $hb));
+}
+
+
+### DATA1c ###
+
+sub decode_d1c {
+my $y = hex ($_[0])/2;
+return $y;
+}
+
+sub encode_d1c {
+ return sprintf "%x",(($_[0])*2);
+}
+
+
+### DATA2b ###
+
+sub decode_d2b {
+ return unpack("s", pack("s", hex($_[1].$_[0]))) / 256;
+}
+
+sub encode_d2b {
+ my ($hb, $lb) = unpack("H[2]H[2]", pack("s", $_[0] * 256));
+ return $lb.$hb;
+}
+
+### alternativ
+#sub decodex_d2b{
+# my $hb = hex($_[0]);
+# my $lb = hex($_[1]);
+#
+# if ($hb & 0x80) {
+# return -( (~$hb & 255) + ((~$lb & 255) + 1)/256 );
+# }
+# else {
+# return $hb + $lb/256;
+# }
+#}
+#
+#sub encodex_d2b {
+# my $y = shift;
+# $y *= 256;
+# $y = $y & 0xffff if ($y < 0);
+# my $hb = int $y/256;
+# my $lb = $y % 256;
+# return (sprintf("%0.2X", $hb), sprintf("%0.2X", $lb));
+#}
+
+
+### DATA2c ###
+
+sub decode_d2c{
+my $high = $_[1];
+my $low = $_[0];
+return unpack("s",(pack("H4", $low.$high)))/16;
+}
+
+sub encode_d2c{
+my $val = $_[0];
+my $temp_hex = unpack("H4", pack("n", ($val)*16));
+# change lowbyte/highbyte -> lowbyte first
+return substr($temp_hex,2,4).substr($temp_hex,0,2);
+}
+
+
+####################
+### A D D C R C ###
+####################
+
+### CRC hinzufuegen
+sub addCRC
+{
+my $string = $_[0];
+my $temp_string = pack("H*","$string"); ### geht auch!
+my $crc = new EBus();
+my $check = $crc->calcCrcExpanded($temp_string);
+my $crcfinal = uc(sprintf("%02x", $check));
+my $finalStr = $string.$crcfinal;
+}
+###
+
+return;
\ No newline at end of file
Property changes on: tools/ebus/perl/eBus_plugin.pl
___________________________________________________________________
Added: svn:eol-style
+ native
Added: tools/ebus/perl/ebusd.pl
===================================================================
--- tools/ebus/perl/ebusd.pl (rev 0)
+++ tools/ebus/perl/ebusd.pl 2012-10-31 15:30:38 UTC (rev 1087)
@@ -0,0 +1,123 @@
+#!/usr/bin/perl
+#############################
+### e B U S - D a e m o n ###
+#############################
+## Collect data via socat from SerialPort
+## alpha 1 by M.Hirsch
+## 2012-10
+#############################
+
+use warnings;
+use strict;
+use EBus;
+use IO::Socket::INET;
+
+
+my ($saw,$bufhex,$string,$string_format,$data,@data,$QQ,$ZZ,$PB,$SB,$DB,$DB1);
+my $bufold = '';
+my $buf;
+my $bufsum;
+my $bufnew;
+my $STALL_DEFAULT=20;
+my $timeout=$STALL_DEFAULT;
+
+#############################################
+#### e B U S - S o c k e t ##################
+#### Reads and writes "hot" to SerialPort ###
+#############################################
+# socat /dev/ttyUSB0,raw,b2400,echo=0 udp-datagram:localhost:50110,bind=localhost:50111,reuseaddr
+
+my $ebus_send_ip = "localhost"; # Sendeport (UDP, siehe in Socket-Einstellungen)
+my $ebus_send_port = "50111"; # Sendeport (UDP, siehe in Socket-Einstellungen)
+my $ebus_recv_ip = "localhost"; # Empfangsport (UDP, siehe in Socket-Einstellungen)
+my $ebus_recv_port = "50110"; # Empfangsport (UDP, siehe in Socket-Einstellungen)
+
+### Socket erstellen ###
+my $ebus_socket = IO::Socket::INET->new(
+ Proto => "udp",
+ LocalPort => $ebus_recv_port,
+ LocalAddr => $ebus_recv_ip,
+ PeerPort => $ebus_send_port,
+ PeerAddr => $ebus_send_ip,
+ ReuseAddr => 1
+ )or die "Can't bind: $@\n";
+
+
+#########################################
+#### P L U G I N - S o c k e t ##########
+#### Writes collected Data to Plugin ####
+#########################################
+# socat - udp:localhost:50201 ###########
+
+my $plugin_send_ip = "localhost"; # Sendeport (UDP, siehe in Socket-Einstellungen)
+my $plugin_send_port = "50201"; # Sendeport (UDP, siehe in Socket-Einstellungen)
+
+### Socket erstellen ###
+my $plugin_socket = IO::Socket::INET->new(
+ Proto => "udp",
+ #LocalPort => $recv_port,
+ #LocalAddr => $recv_ip,
+ PeerPort => $plugin_send_port,
+ PeerAddr => $plugin_send_ip,
+ ReuseAddr => 1
+ )or die "Can't bind: $@\n";
+
+
+
+#################
+#### M A I N ####
+#################
+
+
+while ($timeout > 0) { # FIXME !!!
+
+$saw = read($ebus_socket,$buf,512); # Liest 255 Zeichen je Durchlauf aus
+
+my $bufhex = $buf;
+$bufhex =~ s/(.)/ sprintf '%02X', ord $1 /seg;
+$bufhex =~ s/aaa/a\n/gi;
+$bufhex =~ s/aa/\n/gi;
+$bufnew = $bufhex;
+$bufsum = $bufold.$bufnew;
+
+my @array = split("\n", $bufsum);
+my $lastelement=$array[-1]; # letztes Element im Array suchen und nachher einfach wieder vorne anhaengen
+$bufold = "\n".$lastelement; # hier wird das letzte Element (evtl. nur ein Bruchstueck) vorn angehangen
+pop @array; # letztes Element aus dem Array entfernen *maybe incomplete
+foreach my $element (@array)
+{
+&output($element);
+chomp $element
+}
+my $packet = join("SYNC",@array);
+syswrite($plugin_socket, ($packet."\n"));
+ foreach my $string (@array)
+ {
+ #&check($string); # only for debugging
+ }
+#}
+}
+
+#########################################
+#### S U B F O R D E B U G G I N G ####
+#########################################
+sub output {
+my $element = shift;
+print ($element,"\n");
+}
+
+
+sub check {
+$string = shift;
+my @bytes = $string =~ /..?/sg;
+$QQ = $bytes[0];
+$ZZ = $bytes[1];
+$PB = $bytes[2];
+$SB = $bytes[3];
+$DB = $bytes[4]; #Anzahl DatenBytes
+$DB1 = $bytes[5]; #Erstes Datenbyte zur Typunterscheidung von Telegrammen
+
+$data = substr $string,8,(2*$DB);
+my @data_bytes = $data =~ /..?/sg;
+#print (@data_bytes,"\n");
+}
\ No newline at end of file
Property changes on: tools/ebus/perl/ebusd.pl
___________________________________________________________________
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2013-01-12 17:12:35
|
Revision: 1321
http://openautomation.svn.sourceforge.net/openautomation/?rev=1321&view=rev
Author: makki1
Date: 2013-01-12 17:12:21 +0000 (Sat, 12 Jan 2013)
Log Message:
-----------
Initial commit of non-upstream eibd-clients and customized debian-packaging for bcusdk/eibd - this is just to track changes on these files
Modified Paths:
--------------
tools/ets4tools/ets4parser.pl
Added Paths:
-----------
tools/bcusdk/
tools/bcusdk/README
tools/bcusdk/debian/
tools/bcusdk/debian/Makefile.am
tools/bcusdk/debian/Makefile.in
tools/bcusdk/debian/bcusdk-build.dirs
tools/bcusdk/debian/bcusdk-build.install
tools/bcusdk/debian/changelog
tools/bcusdk/debian/compat
tools/bcusdk/debian/control
tools/bcusdk/debian/copyright
tools/bcusdk/debian/eibd-client-sources.dirs
tools/bcusdk/debian/eibd-client-sources.install
tools/bcusdk/debian/eibd-clients.dirs
tools/bcusdk/debian/eibd-clients.install
tools/bcusdk/debian/eibd-server.dirs
tools/bcusdk/debian/eibd-server.install
tools/bcusdk/debian/eibd-server.postinst
tools/bcusdk/debian/libeibclient-dev.dirs
tools/bcusdk/debian/libeibclient-dev.install
tools/bcusdk/debian/libeibclient0.dirs
tools/bcusdk/debian/libeibclient0.install
tools/bcusdk/debian/rules
tools/bcusdk/eibd/
tools/bcusdk/eibd/examples/
tools/bcusdk/eibd/examples/README
tools/bcusdk/eibd/examples/eibread-cgi.c
tools/bcusdk/eibd/examples/eibwrite-cgi.c
Added: tools/bcusdk/README
===================================================================
--- tools/bcusdk/README (rev 0)
+++ tools/bcusdk/README 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1 @@
+Directory to track changes of bcusdk/eibd which aren't upstream
Added: tools/bcusdk/debian/Makefile.am
===================================================================
--- tools/bcusdk/debian/Makefile.am (rev 0)
+++ tools/bcusdk/debian/Makefile.am 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,5 @@
+EXTRA_DIST= bcusdk-build.dirs compat eibd-clients.dirs eibd-client-sources.install libeibclient-dev.dirs \
+ bcusdk-build.install control eibd-clients.install eibd-server.dirs libeibclient-dev.install \
+ changelog copyright eibd-client-sources.dirs eibd-server.install rules libeibclient0.dirs \
+ libeibclient0.install
+
Added: tools/bcusdk/debian/Makefile.in
===================================================================
--- tools/bcusdk/debian/Makefile.in (rev 0)
+++ tools/bcusdk/debian/Makefile.in 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,359 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = debian
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ccbuild.m4 \
+ $(top_srcdir)/m4/ccforbuild.m4 \
+ $(top_srcdir)/m4/compileroption.m4 $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INDENT = @INDENT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVAC = @JAVAC@
+LDFLAGS = @LDFLAGS@
+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTH_CFLAGS = @PTH_CFLAGS@
+PTH_CPPFLAGS = @PTH_CPPFLAGS@
+PTH_LDFLAGS = @PTH_LDFLAGS@
+PTH_LIBS = @PTH_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TAR = @TAR@
+TAS = @TAS@
+TGCC = @TGCC@
+TLD = @TLD@
+TRANLIB = @TRANLIB@
+VERSION = @VERSION@
+XML2_CONFIG = @XML2_CONFIG@
+XML_CPPFLAGS = @XML_CPPFLAGS@
+XML_LIBS = @XML_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = bcusdk-build.dirs compat eibd-clients.dirs eibd-client-sources.install libeibclient-dev.dirs \
+ bcusdk-build.install control eibd-clients.install eibd-server.dirs libeibclient-dev.install \
+ changelog copyright eibd-client-sources.dirs eibd-server.install rules libeibclient0.dirs \
+ libeibclient0.install
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign debian/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign debian/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Added: tools/bcusdk/debian/bcusdk-build.dirs
===================================================================
--- tools/bcusdk/debian/bcusdk-build.dirs (rev 0)
+++ tools/bcusdk/debian/bcusdk-build.dirs 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,7 @@
+usr/bin
+usr/lib/bcusdk/lib
+usr/share/bcusdk/include
+usr/share/bcusdk/examples
+usr/share/bcusdk/ldscripts
+usr/share/bcusdk/xml
+
Added: tools/bcusdk/debian/bcusdk-build.install
===================================================================
--- tools/bcusdk/debian/bcusdk-build.install (rev 0)
+++ tools/bcusdk/debian/bcusdk-build.install 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,17 @@
+usr/share/bcusdk/include
+usr/share/bcusdk/ldscripts
+usr/share/bcusdk/xml
+usr/lib/bcusdk/lib
+usr/bin/build.ai
+usr/bin/build.img
+usr/bin/build.dev
+usr/bin/bcugen1
+usr/bin/bcugen2
+usr/bin/bcugen3
+usr/bin/embedprogid
+usr/bin/extractprogid
+usr/bin/gencitemplate
+usr/bin/viewimage
+usr/bin/loadimage
+usr/bin/imageedit
+usr/share/bcusdk/examples/*.xml
Added: tools/bcusdk/debian/changelog
===================================================================
--- tools/bcusdk/debian/changelog (rev 0)
+++ tools/bcusdk/debian/changelog 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,88 @@
+bcusdk (0.0.4+nmu18) unstable; urgency=low
+
+ * add delay in backend/usbif
+ * eibd on wg
+
+ -- Michael Markstaller <markstaller@elab18> Fri, 14 Oct 2011 18:40:16 +0200
+
+bcusdk (0.0.4+nmu17) unstable; urgency=low
+
+ * fix 16bit GA's in eibread-cgi
+
+ -- Michael Markstaller <markstaller@elab18> Sun, 27 Feb 2011 23:47:24 +0100
+
+bcusdk (0.0.4+nmu16) unstable; urgency=low
+
+ * current pu from git
+
+ -- Michael Markstaller <markstaller@elab18> Thu, 10 Feb 2011 12:52:43 +0100
+
+bcusdk (0.0.4+nmu15) unstable; urgency=low
+
+ * current pu from git (various small changes since Mar)
+
+ -- Michael Markstaller <markstaller@elab18> Tue, 28 Dec 2010 20:29:18 +0100
+
+bcusdk (0.0.4+nmu14) unstable; urgency=low
+
+ * eibread/write cgidie with json
+ * write with dpt0=raw
+
+ -- Michael Markstaller <markstaller@elab18> Thu, 26 Aug 2010 19:26:15 +0200
+
+bcusdk (0.0.4+nmu13) unstable; urgency=low
+
+ * changed eibread/write to new api
+
+ -- Michael Markstaller <markstaller@elab18> Wed, 04 Aug 2010 18:44:52 +0200
+
+bcusdk (0.0.4+nmu12) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * current pu - patch usb memleak
+
+ -- Michael Markstaller <markstaller@elab18> Tue, 16 Mar 2010 13:29:07 +0100
+
+bcusdk (0.0.4+nmu11) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Current git version with path for dups
+
+ -- Michael Markstaller <de...@wi...> Thu, 11 Mar 2010 15:36:45 +0100
+
+bcusdk (0.0.4) unstable; urgency=low
+
+ * Next release
+
+ -- Martin Koegler <mko...@au...> Wed, 17 Dec 2008 08:26:01 +0100
+
+bcusdk (0.0.3) unstable; urgency=low
+
+ * Next release
+
+ -- Martin Koegler <mko...@au...> Sat, 3 Nov 2007 21:35:12 +0100
+
+bcusdk (0.0.2.1) unstable; urgency=low
+
+ * Sync Version
+
+ -- Martin Koegler <mko...@au...> Mon, 4 Dec 2006 22:23:47 +0100
+
+bcusdk (0.0.2) unstable; urgency=low
+
+ * New version.
+
+ -- Martin Koegler <mko...@au...> Thu, 31 Oct 2006 12:00:00 +0100
+
+bcusdk (0.0.1) unstable; urgency=low
+
+ * New version.
+
+ -- Martin Koegler <mko...@au...> Sat, 10 Dec 2005 18:44:25 +0100
+
+bcusdk (0.0.0-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Martin Koegler <mko...@au...> Tue, 10 May 2005 18:42:21 +0200
+
Property changes on: tools/bcusdk/debian/changelog
___________________________________________________________________
Added: svn:executable
+ *
Added: tools/bcusdk/debian/compat
===================================================================
--- tools/bcusdk/debian/compat (rev 0)
+++ tools/bcusdk/debian/compat 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1 @@
+7
Added: tools/bcusdk/debian/control
===================================================================
--- tools/bcusdk/debian/control (rev 0)
+++ tools/bcusdk/debian/control 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,61 @@
+Source: bcusdk
+Section: devel
+Priority: extra
+Maintainer: Martin Koegler <mko...@au...>
+Build-Depends: debhelper (>= 7), cdbs, bzip2, bison, flex, libxml2-dev (>= 2.6.16), libpthsem-dev (>=2.0.8), indent
+Standards-Version: 3.8.3
+Homepage: http://www.auto.tuwien.ac.at/~mkoegler/index.php/bcusdk
+Vcs-Git: http://www.auto.tuwien.ac.at/~mkoegler/git/bcusdk.git
+
+Package: eibd-server
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Suggests: eibd-clients
+Description: eibd server
+ eibd is a daemon which supports connection to an EIB (KNX) network over various
+ interfaces. It provides its services over TCP/IP or Unix domain sockets.
+ It can also act as an EIBnet/IP server.
+ Note: Some backends may crash Linux 2.6 kernels before 2.6.11.
+
+Package: eibd-clients
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Suggests: eibd-server
+Description: eibd clients
+ Simple example programs to perform management tasks on a EIB system.
+
+Package: libeibclient0
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: eibd client library
+ A client library written in C to access the EIB bus over eibd.
+
+Package: libeibclient-dev
+Architecture: any
+Section: libdevel
+Depends: ${shlibs:Depends}, ${misc:Depends}, libeibclient0 (= ${binary:Version})
+Suggests: eibd-server
+Description: eibd client library
+ A client library written in C to access the EIB bus over eibd.
+
+Package: eibd-client-sources
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Suggests: libeibclient-dev
+Description: Sources of the eibd client programs
+ Provides the source of the eibd client programs as examples how to use
+ the eibd client library.
+
+
+Package: bcusdk
+Architecture: all
+Depends: ${misc:Depends}, eibd-server, eibd-clients, eibd-client-sources, libeibclient-dev, bcusdk-build
+Description: BCU SDK
+ Installs the complete BCU SDK (metapackage)
+
+Package: eibd-dbg
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: eibd binaries with debug-symbols
+ Binaries with debug-symbols
+
Property changes on: tools/bcusdk/debian/control
___________________________________________________________________
Added: svn:executable
+ *
Added: tools/bcusdk/debian/copyright
===================================================================
--- tools/bcusdk/debian/copyright (rev 0)
+++ tools/bcusdk/debian/copyright 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,49 @@
+This is a debian pakcage of a free BCU SDK for EIB.
+ This package is available at:
+
+ http://www.auto.tuwien.ac.at/~mkoegler/index.php/bcus
+
+Copyright: GNU General Public License
+Copyright (C) 2005-2010 Martin Koegler <mko...@au...>
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL-2'.
+
+The eibd client library as well as the header and include files
+for the BCU operation system have the following exception:
+
+ In addition to the permissions in the GNU General Public License,
+ you may link the compiled version of this file into combinations
+ with other programs, and distribute those combinations without any
+ restriction coming from the use of this file. (The General Public
+ License restrictions do apply in other respects; for example, they
+ cover modification of the file, and distribution when not linked into
+ a combine executable.)
+
+XML Schema files as well as DTD have the requirement:
+
+ Modified version of this specification must change the namespace.
+
+This means, that derived version must use a different the the
+namespace as the original version. It does not limit, that
+different derived versions may use the same (not original)
+namespace/version.
+
+The USB backend uses a heavily, modified version of libusb. It is
+under the GNU Lesser General Public License. On Debian GNU/Linux
+systems, the complete text can be found in
+`/usr/share/common-licenses/LGPL-2.1'.
+
+The official web site of libusb is:
+ http://libusb.sourceforge.net/
+
+--------------------------------------------------------------------
+In order to justify continuing development, it is helpful to have
+an idea of how many people are using this software. To contribute,
+please send a short mail to bc...@au... whether you
+find this software useful.
+
+Please note, that this is not requirement to use/modify/distribute the
+software.
+
+Martin Koegler <mko...@au...>
Added: tools/bcusdk/debian/eibd-client-sources.dirs
===================================================================
--- tools/bcusdk/debian/eibd-client-sources.dirs (rev 0)
+++ tools/bcusdk/debian/eibd-client-sources.dirs 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1 @@
+usr/share/bcusdk/examples
Added: tools/bcusdk/debian/eibd-client-sources.install
===================================================================
--- tools/bcusdk/debian/eibd-client-sources.install (rev 0)
+++ tools/bcusdk/debian/eibd-client-sources.install 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,3 @@
+usr/share/bcusdk/examples/*.c
+usr/share/bcusdk/examples/*.h
+
Added: tools/bcusdk/debian/eibd-clients.dirs
===================================================================
--- tools/bcusdk/debian/eibd-clients.dirs (rev 0)
+++ tools/bcusdk/debian/eibd-clients.dirs 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1 @@
+usr/bin
Added: tools/bcusdk/debian/eibd-clients.install
===================================================================
--- tools/bcusdk/debian/eibd-clients.install (rev 0)
+++ tools/bcusdk/debian/eibd-clients.install 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,52 @@
+usr/bin/busmonitor1
+usr/bin/busmonitor2
+usr/bin/vbusmonitor1
+usr/bin/vbusmonitor1poll
+usr/bin/vbusmonitor2
+usr/bin/groupread
+usr/bin/groupswrite
+usr/bin/groupwrite
+usr/bin/groupsresponse
+usr/bin/groupresponse
+usr/bin/grouplisten
+usr/bin/madcread
+usr/bin/maskver
+usr/bin/mmaskver
+usr/bin/mread
+usr/bin/mwrite
+usr/bin/mprogmodeon
+usr/bin/mprogmodeoff
+usr/bin/mprogmodestatus
+usr/bin/mprogmodetoggle
+usr/bin/progmodeon
+usr/bin/progmodeoff
+usr/bin/progmodestatus
+usr/bin/progmodetoggle
+usr/bin/mpropdesc
+usr/bin/mpropread
+usr/bin/mpropwrite
+usr/bin/mpropscan
+usr/bin/mpropscanpoll
+usr/bin/readindividual
+usr/bin/writeaddress
+usr/bin/mpeitype
+usr/bin/msetkey
+usr/bin/groupsocketlisten
+usr/bin/groupsocketread
+usr/bin/groupsocketwrite
+usr/bin/groupsocketswrite
+usr/bin/groupreadresponse
+usr/bin/groupcacheenable
+usr/bin/groupcachedisable
+usr/bin/groupcacheclear
+usr/bin/groupcacheremove
+usr/bin/groupcachereadsync
+usr/bin/groupcacheread
+usr/bin/groupcachelastupdates
+usr/bin/mrestart
+usr/bin/mwriteplain
+usr/bin/knxtool
+usr/bin/xpropread
+usr/bin/xpropwrite
+usr/bin/eibread-cgi
+usr/bin/eibwrite-cgi
Property changes on: tools/bcusdk/debian/eibd-clients.install
___________________________________________________________________
Added: svn:executable
+ *
Added: tools/bcusdk/debian/eibd-server.dirs
===================================================================
--- tools/bcusdk/debian/eibd-server.dirs (rev 0)
+++ tools/bcusdk/debian/eibd-server.dirs 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1 @@
+usr/bin
Added: tools/bcusdk/debian/eibd-server.install
===================================================================
--- tools/bcusdk/debian/eibd-server.install (rev 0)
+++ tools/bcusdk/debian/eibd-server.install 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,6 @@
+usr/bin/eibd
+usr/bin/bcuaddrtab
+usr/bin/bcuread
+usr/bin/eibnetdescribe
+usr/bin/eibnetsearch
+usr/bin/findknxusb
Added: tools/bcusdk/debian/eibd-server.postinst
===================================================================
--- tools/bcusdk/debian/eibd-server.postinst (rev 0)
+++ tools/bcusdk/debian/eibd-server.postinst 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,6 @@
+#! /bin/sh
+# postinst script for eibd-server
+
+if [ -e /etc/init.d/eibd ]; then
+ /etc/init.d/eibd restart
+fi
Property changes on: tools/bcusdk/debian/eibd-server.postinst
___________________________________________________________________
Added: svn:executable
+ *
Added: tools/bcusdk/debian/libeibclient-dev.dirs
===================================================================
--- tools/bcusdk/debian/libeibclient-dev.dirs (rev 0)
+++ tools/bcusdk/debian/libeibclient-dev.dirs 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,4 @@
+usr/include
+usr/lib
+usr/share/bcusdk
+usr/share/java
Added: tools/bcusdk/debian/libeibclient-dev.install
===================================================================
--- tools/bcusdk/debian/libeibclient-dev.install (rev 0)
+++ tools/bcusdk/debian/libeibclient-dev.install 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,9 @@
+usr/include
+usr/lib/libeibclient.la
+usr/lib/libeibclient.a
+usr/lib/libeibclient.so
+usr/share/bcusdk/eibclient.php
+usr/share/bcusdk/EIBConnection.cs
+usr/share/bcusdk/EIBConnection.pm
+usr/share/bcusdk/EIBConnection.py
+usr/share/bcusdk/EIBD.pas
Property changes on: tools/bcusdk/debian/libeibclient-dev.install
___________________________________________________________________
Added: svn:executable
+ *
Added: tools/bcusdk/debian/libeibclient0.dirs
===================================================================
--- tools/bcusdk/debian/libeibclient0.dirs (rev 0)
+++ tools/bcusdk/debian/libeibclient0.dirs 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1 @@
+usr/lib
Added: tools/bcusdk/debian/libeibclient0.install
===================================================================
--- tools/bcusdk/debian/libeibclient0.install (rev 0)
+++ tools/bcusdk/debian/libeibclient0.install 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1 @@
+usr/lib/libeibclient.so.*
Added: tools/bcusdk/debian/rules
===================================================================
--- tools/bcusdk/debian/rules (rev 0)
+++ tools/bcusdk/debian/rules 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,26 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+include /usr/share/cdbs/1/rules/utils.mk
+
+DEB_CONFIGURE_EXTRA_FLAGS := \
+ --enable-ft12 \
+ --enable-pei16 \
+ --enable-tpuart \
+ --enable-pei16s \
+ --enable-tpuarts \
+ --enable-eibnetip \
+ --enable-eibnetipserver \
+ --enable-groupcache \
+ --enable-usb \
+ --enable-eibnetiptunnel \
+ --enable-onlyeibd
+
+DEB_DH_STRIP_ARGS := -Xusr/lib/bcusdk/lib -Xusr/lib64/bcusdk/lib --dbg-package=eibd-dbg
+DEB_DH_INSTALL_SOURCEDIR := debian/tmp
+DEB_INSTALL_DOCS_ALL := README
+
+clean::
+ find -type l -exec rm {} \;
+ autoreconf -i
Property changes on: tools/bcusdk/debian/rules
___________________________________________________________________
Added: svn:executable
+ *
Added: tools/bcusdk/eibd/examples/README
===================================================================
--- tools/bcusdk/eibd/examples/README (rev 0)
+++ tools/bcusdk/eibd/examples/README 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,12 @@
+Additional eibd-clients for CV-Backend (eibread/write-cgi)
+
+Mini-Howto:
+* Checkout into bcusdk/eibd/examples
+
+* Adjust Makefile.am:
+-xpropread xpropwrite groupcachelastupdates
++xpropread xpropwrite groupcachelastupdates eibread-cgi eibwrite-cgi
+
+-xpropread.c xpropwrite.c groupcachelastupdates.c
++xpropread.c xpropwrite.c groupcachelastupdates.c eibread-cgi.c eibwrite-cgi.c
+
Added: tools/bcusdk/eibd/examples/eibread-cgi.c
===================================================================
--- tools/bcusdk/eibd/examples/eibread-cgi.c (rev 0)
+++ tools/bcusdk/eibd/examples/eibread-cgi.c 2013-01-12 17:12:21 UTC (rev 1321)
@@ -0,0 +1,403 @@
+/*
+ cgi for webserver to read groupcachelastupdates from comet/ajax client
+
+ Parameters:
+ url= (ip:host:port or local:/tmp/eib - local is default)
+ p=position
+ t=timeout (10000)
+ g=GA&g=GA... - groupadresses as x/y/z or integer
+
+ Copyright (C) 2010 Michael Markstaller <mm...@el...>
+ Copyright (C) 2005-2010 Martin Koegler <mko...@au...>
+
+ 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 2 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, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include "common.h"
+#include <ctype.h>
+#include <time.h>
+
+#include <string.h>
+#define MAX_POS...
[truncated message content] |
|
From: <jum...@us...> - 2013-03-09 12:09:15
|
Revision: 1559
http://openautomation.svn.sourceforge.net/openautomation/?rev=1559&view=rev
Author: jumi2006
Date: 2013-03-09 12:09:04 +0000 (Sat, 09 Mar 2013)
Log Message:
-----------
moved knxd from ebus directory to own knxd directory
Added Paths:
-----------
tools/knxd/
tools/knxd/etc/knxd/doc/
tools/knxd/etc/knxd/doc/ChangeLog
tools/knxd/etc/knxd/eBus_plugin.conf
tools/knxd/etc/knxd/knxd-ebus.csv
tools/knxd/etc/knxd/plugin/eBusd.pl
tools/knxd/etc/logrotate.d/
tools/knxd/usr/sbin/knxd.pl
Removed Paths:
-------------
tools/knxd/etc/knxd/doc/ChangeLog
tools/knxd/etc/knxd/eBus_plugin.conf
tools/knxd/etc/knxd/plugin/eBusd.pl
tools/knxd/usr/sbin/knxd.pl
Deleted: tools/knxd/etc/knxd/doc/ChangeLog
===================================================================
--- tools/ebus/knxd/etc/knxd/doc/ChangeLog 2013-02-18 19:39:15 UTC (rev 1505)
+++ tools/knxd/etc/knxd/doc/ChangeLog 2013-03-09 12:09:04 UTC (rev 1559)
@@ -1,10 +0,0 @@
-Perl - KNX Daemon (knxd) - ChangeLog
-===============================
-2013-02-17:
-* Changed telnet/ebusd-handling from IO::Socket:INET to Net::Telnet to prevent memleaks
-* added CYC (cyclic) support, usage: "cyc xxx xxx"
-* added sample knxd.csv ("knxd-ebus.csv")
-* added log rotate settings /etc/logrotate.d/
-
-2013-02-17:
-* Initial release
Copied: tools/knxd/etc/knxd/doc/ChangeLog (from rev 1507, tools/ebus/knxd/etc/knxd/doc/ChangeLog)
===================================================================
--- tools/knxd/etc/knxd/doc/ChangeLog (rev 0)
+++ tools/knxd/etc/knxd/doc/ChangeLog 2013-03-09 12:09:04 UTC (rev 1559)
@@ -0,0 +1,14 @@
+Perl - KNX Daemon (knxd) - ChangeLog
+===============================
+2013-02-19:
+* bugfix: highload while eib=0 fixed
+* try to minimize memleaks in knxd and plugin
+
+2013-02-17:
+* Changed telnet/ebusd-handling from IO::Socket:INET to Net::Telnet to prevent memleaks
+* added CYC (cyclic) support, usage: "cyc xxx xxx"
+* added sample knxd.csv ("knxd-ebus.csv")
+* added log rotate settings /etc/logrotate.d/
+
+2013-02-17:
+* Initial release
Deleted: tools/knxd/etc/knxd/eBus_plugin.conf
===================================================================
--- tools/ebus/knxd/etc/knxd/eBus_plugin.conf 2013-02-17 22:50:49 UTC (rev 1500)
+++ tools/knxd/etc/knxd/eBus_plugin.conf 2013-03-09 12:09:04 UTC (rev 1559)
@@ -1,7 +0,0 @@
-#### Einstellungen
-$config = "/tmp/testcfg.csv";
-$ip = '192.168.2.221'; #IP des ebusd
-$port = '8888'; #Port des ebusd
-$base_time = 120; #Abrufzyklus
-$debug = "";
-#### Ende Einstellungen
\ No newline at end of file
Copied: tools/knxd/etc/knxd/eBus_plugin.conf (from rev 1505, tools/ebus/knxd/etc/knxd/eBus_plugin.conf)
===================================================================
--- tools/knxd/etc/knxd/eBus_plugin.conf (rev 0)
+++ tools/knxd/etc/knxd/eBus_plugin.conf 2013-03-09 12:09:04 UTC (rev 1559)
@@ -0,0 +1,7 @@
+#### Einstellungen
+$config = "/etc/knxd/testcfg.csv";
+$ip = '192.168.2.221'; #IP des ebusd
+$port = '8888'; #Port des ebusd
+$base_time = 120; #Abrufzyklus
+$debug = "";
+#### Ende Einstellungen
\ No newline at end of file
Copied: tools/knxd/etc/knxd/knxd-ebus.csv (from rev 1505, tools/ebus/knxd/etc/knxd/knxd-ebus.csv)
===================================================================
--- tools/knxd/etc/knxd/knxd-ebus.csv (rev 0)
+++ tools/knxd/etc/knxd/knxd-ebus.csv 2013-03-09 12:09:04 UTC (rev 1559)
@@ -0,0 +1,15 @@
+#GA;DPT;RRD_TYPE;RRD_STEP;TYPE;CMD;COMMENT
+0/5/120;1;;;set;hw mode;WW/ Betriebsmodus
+0/5/121;9;;;set;hw temp;WW/ Solltemperatur
+0/5/111;1;;;set;short cir2_party;Quick/ Party-Modus
+0/5/110;1;;;set;short cir2_mode;Quick/ Heizkreis Betriebsmodus
+0/5/123;1;;;set;short hw_load;Quick - WW Speicherladung
+0/5/202;9;g;;get;ci cir2_set_temp;Heizkreis2-Solltemperatur
+0/5/203;12;c;24;get;ci yield_transfer;Mitternacht \x86bertragswert Energieertrag
+0/5/206;12;c;0.5;get;mv yield_sum;Energieertrag
+0/5/204;9;g;;get;mv brine_in temp;Quellentemperatur
+0/5/205;9;g;;get;mv brine_out temp;Austrittstemperatur
+0/5/201;9;g;;get;mv VF2_temp temp;Vorlauftemperatur VF2
+0/5/200;9;g;;get;mv at_temp temp;Aussentempertur
+0/5/102;9;g;;get;cir2 rt_day;Heizkreis \xD0 Raumsolltemperatur
+0/5/101;9;g;;set;cir2 rt_day;Heizkreis \xD0 Raumsolltemperatur
\ No newline at end of file
Deleted: tools/knxd/etc/knxd/plugin/eBusd.pl
===================================================================
--- tools/ebus/knxd/etc/knxd/plugin/eBusd.pl 2013-02-17 22:50:49 UTC (rev 1500)
+++ tools/knxd/etc/knxd/plugin/eBusd.pl 2013-03-09 12:09:04 UTC (rev 1559)
@@ -1,183 +0,0 @@
-#return;
-use warnings;
-use strict;
-use IO::Socket;
-
-### READ PLUGIN-CONF
-my ($config,$ip,$port,$base_time,$debug);
-&readConf;
-
-$plugin_info{$plugname.'_cycle'} = 60;
-$plugin_info{$plugname.'_number'} = 0 unless (defined $plugin_info{$plugname.'_number'});
-my (@gets,@sets,@cycs);
-
-### READ CONFIG
-my $id = 0;
-open (CFG,'<',$config) || die $!;
-while (<CFG>){
-if ($_ =~ /\#/){
-#if ($debug){plugin_log($plugname,"skipped line");}
-}
-else
-{
-chomp $_;
-#if ($debug){plugin_log($plugname,"line $_");}
-my @array = split (/;/,$_);
-my ($ga,$dpt,$rrd_type,$rrd_step,$type,$short,$comment) = @array;
-
-#possible this prevents a memleak
-@array = ();
-undef @array;
-#maybe !?
-
-###define @gets###
-if ($type eq "get" && ($ga or $rrd_type)){
- $id++;
- push @gets,{ga => $ga, dpt => $dpt, rrd_type => $rrd_type, rrd_step => $rrd_step, type => $type, short => $short, comment => $comment, id => $id};
-}
-###define @sets###
-if ($type eq "set" && $ga){
- push @sets,{ga => $ga, dpt => $dpt, rrd_type => $rrd_type, rrd_step => $rrd_step, type => $type, short => $short, comment => $comment, id => $id};
-}
-###define @cycs###
-if ($type eq "cyc" && ($ga or $rrd_type)){
- push @cycs,{ga => $ga, dpt => $dpt, rrd_type => $rrd_type, rrd_step => $rrd_step, type => $type, short => $short, comment => $comment, id => $id};
-}
-}
-}
-close CFG;
-
-### CREATE DYNAMIC PLUGIN-CYCLE
-$plugin_info{$plugname.'_cycle'} = $base_time/(@gets+1);
-my $commands = @gets;
-if ($debug){plugin_log($plugname,"Anzahl GET: $commands");}
-
-
-### OPEN SOCKET
-my $sock = new IO::Socket::INET (
-PeerAddr => $ip,
-PeerPort => $port,
-Proto => 'tcp');
-return "Error: $!" unless $sock;
-
-
-#### SET ###
-foreach my $set(@sets){
-$plugin_subscribe{$set->{ga}}{$plugname} = 1;
-if ($debug){plugin_log($plugname,"$set->{ga} subscribed \n")};
-}
-
-foreach my $set(@sets){
-if ($msg{'apci'} eq "A_GroupValue_Write" && $msg{'dst'} eq $set->{ga}){
- my $send_set = $set->{type}." ".$set->{short}." ".$msg{'value'}."\n" ;
- plugin_log($plugname,$send_set);
- print $sock ($send_set);
- my $answer = <$sock>;
- chomp $answer;
- $answer =~ s!\s!!g;
- plugin_log($plugname,"$set->{type} $set->{short} $msg{'value'} $answer");
-
- ### Check for Response
- foreach my $get (@gets){
- if ($get->{short} eq $set->{short}){
- print $sock ($get->{type}." ".$get->{short}."\n");
- my $answer = <$sock>;
- chomp $answer;
- $answer =~ s!\s!!g;
- plugin_log($plugname,"$get->{type} $get->{short} $answer");
- if ($answer =~ m/^[-+]?\d+(?:\.\d*)?(?:[eE][-+]?\d+(?:\.\d*)?)?$/ ) # check if $answer ist any number
- {knx_write($get->{ga},$answer,$get->{dpt});
- plugin_log($plugname,"$get->{ga} $answer $get->{dpt}");
- }
- #print $sock ("quit \n");
- #return;
- }}
- print $sock ("quit \n");
- #close $sock;
- return;
- }
-}
-
-####Response
-#
-#foreach my $get (@gets){
-#$plugin_subscribe{$get->{ga}}{$plugname} = 1;
-#if ($msg{'apci'} eq "A_GroupValue_Read" && $msg{'dst'} eq $get->{ga}){
-# plugin_log($plugname,"Response $msg{'apci'}");
-# my $get_send = $get->{type}." ".$get->{short}."\n";
-# print $sock ($get_send);
-# my $answer = <$sock>;
-# chomp $answer;
-# $answer =~ s!\s!!g;
-# plugin_log($plugname,"Response $get->{short} $answer");
-# if ($answer =~ m/^[-+]?\d+(?:\.\d*)?(?:[eE][-+]?\d+(?:\.\d*)?)?$/ ) # check if $answer ist any number
-# {knx_write($get->{ga},$answer,$get->{dpt},0x40)}
-# print $sock ("quit \n");
-#}
-#}
-
-#### GET ###
-$plugin_info{$plugname.'_number'}++; #increase number to read next
-
-
-foreach my $get (@gets){
-if ($plugin_info{$plugname.'_number'} > $commands) {$plugin_info{$plugname.'_number'} = 1}
-if ($get->{id} == $plugin_info{$plugname.'_number'}){
- if ($debug){plugin_log($plugname,"ID: $get->{id}");}
- if ($debug){plugin_log($plugname,"$get->{short}")};
- my $get_send = $get->{type}." ".$get->{short}."\n";
- print $sock ($get_send);
- my $answer = <$sock>;
- chomp $answer;
- $answer =~ s!\s!!g;
- plugin_log($plugname,"$get->{type} $get->{short} $answer");
- if ($answer =~ m/^[-+]?\d+(?:\.\d*)?(?:[eE][-+]?\d+(?:\.\d*)?)?$/ ) # check if $answer ist any number
- ###SEND KNX###
- {knx_write($get->{ga},$answer,$get->{dpt})}
-
- ###FILL/CREATE RRD###
- if ($get->{rrd_type} eq "c"){ #matches COUNTER
- $get->{short} =~ s/ /_/g; #replace spaces
- update_rrd ("eBus_".$get->{short},"",$answer,"COUNTER",$get->{rrd_step})
- }
- if ($get->{rrd_type} eq "g"){ #matches GAUGE
- $get->{short} =~ s/ /_/g; #replace spaces
- update_rrd ("eBus_".$get->{short},"",$answer)
- }
-
- print $sock ("quit \n");
- #close $sock;
-}
-}
-
-@sets = ();
-@gets = ();
-$sock = ();
-
-undef @gets;
-undef @sets;
-undef $sock;
-
-
-return "MBi ".$plugin_info{$plugname.'_meminc'};
-
-### READ CONF ###
-sub readConf
-{
- my $confFile = '/etc/knxd/eBus_plugin.conf';
- if (! -f $confFile) {
- plugin_log($plugname, "no conf file [$confFile] found.");
- } else {
- #plugin_log($plugname, "reading conf file [$confFile].");
- open(CONF, $confFile);
- my @lines = <CONF>;
- close($confFile);
- my $result = eval("@lines");
- #($result) and plugin_log($plugname, "conf file [$confFile] returned result[$result]");
- if ($@) {
- plugin_log($plugname, "ERR: conf file [$confFile] returned:");
- my @parts = split(/\n/, $@);
- plugin_log($plugname, "--> $_") foreach (@parts);
- }
- }
-}
\ No newline at end of file
Copied: tools/knxd/etc/knxd/plugin/eBusd.pl (from rev 1507, tools/ebus/knxd/etc/knxd/plugin/eBusd.pl)
===================================================================
--- tools/knxd/etc/knxd/plugin/eBusd.pl (rev 0)
+++ tools/knxd/etc/knxd/plugin/eBusd.pl 2013-03-09 12:09:04 UTC (rev 1559)
@@ -0,0 +1,200 @@
+#return;
+use warnings;
+use strict;
+use Net::Telnet ();
+
+
+#use Devel::Leak;
+####TRY MEMORY
+#my $handle; # apparently this doesn't need to be anything at all
+#my $leaveCount = 0;
+#my $enterCount = Devel::Leak::NoteSV($handle);
+##print STDERR "ENTER: $enterCount SVs\n";
+#plugin_log($plugname,"ENTER: $enterCount SVs");
+#$leaveCount = Devel::Leak::CheckSV($handle);
+##print STDERR "\nLEAVE: $leaveCount SVs\n";
+#plugin_log($plugname,"LEAVE: $leaveCount SVs");
+
+
+
+
+### READ PLUGIN-CONF
+my ($config,$ip,$port,$base_time,$debug);
+&readConf;
+#$debug = 1;
+
+$plugin_info{$plugname.'_cycle'} = 60;
+$plugin_info{$plugname.'_number'} = 0 unless (defined $plugin_info{$plugname.'_number'});
+my (@gets,@sets,$answer);
+
+### READ CONFIG
+### FIXME! try to read config only once until changed
+### Where to save the arrays ? Maybe global in knxd?
+my $id = 0;
+open (CFG,'<',$config) || die $!;
+while (<CFG>){
+if ($_ =~ /\#/){
+#if ($debug){plugin_log($plugname,"skipped line");}
+}
+else
+{
+chomp $_;
+#if ($debug){plugin_log($plugname,"line $_");}
+my @array = split (/;/,$_);
+my ($ga,$dpt,$rrd_type,$rrd_step,$type,$short,$comment) = @array;
+
+#possible this prevents a memleak
+@array = ();
+undef @array;
+#maybe !?
+
+###define @gets### includes cyclic
+if ($type ne "set" && ($ga or $rrd_type)){
+ $id++;
+ push @gets,{ga => $ga, dpt => $dpt, rrd_type => $rrd_type, rrd_step => $rrd_step, type => $type, short => $short, comment => $comment, id => $id};
+}
+###define @sets###
+if ($type eq "set" && $ga){
+ push @sets,{ga => $ga, dpt => $dpt, rrd_type => $rrd_type, rrd_step => $rrd_step, type => $type, short => $short, comment => $comment, id => $id};
+}
+}
+}
+close CFG;
+
+### CREATE DYNAMIC PLUGIN-CYCLE
+$plugin_info{$plugname.'_cycle'} = $base_time/(@gets+1);
+my $commands = @gets;
+if ($debug){plugin_log($plugname,"Anzahl GET-Komandos: $commands");}
+
+#### SET ###
+foreach my $set(@sets){
+$plugin_subscribe{$set->{ga}}{$plugname} = 1;
+if ($debug){plugin_log($plugname,"$set->{ga} subscribed \n")};
+}
+
+foreach my $set(@sets){
+if ($msg{'apci'} eq "A_GroupValue_Write" && $msg{'dst'} eq $set->{ga} && defined $msg{'value'}){
+ my $send_set = $set->{type}." ".$set->{short}." ".$msg{'value'} ;
+ plugin_log($plugname,$send_set);
+ $answer = send_ebusd ($send_set);
+ chomp $answer;
+ $answer =~ s!\s!!g;
+ plugin_log($plugname,"$set->{type} $set->{short} $msg{'value'} $answer");
+
+ ### Check for Response
+ foreach my $get (@gets){
+ if ($get->{short} eq $set->{short}){
+ my $send_get = $get->{type}." ".$get->{short};
+ $answer = send_ebusd ($send_get);
+ $answer =~ s!\s!!g;
+ plugin_log($plugname,"$get->{type} $get->{short} $answer");
+ if ($answer =~ m/^[-+]?\d+(?:\.\d*)?(?:[eE][-+]?\d+(?:\.\d*)?)?$/ ) # check if $answer ist any number
+ {knx_write($get->{ga},$answer,$get->{dpt});
+ plugin_log($plugname,"$get->{ga} $answer $get->{dpt}");
+ }
+ last;
+ }}
+ last;
+ }
+}
+
+####Response
+####FIXME !
+#### No surprise ... ists to slow ... but working
+#foreach my $get (@gets){
+#$plugin_subscribe{$get->{ga}}{$plugname} = 1;
+#if ($msg{'apci'} eq "A_GroupValue_Read" && $msg{'dst'} eq $get->{ga}){
+# plugin_log($plugname,"Response $msg{'apci'}");
+# my $send_get = $get->{type}." ".$get->{short};
+# $answer = send_ebusd ($send_get);
+# chomp $answer;
+# $answer =~ s!\s!!g;
+# plugin_log($plugname,"Response $get->{short} $answer");
+# if ($answer =~ m/^[-+]?\d+(?:\.\d*)?(?:[eE][-+]?\d+(?:\.\d*)?)?$/ ) # check if $answer ist any number
+# {knx_write($get->{ga},$answer,$get->{dpt},0x40)}
+#}
+#}
+
+#### GET ###
+
+$plugin_info{$plugname.'_number'}++; #increase number to read next value
+
+foreach my $get (@gets){
+if ($plugin_info{$plugname.'_number'} > $commands) {$plugin_info{$plugname.'_number'} = 1}
+if ($get->{id} == $plugin_info{$plugname.'_number'}){
+ if ($debug){plugin_log($plugname,"ID: $get->{id}");}
+ if ($debug){plugin_log($plugname,"$get->{short}")};
+ my $send_get = $get->{type}." ".$get->{short};
+ $answer = send_ebusd ($send_get);
+ chomp $answer;
+ $answer =~ s!\s!!g;
+ plugin_log($plugname,"$get->{type} $get->{short} $answer");
+ if ($answer =~ m/^[-+]?\d+(?:\.\d*)?(?:[eE][-+]?\d+(?:\.\d*)?)?$/ ) # check if $answer ist any number
+ ###SEND KNX###
+ {knx_write($get->{ga},$answer,$get->{dpt})}
+
+ ###FILL/CREATE RRD###
+ if ($get->{rrd_type} eq "c"){ #matches COUNTER
+ $get->{short} =~ s/ /_/g; #replace spaces
+ update_rrd ("eBus_".$get->{short},"",$answer,"COUNTER",$get->{rrd_step})
+ }
+ if ($get->{rrd_type} eq "g"){ #matches GAUGE
+ $get->{short} =~ s/ /_/g; #replace spaces
+ update_rrd ("eBus_".$get->{short},"",$answer)
+ }
+last;
+}
+}
+
+sub send_ebusd{
+ my $cmd = shift;
+ my $t = new Net::Telnet (Timeout => 10,
+ port => $port,
+ Prompt => '/\n/');
+ $t->open($ip);
+ if ($debug){plugin_log($plugname,"Sende:$cmd")};
+ my @answer = $t->cmd($cmd);
+ $answer = $answer[0];
+ $t->close;
+ ####possible this prevents a memleak
+ @answer = ();
+ undef @answer;
+ ####maybe !?
+ return $answer;
+ eval { close $t; };undef $t;
+}
+
+####possible this prevents a memleak
+@sets = ();
+@gets = ();
+undef @gets;
+undef @sets;
+####maybe !?
+
+
+return sprintf("%.2f",$plugin_info{$plugname.'_meminc'})." mb lost";
+
+### READ CONF ###
+sub readConf
+{
+ my $confFile = '/etc/knxd/eBus_plugin.conf';
+ if (! -f $confFile) {
+ plugin_log($plugname, "no conf file [$confFile] found.");
+ } else {
+ #plugin_log($plugname, "reading conf file [$confFile].");
+ open(CONF, $confFile);
+ my @lines = <CONF>;
+ close($confFile);
+ my $result = eval("@lines");
+ #($result) and plugin_log($plugname, "conf file [$confFile] returned result[$result]");
+ if ($@) {
+ plugin_log($plugname, "ERR: conf file [$confFile] returned:");
+ my @parts = split(/\n/, $@);
+ plugin_log($plugname, "--> $_") foreach (@parts);
+ }
+ }
+####possible this prevents a memleak
+@lines = ();
+undef @lines;
+####maybe !?
+}
\ No newline at end of file
Deleted: tools/knxd/usr/sbin/knxd.pl
===================================================================
--- tools/ebus/knxd/usr/sbin/knxd.pl 2013-02-17 22:50:49 UTC (rev 1500)
+++ tools/knxd/usr/sbin/knxd.pl 2013-03-09 12:09:04 UTC (rev 1559)
@@ -1,1093 +0,0 @@
-#!/usr/bin/perl -w
-# KNX Daemon - handling WireGate-Plugins and EIB
-# based on wiregated.pl by Michael Markstaller
-#
-# Cleanup and partially rewritten by M.Hirsch
-# http://knx-user-forum.de -> JuMi2006
-#
-# 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 2 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, write to the Free Software Foundation, Inc.,
-# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-
-use strict;
-use Math::Round;
-use Math::BaseCalc;
-use RRDs;
-use Getopt::Std;
-use Time::HiRes qw ( time alarm sleep usleep gettimeofday );
-getopts("dp:c:e:o:", \my %opts);
-use IO::Socket;
-use IO::Select;
-use FileHandle;
-use Proc::PID::File;
-# fork daemon
-use Proc::Daemon;
-Proc::Daemon::Init unless $opts{d};
-#use xPL::Client;
-use EIBConnection;
-use feature "switch";
-use File::Basename;
-use DB_File;
-
-no warnings 'uninitialized';
-
-sub LOGGER;
-
-# Options
-while ((my $key, my $value) = each %opts) {
- print "opt $key = $value\n" if ($opts{d});
-}
-
-# PID File-handling
-if ($opts{p} and Proc::PID::File->running()) {
- LOGGER("WARN","Already running");
- die();
- }
-
-# Config files
-# global
-my $config;
-if ($opts{c}) {
- LOGGER("INFO","Config-File is: $opts{c}");
- $config = $opts{c};
- } else {$config = "/etc/knxd/knxd.conf" }
-
-# eibga
-my $eib_config;
-if ($opts{c}) {
- LOGGER("INFO","eibga-File is: $opts{e}");
- $eib_config = $opts{e};
- } else {$eib_config = "/etc/knxd/eibga.conf" }
-
-# Read config #
-my %daemon_config;
-my $lastreadtime = 0;
-my %eibgaconf;
-my $udp_sock;
-my %ga_to_ow;
-my @eibga_types = qw (temp hum moisthum present light volt curr ch0 ch1 ch2 ch3 ch4 ch5 ch6 ch7 countA countB );
-
-if ((stat($config))[9] > $lastreadtime or (stat($eib_config))[9] > $lastreadtime) {
- if (-e $config) {
- LOGGER('INFO',"*** reading global config");
- my_read_cfg ($config, \%daemon_config);
- $lastreadtime = time();
- }
- if (-e $eib_config) {
- LOGGER('INFO',"*** reading eibga config");
- my_read_cfg ($eib_config,\%eibgaconf);
- }
- } else {
- #LOGDIE("unable to read config $config");
- print "unabled to read config $config";
- }
-
-
-# Definitions
-
-# config values
-
-my $cycle = $daemon_config{''}{'cycle'};
-my $sleeptime = $daemon_config{''}{'sleeptime_ms'};
-my $plugin_cycle = $daemon_config{''}{'plugin_cycle'};
-my $rrd_interval = $daemon_config{''}{'rrd_interval'};
-my $rra1_row = $daemon_config{''}{'rra_1_interval_rows'};
-my $rra5_row = $daemon_config{''}{'rra_5_interval_rows'};
-my $rra15_row = $daemon_config{''}{'rra_15_interval_rows'};
-my $rra180_row= $daemon_config{''}{'rra_180_interval_rows'};
-my $eib_logging = $daemon_config{''}{'eib_logging'};
-my $eib = $daemon_config{''}{'eib'};
-
-my $mem_max = $daemon_config{''}{'mem_max'};
-my $name = $daemon_config{''}{'name'};
-my $eib_url = $daemon_config{''}{'eib_url'};
-my $rrd_dir = $daemon_config{''}{'rrd_dir'};
-my $eiblogfile = $daemon_config{''}{'eiblogfile'};
-
-my $plugin_logfile = $daemon_config{''}{'plugin_logfile'};
-my $plugin_infofile = $daemon_config{''}{'plugin_infofile'};
-my $plugin_db_name = $daemon_config{''}{'plugin_db_name'};
-my $plugin_db_path = $daemon_config{''}{'plugin_db_path'};
-
-my $ramdisk = $daemon_config{''}{'ramdisk'};
-my $alive = $daemon_config{''}{'alive'};
-my $plugin_path = $daemon_config{''}{'plugin_path'};
-my $init_script = $daemon_config{''}{'init_script'};
-
-my $knxdebug = 0;
-
-# Plugins
-
-my %plugin_info;
-my %plugin_subscribe;
-my $plugin_initflag=0;
-my %plugin_socket_subscribe;
-
-# global definitions
-
-my $conv2bin = new Math::BaseCalc(digits => 'bin'); #Binary
-my $telegram_count = 0;
-my $telegram_bytes;
-my %msg;
-my @socket;
-my $socksel;
-
-my $looptime = time();
-my $looptimeavg = 0;
-my $laststatesaveime = 0;
-my $lastdirtime = 0;
-my $lastlooptime = 0;
-my $eib_tps = 50;
-my $telegram_count_check = 100;
-my $sendtime_last = 0;
-my $running = 1;
-my $thr_eiblisten_timeout = 0;
-my $thr_eiblisten_cause = "";
-
-sub getISODateStamp;
-
-
-### MAIN ###
-
-system ("touch ".$alive); # avoid timeout for init
-
-LOGGER('INFO',"Started with PID: $$ \n");
-
-$cycle=60 unless (defined $cycle and $cycle > 29); # minimum cycle 30 to avoid insane settings
-$sleeptime = 500 unless defined $sleeptime;
-$plugin_cycle= 60 unless defined $plugin_cycle;
-$eib_logging= 1 unless defined $eib_logging;
-$rrd_interval = 300 unless defined $rrd_interval;
-$rra1_row = 2160 unless defined $rra1_row;
-$rra5_row = 2016 unless defined $rra5_row;
-$rra15_row = 2880 unless defined $rra15_row;
-$rra180_row = 8760 unless defined $rra180_row;
-
-my $rrd_lastupdate = time()-($rrd_interval-+1);
-my $rrd_syslastupdate = time()-($rrd_interval-+1);
-
-# Copy Plugin-DB to ramdisk
-if (! -e $ramdisk.$plugin_db_name) {
- `cp $plugin_db_path$plugin_db_name $ramdisk$plugin_db_name`; }
-my $plugindb = tie %plugin_info, "DB_File", $ramdisk.$plugin_db_name, O_RDWR|O_CREAT, 0666, $DB_HASH
- or LOGGER('WARN',"Cannot open file 'plugin_info': $!");
-
-
-# GO
-&eiblisten_thread;
-
-#######################################
-#### K N O W N S U B S #####
-#######################################
-sub eiblisten_thread { # MAIN SUB
-$SIG{TERM} = sub {
- # -> Doesn't work when blocked by I/O!!
- LOGGER('DEBUG',"Thread eiblisten Caught TERM, exiting:". $thr_eiblisten_cause);
- system ("touch $alive"); # avoid timeout for init
- if($eib_logging) { close FILE_EIBLOG; }
- $plugindb->sync(); # write out
- `cp $ramdisk$plugin_db_name $plugin_db_path$plugin_db_name`;
- exit();
-};
-$SIG{KILL} = sub {
- # ende aus finito
- LOGGER('DEBUG',"Thread eiblisten Caught KILL, exiting:" .$thr_eiblisten_cause);
- system ("touch $alive"); # avoid timeout for init
- if($eib_logging) { close FILE_EIBLOG; }
- $plugindb->sync(); # write out
- `cp $ramdisk$plugin_db_name $plugin_db_path$plugin_db_name`;
- exit();
-};
-
-#FIXME: add plugin-timeout again with SIGALRM, currently we rely on monit (1 minute)
-
-if($eib_logging) {
- open FILE_EIBLOG, ">>$eiblogfile";
- print "Muss jetzt eibloggen";
-}
-
-# make it hot
-select((select(FILE_EIBLOG), $|=1)[0]);
-my $select = IO::Select->new();
-$socksel = IO::Select->new();
-my $retryinfo;
-my $lastplugintime;
-my $eibpoll = 1;
-my $eibsrc=EIBConnection::EIBAddr();
-my $eibdst=EIBConnection::EIBAddr();
-my $eibbuf2=EIBConnection::EIBBuffer();
-
-while ($running) {
- my $eibcon2;
- if ($eib == 1){
- $eibcon2 = EIBConnection->EIBSocketURL($eib_url);
- if (defined($eibcon2)) {
- $eibcon2->EIB_Cache_Enable();
- my $busmon = $eibcon2->EIBOpenVBusmonitor_async();
- LOGGER('INFO',"connected to eibd $eib_url");
- } else {
- LOGGER('INFO',"Cannot connect to eibd $eib_url") unless $retryinfo;
- }
- }
-
- while (($eibpoll and defined($eibcon2)) or ($eib == 0)) #try to disable eib
- {
- if ($eib ==1){
- $select->add($eibcon2->EIB_Poll_FD);
- if ($select->can_read(.5)) { # EIB Packet processing
- if ($eibpoll=$eibcon2->EIB_Poll_Complete) {
- my $msglen=$eibcon2->EIBGetBusmonitorPacket($eibbuf2);
- if ($msglen>1) {
- my %msg = decode_vbusmonitor($$eibbuf2);
- $retryinfo = 0;
- # case ReadRequest for configured owsensor-value
- if ($msg{'apci'} eq "A_GroupValue_Read" and $ga_to_ow{$msg{'dst'}}) {
- LOGGER('DEBUG',"---> Send reply for $msg{'dst'} $ga_to_ow{$msg{'dst'}}");
- send_sensor_response($msg{'dst'});
- }
- # case Write for PIO
- if ($msg{'apci'} eq "A_GroupValue_Write" and $ga_to_ow{$msg{'dst'}}) {
- set_sensor_value($msg{'dst'},$msg{'data'});
- }
-
- # Log it
- print FILE_EIBLOG getISODateStamp.",$msg{'apci'},$msg{'src'},$msg{'dst'},$msg{'data'},$msg{'value'}"
- .",$eibgaconf{$msg{'dst'}}{'DPT_SubTypeName'},$eibgaconf{$msg{'dst'}}{'DPTSubId'},$msg{'repeated'}"
- .",$msg{'class'},$msg{'rcount'},$msg{'tpdu_type'},$msg{'sequence'}\n" if($eib_logging);
- # Check EIB-connectivity and configchange every 100 telegrams?
- $telegram_count++;
-
- # Traffic on Bus in bytes (8+Nutzdaten)+ACK?
- $telegram_bytes += 9+(length(join('',split / /,$msg{'data'}))/2);
- #LOGGER('DEBUG',"Anz $telegram_count, Bytes $telegram_bytes");
-
- if ($msg{'apci'} eq "A_GroupValue_Read" and ($msg{'dst'} eq $daemon_config{''}{'sendtime_ga_time'})) {
- # send time response
- eibsend_time_resp($daemon_config{''}{'sendtime_ga_time'});
- }
- if ($msg{'apci'} eq "A_GroupValue_Read" and ($msg{'dst'} eq $daemon_config{''}{'sendtime_ga_date'})) {
- # send time response
- eibsend_date_resp($daemon_config{''}{'sendtime_ga_date'});
- }
- # check subscribed plugin
- if ($plugin_subscribe{$msg{'dst'}}) {
- #while( my ($k, $v) = each($plugin_subscribe{$msg{'dst'}}) ) {
- for my $k ( keys %{$plugin_subscribe{ $msg{'dst'} }} ) {
- LOGGER('DEBUG',"Running Plugin $k subscribed to $msg{'dst'}");
- $thr_eiblisten_timeout = time(); # set timeout
- check_generic_plugins($k,\%msg);
- }
- }
-
- } elsif ($msglen==414) {
- # process other?
- }
- }} # EIB Packet processing end, back in main loop
-
- }
- ###LOG continious Memory if DEBUG
- #if ($opts{d}) {
- # my @statinfo = get_stat_info($$);
- # LOGGER('DEBUG',"BOSS utime: " . $statinfo[0]/100 ." stime " . $statinfo[1]/100 ." rss: $statinfo[5]");
- #}
- #FIXME: output log-warning on memleak
- system ("touch $alive");
-
- # check plugins
- if (time()-$lastplugintime > 1) { # at most every 1secs for now
- $thr_eiblisten_timeout = time(); # set timeout
- &check_generic_plugins();
- $lastplugintime = time();
- # case update rrds
- &check_global_rrd_update;
- #Cleanup %plugin_subscribe from deleted!!!
- }
- if ($rrd_syslastupdate + $rrd_interval < time()) {
- my @statinfo = get_stat_info($$);
- update_rrd($name."_mem","",$statinfo[5]);
- update_rrd($name."_stime","",$statinfo[0],"COUNTER");
- update_rrd($name."_utime","",$statinfo[1],"COUNTER");
- update_rrd($name."_cutime","",$statinfo[2],"COUNTER");
- update_rrd($name."_cstime","",$statinfo[3],"COUNTER");
- $rrd_syslastupdate = time();
-
- # save plugin_db from ramdisk
- $plugindb->sync(); # write out
- `cp $ramdisk$plugin_db_name $plugin_db_path$plugin_db_name`;
-
- # if own memory is above mem_max -> restart via init.d
- if ($statinfo[5] >= $mem_max){
- LOGGER('INFO',"Process should be restarted: Memory is $statinfo[5] Mb - Limit is $mem_max Mb.");
- system ("$init_script restart");}
-
- }
-
- # Check if socket-handle is in select - or do this in plugin?
- if (my @sock_ready = $socksel->can_read(0.1)) {
- # process sockets ready to read
- foreach my $fh (@sock_ready) {
- if ($plugin_socket_subscribe{$fh}) {
- LOGGER('DEBUG',"Call plugin $plugin_socket_subscribe{$fh} subscribed for $fh");
- $thr_eiblisten_timeout = time(); # set timeout
- &check_generic_plugins($plugin_socket_subscribe{$fh},undef,$fh);
- } else {
- #else if - no plugin subscribed, remove select
- $socksel->remove($fh);
- LOGGER('DEBUG',"Removed orphaned socksel $fh");
- }
- }
- }
- # case cyclic time
- if ($daemon_config{''}{'sendtime_cycle'} and $daemon_config{''}{'sendtime_ga_time'} and $daemon_config{''}{'sendtime_ga_date'} and (time() - $sendtime_last > $daemon_config{''}{'sendtime_cycle'}) ) {
- # send time cyclic
- eibsend_date_time($daemon_config{''}{'sendtime_ga_date'},$daemon_config{''}{'sendtime_ga_time'});
- $sendtime_last = time();
- }
- }
-
-if ($eib == 1)
-{
-LOGGER('INFO',"eibd connection lost - retrying") unless $retryinfo;
-$retryinfo = 1;
-$eibpoll = 1;
-sleep 5;
-}
-}
-
-if($eib_logging) { close FILE_EIBLOG , ">>$eiblogfile"; }
-}
-
-
-sub getISODateStamp { # Timestamps for Logs
- my ($eseconds,$msec) = gettimeofday();
- my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime($eseconds);
- return sprintf "%04d-%02d-%02d %02d:%02d:%02d.%03d", ($yearOffset+1900),($month+1),$dayOfMonth,$hour,$minute,$second,$msec/1000;
-}
-
-sub check_generic_plugins {#check Plugins
- my $runname = $_[0];
- my %msg;
- my $fh;
- my $plugin_max_errors = 5;
- if (defined $_[1]) { %msg = %{$_[1]}; } else { %msg = (); }
- if (defined $_[2]) { $fh = $_[2]; } else { $fh = undef; }
- #%msg =() unless defined...
[truncated message content] |
|
From: <jum...@us...> - 2013-03-09 12:13:23
|
Revision: 1560
http://openautomation.svn.sourceforge.net/openautomation/?rev=1560&view=rev
Author: jumi2006
Date: 2013-03-09 12:13:16 +0000 (Sat, 09 Mar 2013)
Log Message:
-----------
*build packages for rrdtool and CometVisu on RaspberryPi
Added Paths:
-----------
tools/arm-deb/
tools/arm-deb/rrdtool_1.4.5-1_armel.deb
tools/arm-deb/rrdtool_1.4.5-1_armhf.deb
Added: tools/arm-deb/rrdtool_1.4.5-1_armel.deb
===================================================================
(Binary files differ)
Property changes on: tools/arm-deb/rrdtool_1.4.5-1_armel.deb
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: tools/arm-deb/rrdtool_1.4.5-1_armhf.deb
===================================================================
(Binary files differ)
Property changes on: tools/arm-deb/rrdtool_1.4.5-1_armhf.deb
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yu...@us...> - 2013-04-10 13:36:55
|
Revision: 1685
http://openautomation.svn.sourceforge.net/openautomation/?rev=1685&view=rev
Author: yuhu1
Date: 2013-04-10 13:36:48 +0000 (Wed, 10 Apr 2013)
Log Message:
-----------
Renamed ebus too ebusd
Added Paths:
-----------
tools/ebusd/
Removed Paths:
-------------
tools/ebus/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|