|
From: <ma...@us...> - 2012-03-26 21:42:52
|
Revision: 736
http://openautomation.svn.sourceforge.net/openautomation/?rev=736&view=rev
Author: makki1
Date: 2012-03-26 21:42:46 +0000 (Mon, 26 Mar 2012)
Log Message:
-----------
DMX-Plugin with response and (tab-fixing)
Modified Paths:
--------------
wiregate/plugin/generic/DMX-Plugin.pl
Modified: wiregate/plugin/generic/DMX-Plugin.pl
===================================================================
--- wiregate/plugin/generic/DMX-Plugin.pl 2012-03-26 17:11:17 UTC (rev 735)
+++ wiregate/plugin/generic/DMX-Plugin.pl 2012-03-26 21:42:46 UTC (rev 736)
@@ -1,5 +1,5 @@
# Plugin DMX-Gateway
-# Version: 0.4 2012-01-05
+# Version: 0.41 2012-03-26
# Ben\xF6tigt DMX USB-Interface
##################
@@ -45,33 +45,36 @@
# Hauptverarbeitung
if (!$socket[$socknum]) { # socket erstellen
$socket[$socknum] = IO::Socket::INET->new(LocalPort => $dmx_recv_port,
- Proto => "udp",
- LocalAddr => $dmx_recv_ip,
- PeerPort => $dmx_send_port,
- PeerAddr => $dmx_send_ip,
- ReuseAddr => 1
- )
- or return ("open of $dmx_recv_ip : $dmx_recv_port failed: $!");
+ Proto => "udp",
+ LocalAddr => $dmx_recv_ip,
+ PeerPort => $dmx_send_port,
+ PeerAddr => $dmx_send_ip,
+ ReuseAddr => 1
+ )
+ or return ("open of $dmx_recv_ip : $dmx_recv_port failed: $!");
$socksel->add($socket[$socknum]); # add socket to select
$plugin_socket_subscribe{$socket[$socknum]} = $plugname; # subscribe plugin
for (my $i=0; $i<$dmx_channels;$i++) {
- $plugin_subscribe{$knx_startGA}{$plugname} = 1;
- $knx_startGA = addr2str(str2addr($knx_startGA)+1,1);
+ $plugin_subscribe{$knx_startGA}{$plugname} = 1;
+ $knx_startGA = addr2str(str2addr($knx_startGA)+1,1);
}
return "opened UDP-Socket $socknum";
}
if (%msg) { # telegramm vom KNX
- my $destN = str2addr($msg{'dst'});
- my $startN = str2addr($knx_startGA);
- my $dmxchan = $destN - $startN;
- if ($msg{'apci'} eq "A_GroupValue_Write" and $destN >= $startN and $destN <= $startN+$dmx_channels) {
- # send $dmxchan -> UDP as CaaaLvvv
+ my $destN = str2addr($msg{'dst'});
+ my $startN = str2addr($knx_startGA);
+ my $dmxchan = $destN - $startN;
+ if ($msg{'apci'} eq "A_GroupValue_Write" and $destN >= $startN and $destN <= $startN+$dmx_channels) {
+ # send $dmxchan -> UDP as CaaaLvvv
my $dgram = sprintf("C%03dL%03d\r\n",$dmxchan,$dimcurve[hex($msg{'data'})]);
- $socket[$socknum]->send($dgram) or return "send failed: $!";
- # debug chop($dgram);chop($dgram); # debug
- # debug return "sent $msg{'dst'} $msg{'value'} $dgram to DMX $dmxchan"; # debug
- return;
- }
+ $socket[$socknum]->send($dgram) or return "send failed: $!";
+ return;
+ }
+ elsif ($msg{'apci'} eq "A_GroupValue_Read" and $destN >= $startN and $destN <= $startN+$dmx_channels) {
+ # send response to KNX from eibd-cache
+ knx_write($msg{'dst'},knx_read($msg{'dst'},86400,5),5,1);
+ return "read $destN";
+ }
} elsif ($fh) {
my $buf;
recv($fh,$buf,255,0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|