SlideShare ist ein Scribd-Unternehmen logo
 
 
 
 
BMATrainer Simulationsprogramm für Brandmeldeanlagen
Die GUI
Die GUI
Die GUI
Die GUI wxFormBuilder im Einsatz...
 
GUI
Plugins
Plugins I Löst den “Alarm” aus
Einfache Arduino-Anwendung
Anschluss an USB-Port
Device::SerialPort zum Auslesen der Arduino-Daten
Einfacher Sketch für Arduino
Plugins I
Plugins I use Win32::SerialPort; my $port  = 'COM3'; my $baud  = 9600; my $parity  = 'none'; my $data  = 2; my $stop  = 1; my $handshake = 'none'; sub new { bless {}, shift; }
Plugins I my $conn = Win32::SerialPort->new( $port ) or die $^E; $conn->databits( $data ); $conn->baudrate( $baud ); $conn->parity( $parity ); $conn->stopbits( $stop ); while ( 1 ) { my $char = $conn->lookfor; no warnings 'numeric'; # read input from usb port # if “1” is returned, start alarm $conn->lookclear; }
Plugins II Soll “Hausalarm” simulieren
Steuerung mit Win32::Sound
Win32-only im Moment
Plugins II sub start_sound { my ($self) = @_; Win32::Sound::Volume( '100%' ); Win32::Sound::Play( $self->sound_file, SND_ASYNC ); } sub stop_sound { Win32::Sound::Stop(); }
Plugins threads + wxPerl -> “use threads” vor “use Wx”
Kommunikation zwischen den Plugins und der Anwendung muss möglich sein Ein “Eventsystem” musste her Einbinden muss einfach sein
Plugins einbinden my $config_file = Path::Class::File->new( $args{directory}, 'plugins.yml', ); my $config = BMA::Config->new( $config_file->absolute.'' ); my $plugins = $config->get( 'plugins' ); for my $plugin ( @{$plugins} ) { $plugin->{package} = 'BMA::Plugins::'.$plugin->{module}; my $file = $plugin->{package} . '.pm'; $file =~ s{ :: }{/}gxms; $plugin->{file} = $file; push @{ $self->{ $plugin->{type} } }, $plugin; }
Plugins einbinden --- plugins: - type: input module: Feuermelder active: 0 label: Feuermelder - type: output module: Sirene event: AlarmStart active: 0 label: Sirene
Kommunikation
Kommunikation GUI muss von Plugins Befehle empfangen können Einfach Methodenaufrufe des GUI-Objekts GUI muss Befehle an Plugins senden können Nicht so einfach, da GUI die Methoden der Plugins nicht kennt Plugin ↔ Plugin müssen über GUI-Methoden kommunizieren, da diese voneinander nichts wissen

Weitere ähnliche Inhalte

PPT
PHP: Rechnen mit PHP
lehrerfreund
 
ODP
Froscamp2010_perlcritic
Renee Baecker
 
PDF
DBI for Parrot and Perl 6 Lightning Talk 2007
Tim Bunce
 
PDF
My sql 5.6_replwebinar_may12
Mat Keep
 
PPS
India
tarun_marwah
 
PPT
KB Vision
Magic
 
PDF
Thomas' Road Map
guest9618194
 
PPT
DBIx::Class vs. DBix::DataModel
Laurent Dami
 
PHP: Rechnen mit PHP
lehrerfreund
 
Froscamp2010_perlcritic
Renee Baecker
 
DBI for Parrot and Perl 6 Lightning Talk 2007
Tim Bunce
 
My sql 5.6_replwebinar_may12
Mat Keep
 
KB Vision
Magic
 
Thomas' Road Map
guest9618194
 
DBIx::Class vs. DBix::DataModel
Laurent Dami
 

Mehr von Renee Baecker (9)

PDF
2012 gpw yapc2012
Renee Baecker
 
PDF
Perl5 Maintenance Fund
Renee Baecker
 
PDF
Jenkins und Perl-Projekte
Renee Baecker
 
PDF
OPAR
Renee Baecker
 
PDF
OPAR Vortrag auf der CeBIT 2011
Renee Baecker
 
PDF
Clt 2011 Perl Critic
Renee Baecker
 
ODP
Froscamp2010_padre
Renee Baecker
 
ODP
Froscamp2010_moose
Renee Baecker
 
ODP
Fr os con2010_devel_nytprof
Renee Baecker
 
2012 gpw yapc2012
Renee Baecker
 
Perl5 Maintenance Fund
Renee Baecker
 
Jenkins und Perl-Projekte
Renee Baecker
 
OPAR Vortrag auf der CeBIT 2011
Renee Baecker
 
Clt 2011 Perl Critic
Renee Baecker
 
Froscamp2010_padre
Renee Baecker
 
Froscamp2010_moose
Renee Baecker
 
Fr os con2010_devel_nytprof
Renee Baecker
 
Anzeige

Fr os con2010_bmatrainer