diff --git a/Changes b/Changes index a3d37b5..ad310d6 100644 --- a/Changes +++ b/Changes @@ -1,62 +1,62 @@ -Revision history for Device-Firmata - -0.64 2018.01.03 - Jens Beyer - support Firmata protocol version 2.5 feature PIN_PULLUP (Constants, Platform, Protocol) - -0.63 2016.03.19 - Jens Beyer - supported protocol version detection modified (Protocol) - -0.62 2016.02.22 - Jens Beyer - added software serial support (Platform, Protocol) - -0.61 2016.01.09 - Jens Beyer - added serial pin support (Platform, Protocol, Constants) - added protocol version query (Platform) - fixed messages_handle: REPORT_VERSION returns protocol version (Platform) - added method get_max_compatible_protocol_version (Protocol) - -0.60 2014.06.28 - Norbert Truchsess - Fixed formating of Firmata.pm as Windows line-endings break automatic install from CPAN - -0.59 2014.06.26 - Norbert Truchsess - Fix a bug in the parser incorrectly skipping single 0x30 bytes - -0.58 2014.06.26 - Yanick Champoux - cosmetic change to POD for CPAN - -0.57 2014.06.12 - Norbert Truchsess - Fixed building dist for cpan - -0.56 2014.06.04 - Norbert Truchsess - add generic method sysex_send to Platform.pl - -0.55 2014.04.17 - Norbert Truchsess - fix digital-input message interference with output pins on same port - -0.54 2014.03.04 - Norbert Truchsess - add stepper-motor protocol - -0.53 2014.03.03 - Norbert Truchsess - add rotary-encoder protocol - -0.52 2013.11.22 - Norbert Truchsess - add Firmata over Ethernet - -0.51 2013.09.10/23:00 - Brett Carroll - Changed IO.pm to use Win32::SerialPort instead of Win32::Serialport on Windows platforms - Norbert Truchsess: fix handle onewire in capability-response - -0.50 2012.12.13-2013.08.11 - Norbert Truchsess - adding all missing protocol-features (1-Wire, I2C, Servo ...) - adding observers for all suitable protocols - - Valdas Kondrotas: various bugfixes and enhancements. - - 2011.03.23 - Chris Fedde - reorganizing as CPAN ready module - - 2011.02.16 Aki Mimoto - implementig all protocol basics and releasing Device::Firmata on Github - - 2010.08.31 Aki Mimoto +Revision history for Device-Firmata + +0.64 2018.01.03 - Jens Beyer + support Firmata protocol version 2.5 feature PIN_PULLUP (Constants, Platform, Protocol) + +0.63 2016.03.19 - Jens Beyer + supported protocol version detection modified (Protocol) + +0.62 2016.02.22 - Jens Beyer + added software serial support (Platform, Protocol) + +0.61 2016.01.09 - Jens Beyer + added serial pin support (Platform, Protocol, Constants) + added protocol version query (Platform) + fixed messages_handle: REPORT_VERSION returns protocol version (Platform) + added method get_max_compatible_protocol_version (Protocol) + +0.60 2014.06.28 - Norbert Truchsess + Fixed formating of Firmata.pm as Windows line-endings break automatic install from CPAN + +0.59 2014.06.26 - Norbert Truchsess + Fix a bug in the parser incorrectly skipping single 0x30 bytes + +0.58 2014.06.26 - Yanick Champoux + cosmetic change to POD for CPAN + +0.57 2014.06.12 - Norbert Truchsess + Fixed building dist for cpan + +0.56 2014.06.04 - Norbert Truchsess + add generic method sysex_send to Platform.pl + +0.55 2014.04.17 - Norbert Truchsess + fix digital-input message interference with output pins on same port + +0.54 2014.03.04 - Norbert Truchsess + add stepper-motor protocol + +0.53 2014.03.03 - Norbert Truchsess + add rotary-encoder protocol + +0.52 2013.11.22 - Norbert Truchsess + add Firmata over Ethernet + +0.51 2013.09.10/23:00 - Brett Carroll + Changed IO.pm to use Win32::SerialPort instead of Win32::Serialport on Windows platforms + Norbert Truchsess: fix handle onewire in capability-response + +0.50 2012.12.13-2013.08.11 - Norbert Truchsess + adding all missing protocol-features (1-Wire, I2C, Servo ...) + adding observers for all suitable protocols + + Valdas Kondrotas: various bugfixes and enhancements. + + 2011.03.23 - Chris Fedde + reorganizing as CPAN ready module + + 2011.02.16 Aki Mimoto + implementig all protocol basics and releasing Device::Firmata on Github + + 2010.08.31 Aki Mimoto start of development \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0a0e82f --- /dev/null +++ b/LICENSE @@ -0,0 +1,10 @@ +COPYRIGHT AND LICENSE + +Copyright (C) 2010 amimato +Copyright (C) 2012 ntruchsess +Copyright (C) 2016 jnsbyr + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +See http://dev.perl.org/licenses/ for more information. diff --git a/MANIFEST b/MANIFEST index 80ec84e..6acfd86 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,14 +1,15 @@ Changes -MANIFEST -Makefile.PL environment ignore.txt +LICENSE +Makefile.PL +MANIFEST README t/00-load.t t/boilerplate.t t/manifest.t -t/pod-coverage.t t/pod.t +t/pod-coverage.t lib/Device/Firmata/Platform/Arduino.pm lib/Device/Firmata/Base.pm lib/Device/Firmata/Constants.pm diff --git a/Makefile.PL b/Makefile.PL index 9dd4021..618fb29 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -5,12 +5,14 @@ use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Device::Firmata', - AUTHOR => q{Norbert Truchsess , amimato }, + AUTHOR => [ + 'Aki Mimoto ', + 'Norbert Truchsess ', + 'Jens B. ', + ], VERSION_FROM => 'lib/Device/Firmata.pm', ABSTRACT_FROM => 'lib/Device/Firmata.pm', - ($ExtUtils::MakeMaker::VERSION >= 6.3002 - ? ('LICENSE'=> 'perl') - : ()), + ($ExtUtils::MakeMaker::VERSION >= 6.3001? ('LICENSE'=> 'perl_5') : ()), PL_FILES => {}, MIN_PERL_VERSION => 5.006, CONFIGURE_REQUIRES => { @@ -20,8 +22,28 @@ WriteMakefile( 'Test::More' => 0, }, PREREQ_PM => { - 'Test::More' => 0, + ($^O eq 'MSWin32'? ('Win32::SerialPort' => 0) : ('Device::SerialPort' => 0)), + 'IO::Select' => 0, + 'IO::Socket::INET' => 0, + 'Time::HiRes' => 0, + 'strict' => 0, + 'warnings' => 0 + }, + dist => { + COMPRESS => 'gzip -9f', + SUFFIX => 'gz', + }, + clean => { + FILES => 'Device-Firmata-*' + }, + META_MERGE => { + 'meta-spec' => { version => 2 }, + resources => { + repository => { + type => 'git', + url => 'https://github.com/ntruchsess/perl-firmata.git', + web => 'https://github.com/ntruchsess/perl-firmata', + }, + }, }, - dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, - clean => { FILES => 'Device-Firmata-*' }, ); diff --git a/README b/README index 790b77b..ff6b807 100644 --- a/README +++ b/README @@ -33,15 +33,14 @@ You can also look for information at: http://search.cpan.org/dist/Device-Firmata/ -LICENSE AND COPYRIGHT +COPYRIGHT AND LICENSE -Copyright (C) 2011 amimato +Copyright (C) 2010 amimato Copyright (C) 2012 ntruchsess Copyright (C) 2016 jnsbyr -This program is free software; you can redistribute it and/or modify it -under the terms of either: the GNU General Public License as published -by the Free Software Foundation; or the Artistic License. +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. See http://dev.perl.org/licenses/ for more information. diff --git a/dist.ini b/dist.ini index 7213d90..0045670 100644 --- a/dist.ini +++ b/dist.ini @@ -1,8 +1,10 @@ name = Device-Firmata -version = 0.56 -author = Aki Mimoto, Norbert Truchsess +author = Aki Mimoto , Norbert Truchsess , Jens B. license = Perl_5 -copyright_holder = Aki Mimoto, Norbert Truchsess +copyright_holder = Aki Mimoto, Norbert Truchsess, Jens B. +copyright_year = 2010 + +version = 0.64 [GatherDir] [MetaYAML] diff --git a/lib/Device/Firmata.pm b/lib/Device/Firmata.pm index 5867ba8..751d309 100644 --- a/lib/Device/Firmata.pm +++ b/lib/Device/Firmata.pm @@ -48,9 +48,9 @@ our $DEBUG = 0; =head1 SUBROUTINES/METHODS -=head2 open +=head2 open(serialPort) -establish serial connection with an Arduino micro-controller. Single argument is the name of the device file mapped to the arduino. Typically '/dev/ttyUSB0' or 'COM9' +Establish a serial connection with an Arduino micro-controller. The first argument is the name of the serial device mapped to the arduino, e.g. '/dev/ttyUSB0' or 'COM9'. =cut @@ -74,6 +74,12 @@ sub open { return $platform; } +=head2 listen(host, port) + +Start a TCP server bound to given local address and port for the arduino to connect to. + +=cut + sub listen { # -------------------------------------------------- # Listen on socket and wait for Arduino to establish a connection @@ -86,4 +92,17 @@ sub listen { return $netio->listen( $ip, $port, $opts ) || die "Could not bind to socket"; } +=head1 LICENSE + + Copyright (C) 2010 amimato + Copyright (C) 2012 ntruchsess + Copyright (C) 2016 jnsbyr + + This is free software; you can redistribute it and/or modify it under + the same terms as the Perl 5 programming language system itself. + + See http://dev.perl.org/licenses/ for more information. + +=cut + 1; diff --git a/lib/Device/Firmata/Base.pm b/lib/Device/Firmata/Base.pm index 51163df..15ca54c 100644 --- a/lib/Device/Firmata/Base.pm +++ b/lib/Device/Firmata/Base.pm @@ -1,6 +1,7 @@ package Device::Firmata::Base; use strict 'vars', 'subs'; +use warnings; use vars qw/ $AUTOLOAD $FIRMATA_DEBUG_LEVEL diff --git a/lib/Device/Firmata/Constants.pm b/lib/Device/Firmata/Constants.pm index beabbfd..15d382e 100644 --- a/lib/Device/Firmata/Constants.pm +++ b/lib/Device/Firmata/Constants.pm @@ -7,6 +7,7 @@ Device::Firmata::Constants - constants used in the Device::Firmata system =cut use strict; +use warnings; use Exporter; use vars qw/ @ISA @EXPORT_OK %EXPORT_TAGS @@ -14,6 +15,7 @@ use vars qw/ $COMMANDS $COMMAND_NAMES $COMMAND_LOOKUP /; + @ISA = 'Exporter'; # Basic commands and constants @@ -139,7 +141,7 @@ use constant ( }, # /Constants for Version 2.2 - V_2_03 => { + V_2_03 => { MAX_DATA_BYTES => 32, # max number of data bytes in non-Sysex messages @@ -356,7 +358,7 @@ use constant ( ONEWIRE => 0x07, # pin configured for 1-Wire commuication STEPPER => 0x08, # pin configured for stepper motor ENCODER => 0x09, # pin configured for rotary-encoders - SERIAL => 0x0A, # pin configured for serial port + SERIAL => 0x0A, # pin configured for serial port PULLUP => 0x0B, # digital pin in digitalInput mode with pullup # Deprecated entries @@ -364,7 +366,7 @@ use constant ( qw( FIRMATA_STRING SYSEX_I2C_REQUEST SYSEX_I2C_REPLY SYSEX_SAMPLING_INTERVAL ) ], - }, # /Constants for Version 2.6 + }, # /Constants for Version 2.6 } ); @@ -393,4 +395,4 @@ use constant { COMMAND_NAMES => [ $COMMAND_NAMES = [ keys %$COMMAND_NAMES ] ] }; %EXPORT_TAGS = ( all => \@EXPORT_OK ); -1; +1; diff --git a/lib/Device/Firmata/Error.pm b/lib/Device/Firmata/Error.pm index d086f56..cef07a8 100644 --- a/lib/Device/Firmata/Error.pm +++ b/lib/Device/Firmata/Error.pm @@ -8,6 +8,7 @@ Device::Firmata::Error - Error handlers =cut use strict; +use warnings; use Exporter; use vars qw/ @ISA diff --git a/lib/Device/Firmata/IO/NetIO.pm b/lib/Device/Firmata/IO/NetIO.pm index b33c2f2..46d8e40 100644 --- a/lib/Device/Firmata/IO/NetIO.pm +++ b/lib/Device/Firmata/IO/NetIO.pm @@ -1,5 +1,11 @@ package Device::Firmata::IO::NetIO; +=head1 NAME + +Device::Firmata::IO::NetIO - implement the low level TCP/IP IO + +=cut + use strict; use warnings; use IO::Socket::INET; @@ -11,6 +17,11 @@ use Device::Firmata::Base FIRMATA_ATTRIBS => { }; + +=head2 listen + +=cut + sub listen { # -------------------------------------------------- my ( $pkg, $ip, $port, $opts ) = @_; @@ -19,9 +30,9 @@ sub listen { # flush after every write $| = 1; - + my $socket; - + # creating object interface of IO::Socket::INET modules which internally does # socket creation, binding and listening at the specified port address. $socket = new IO::Socket::INET ( @@ -37,7 +48,7 @@ sub listen { } sub accept { - + my ($self,$timeout) = @_; # waiting for new client connection. my $s = $self->{'select'}; @@ -84,9 +95,9 @@ sub attach { my $clientpackage = "Device::Firmata::IO::NetIO::Client"; eval "require $clientpackage"; - + my $clientio = $clientpackage->attach($client_socket); - + my $package = "Device::Firmata::Platform"; eval "require $package"; my $platform = $package->attach( $clientio, $opts ) or die "Could not connect to Firmata Server"; @@ -151,7 +162,7 @@ sub attach { my $self = ref $pkg ? $pkg : $pkg->new($opts); $self->{client} = $client_socket; - + return $self; } @@ -182,7 +193,7 @@ sub data_read { my ($buf, $res); $res = $self->{client}->sysread($buf, 512); $buf = "" if(!defined($res)); - + if ( $Device::Firmata::DEBUG and $buf ) { print "<".join(",",map{sprintf"%02x",ord$_}split//,$buf)."\n"; } diff --git a/lib/Device/Firmata/Language.pm b/lib/Device/Firmata/Language.pm index 8848974..989caeb 100644 --- a/lib/Device/Firmata/Language.pm +++ b/lib/Device/Firmata/Language.pm @@ -8,6 +8,7 @@ Device::Firmata::Language - Localization =cut use strict; +use warnings; use vars qw/ $FIRMATA_LOCALE $FIRMATA_LOCALE_PATH diff --git a/lib/Device/Firmata/Platform.pm b/lib/Device/Firmata/Platform.pm index 0ed53ff..8c3afda 100644 --- a/lib/Device/Firmata/Platform.pm +++ b/lib/Device/Firmata/Platform.pm @@ -7,6 +7,7 @@ Device::Firmata::Platform - Platform specifics =cut use strict; +use warnings; use Time::HiRes qw/time/; use Device::Firmata::Constants qw/ :all /; use Device::Firmata::Protocol; @@ -257,7 +258,7 @@ sub sysex_handle { my @encoderpins; my @serialpins; my @pulluppins; - + foreach my $pin (keys %$capabilities) { if (defined $capabilities->{$pin}) { if ($capabilities->{$pin}->{PIN_INPUT+0}) { @@ -388,7 +389,7 @@ sub sysex_handle { }; last; }; - + $sysex_message->{command_str} eq 'SERIAL_DATA' and do { my $serialPort = $data->{port}; my $observer = $self->{serial_observer}[$serialPort]; @@ -485,7 +486,7 @@ Analogous to the digitalWrite function on the arduino Deprecation Warning: -Writing to pin with mode "INPUT" is only supported for backward compatibility +Writing to pin with mode "INPUT" is only supported for backward compatibility to switch pullup on and off. Use sub pin_mode with $mode=PIN_PULLUP instead. =cut @@ -1015,7 +1016,7 @@ sub is_supported_mode { return undef if (defined $self->{metadata}->{capabilities} and (!(defined $self->{metadata}->{capabilities}->{$pin}) or !(defined $self->{metadata}->{capabilities}->{$pin}->{$mode}))); return 1; } - + sub is_configured_mode { my ($self,$pin,$mode) = @_; return undef if (!defined $self->{pin_modes}->{$pin} or $self->{pin_modes}->{$pin} != $mode); diff --git a/lib/Device/Firmata/Platform/Arduino.pm b/lib/Device/Firmata/Platform/Arduino.pm index 2d0a3c6..b5e4945 100644 --- a/lib/Device/Firmata/Platform/Arduino.pm +++ b/lib/Device/Firmata/Platform/Arduino.pm @@ -6,12 +6,13 @@ Device::Firmata::Platform::Arduino - subclass for the arduino itself =head1 DESCRIPTION -No customization requried at this time so this is just a specification of the +No customization requried at this time so this is just a specification of the Device::Firmata::Platform class =cut use strict; +use warnings; use Device::Firmata::Platform; use Device::Firmata::Base ISA => 'Device::Firmata::Platform'; diff --git a/license.txt b/license.txt deleted file mode 100644 index b420612..0000000 --- a/license.txt +++ /dev/null @@ -1 +0,0 @@ -perl-firmata is distributed under the same terms as perl itself diff --git a/t/boilerplate.t b/t/boilerplate.t index 0d840f3..552d4e5 100644 --- a/t/boilerplate.t +++ b/t/boilerplate.t @@ -51,7 +51,5 @@ TODO: { ); module_boilerplate_ok('lib/Device/Firmata.pm'); - - } diff --git a/t/manifest.t b/t/manifest.t index 6ddfe36..6d07564 100644 --- a/t/manifest.t +++ b/t/manifest.t @@ -4,9 +4,8 @@ use strict; use warnings FATAL => 'all'; use Test::More; -unless ( $ENV{RELEASE_TESTING} ) { - plan( skip_all => "Author tests not required for installation" ); -} +# No manifest test for normal user install +plan skip_all => "These tests are for authors only, skipping!" unless $ENV{AUTHOR_TESTING} or $ENV{RELEASE_TESTING}; my $min_tcm = 0.9; eval "use Test::CheckManifest $min_tcm"; diff --git a/t/pod-coverage.t b/t/pod-coverage.t index 866fac2..9144bbc 100644 --- a/t/pod-coverage.t +++ b/t/pod-coverage.t @@ -4,6 +4,9 @@ use strict; use warnings FATAL => 'all'; use Test::More; +# No pod tests for normal user install +plan skip_all => "These tests are for authors only, skipping!" unless $ENV{AUTHOR_TESTING} or $ENV{RELEASE_TESTING}; + # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; diff --git a/t/pod.t b/t/pod.t index a0054e9..322d149 100644 --- a/t/pod.t +++ b/t/pod.t @@ -4,6 +4,9 @@ use strict; use warnings FATAL => 'all'; use Test::More; +# No pod tests for normal user install +plan skip_all => "These tests are for authors only, skipping!" unless $ENV{AUTHOR_TESTING} or $ENV{RELEASE_TESTING}; + # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp";