Brm::Lasic: Add seqid counter

This commit is contained in:
Petr Baudis 2011-12-27 23:04:09 +01:00
parent 9ea954d2a2
commit ebd8d7a8b2

View file

@ -57,6 +57,12 @@ The tty device filehandle. Avoid using directly.
=cut =cut
has 'fd' => (is => 'rw', isa => 'FileHandle'); has 'fd' => (is => 'rw', isa => 'FileHandle');
=item B<seqid>
Sequence id for commands. Just for internal use.
=cut
has 'seqid' => (is => 'rw', isa => 'Num', default => 0);
=back =back
=head2 METHODS =head2 METHODS
@ -158,7 +164,8 @@ sub msg {
my $self = shift; my $self = shift;
my (@args) = @_; my (@args) = @_;
push @args, 1; push @args, 1 + $self->seqid % 254;
$self->seqid($self->seqid + 1);
my $fd = $self->fd(); my $fd = $self->fd();
print $fd join(' ', @args)."\r\n"; print $fd join(' ', @args)."\r\n";