SlideShare une entreprise Scribd logo
1  sur  30
 
 
 
 
BMATrainer ,[object Object]
Die GUI
Die GUI
Die GUI
Die GUI ,[object Object]
 
GUI
Plugins
Plugins I ,[object Object]
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 ,[object Object]
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 ,[object Object]
Kommunikation zwischen den Plugins und der Anwendung muss möglich sein ,[object Object],[object Object]
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 ,[object Object]

Contenu connexe

Plus de Renee Baecker

Perl5 Maintenance Fund
Perl5 Maintenance FundPerl5 Maintenance Fund
Perl5 Maintenance FundRenee Baecker
 
Jenkins und Perl-Projekte
Jenkins und Perl-ProjekteJenkins und Perl-Projekte
Jenkins und Perl-ProjekteRenee Baecker
 
OPAR Vortrag auf der CeBIT 2011
OPAR Vortrag auf der CeBIT 2011OPAR Vortrag auf der CeBIT 2011
OPAR Vortrag auf der CeBIT 2011Renee Baecker
 
Clt 2011 Perl Critic
Clt 2011 Perl CriticClt 2011 Perl Critic
Clt 2011 Perl CriticRenee Baecker
 
Fr os con2010_devel_nytprof
Fr os con2010_devel_nytprofFr os con2010_devel_nytprof
Fr os con2010_devel_nytprofRenee Baecker
 

Plus de Renee Baecker (9)

2012 gpw yapc2012
2012 gpw yapc20122012 gpw yapc2012
2012 gpw yapc2012
 
Perl5 Maintenance Fund
Perl5 Maintenance FundPerl5 Maintenance Fund
Perl5 Maintenance Fund
 
Jenkins und Perl-Projekte
Jenkins und Perl-ProjekteJenkins und Perl-Projekte
Jenkins und Perl-Projekte
 
OPAR
OPAROPAR
OPAR
 
OPAR Vortrag auf der CeBIT 2011
OPAR Vortrag auf der CeBIT 2011OPAR Vortrag auf der CeBIT 2011
OPAR Vortrag auf der CeBIT 2011
 
Clt 2011 Perl Critic
Clt 2011 Perl CriticClt 2011 Perl Critic
Clt 2011 Perl Critic
 
Froscamp2010_padre
Froscamp2010_padreFroscamp2010_padre
Froscamp2010_padre
 
Froscamp2010_moose
Froscamp2010_mooseFroscamp2010_moose
Froscamp2010_moose
 
Fr os con2010_devel_nytprof
Fr os con2010_devel_nytprofFr os con2010_devel_nytprof
Fr os con2010_devel_nytprof
 

Fr os con2010_bmatrainer