line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#============================================================================== |
4
|
|
|
|
|
|
|
# Ham::Fldigi |
5
|
|
|
|
|
|
|
# v0.002 |
6
|
|
|
|
|
|
|
# (c) 2012 Andy Smith, M0VKG |
7
|
|
|
|
|
|
|
#============================================================================== |
8
|
|
|
|
|
|
|
# DESCRIPTION |
9
|
|
|
|
|
|
|
# Perl extensions for managing Fldigi instances |
10
|
|
|
|
|
|
|
#============================================================================== |
11
|
|
|
|
|
|
|
# SYNOPSIS |
12
|
|
|
|
|
|
|
# use Ham::Fldigi; |
13
|
|
|
|
|
|
|
# my $f = new Ham::Fldigi('LogLevel' => 4, |
14
|
|
|
|
|
|
|
# 'LogFile' => './debug.log', |
15
|
|
|
|
|
|
|
# 'LogPrint' => 1, |
16
|
|
|
|
|
|
|
# 'LogWrite' => 1); |
17
|
|
|
|
|
|
|
# my $client = $f->client('Hostname' => 'localhost', |
18
|
|
|
|
|
|
|
# 'Port' => '7362', |
19
|
|
|
|
|
|
|
# 'Name' => 'default'); |
20
|
|
|
|
|
|
|
# $client->modem("BPSK125"); |
21
|
|
|
|
|
|
|
# $client->send("CQ CQ CQ DE M0VKG M0VKG M0VKG KN"); |
22
|
|
|
|
|
|
|
#============================================================================== |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Perl documentation is provided inline in pod format. |
25
|
|
|
|
|
|
|
# To view, run:- |
26
|
|
|
|
|
|
|
# perldoc Ham::Fldigi |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Ham::Fldigi - Perl extensions for managing Fldigi instances |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use Ham::Fldigi; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 DESCRIPTION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
This module itself doesn't do much - see C<Ham::Fldigi::Client> for details. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 EXPORT |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
None by default. |
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
package Ham::Fldigi; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
|
47489
|
use 5.012004; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
40
|
|
48
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
65
|
|
49
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
71
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
1
|
|
465
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use Ham::Fldigi::Client; |
55
|
|
|
|
|
|
|
use Ham::Fldigi::Shell; |
56
|
|
|
|
|
|
|
use base qw(Ham::Fldigi::Debug); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has 'clients' => (is => 'ro', isa => 'HashRef[Ham::Fldigi::Client'); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 CONSTRUCTORS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 Fldigi->new([I<LogLevel> => n, ] [I<LogFile> => filename, ] [I<LogPrint> => (0|1), ] [I<LogWrite> => (0|1)]) |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Creates a new B<Ham::Fldigi> object with the specified options. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
I<LogLevel> is an integer between 0 and 4, with 0 being no logging at all, 1 for errors, 2 for warnings, 3 for notices and 4 for debugging. This defaults to B<2>, which will display and log errors and warnings. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
I<LogFile> is the path to the logfile that will be written to. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
I<LogPrint> is whether to print log messages to screen or not. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
I<LogWrite> is whether to log messages to the logfile or not. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub new { |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Get the class name |
87
|
|
|
|
|
|
|
my($class) = shift; |
88
|
|
|
|
|
|
|
my(%params) = @_; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my $self = { |
91
|
|
|
|
|
|
|
'version' => $VERSION, |
92
|
|
|
|
|
|
|
}; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
if(defined($params{'LogLevel'})) { |
95
|
|
|
|
|
|
|
$Ham::Fldigi::Debug::debug_level = $params{'LogLevel'}; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
if(defined($params{'LogFile'})) { |
98
|
|
|
|
|
|
|
$Ham::Fldigi::Debug::debug_file = $params{'LogFile'}; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
if(defined($params{'LogPrint'})) { |
101
|
|
|
|
|
|
|
$Ham::Fldigi::Debug::debug_print = $params{'LogPrint'}; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
if(defined($params{'LogWrite'})) { |
104
|
|
|
|
|
|
|
$Ham::Fldigi::Debug::debug_write = $params{'LogWrite'}; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
bless $self, $class; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
$self->debug("Constructor called. Version is ".$VERSION."."); |
110
|
|
|
|
|
|
|
$self->debug("Returning..."); |
111
|
|
|
|
|
|
|
return $self; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 METHODS |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 Fldigi->client('Hostname' => I<hostname>, 'Port' => I<port>, 'Name' => I<name>) |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Creates a new B<Ham::Fldigi::Client> object with the specified arguments. See C<Ham::Fldigi::Client> for more details. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub client { |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
my ($self, %params) = @_; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
# Create a new Ham::Fldigi::Client object |
127
|
|
|
|
|
|
|
my $c = Ham::Fldigi::Client->new(%params); |
128
|
|
|
|
|
|
|
if(!defined $c) { |
129
|
|
|
|
|
|
|
# We didn't get a Ham::Fldigi::Client object back |
130
|
|
|
|
|
|
|
$self->error("Error creating Ham::Fldigi::Client object!"); |
131
|
|
|
|
|
|
|
return undef; |
132
|
|
|
|
|
|
|
} else { |
133
|
|
|
|
|
|
|
# Add the client to the 'clients' hash |
134
|
|
|
|
|
|
|
$self->{clients}{$c->name} = $c; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
# Return the previously returned Ham::Fldigi::Client object |
138
|
|
|
|
|
|
|
return $c; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 Fldigi->shell() |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Creates an Fldigi shell object. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This is an attempt to create a more featured replacement for Fldigi's bundled 'fldigi-shell'. This is still under development and shouldn't be used yet. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub shell { |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
my ($self, %params) = @_; |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
$params{'Parent'} = $self; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
my $s = Ham::Fldigi::Shell->new(%params); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
return $s; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
1; |
162
|
|
|
|
|
|
|
__END__ |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 SEE ALSO |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
The source code for this module is hosted on Github at L<https://github.com/m0vkg/Perl-Ham-Fldigi>. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 AUTHOR |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Andy Smith M0VKG, E<lt>andy@m0vkg.org.ukE<gt> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Copyright (C) 2012 by Andy Smith |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
177
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.12.4 or, |
178
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
181
|
|
|
|
|
|
|
|