3 # This module impliments the outgoing PCxx generation routines
5 # These are all the namespace of DXProt and are separated for "clarity"
7 # Copyright (c) 1998 Dirk Koopman G1TLH
14 @ISA = qw(DXProt DXChannel);
22 # All the PCxx generation routines
25 # create a talk string (called $self->pc10(...)
28 my ($self, $to, $via, $text) = @_;
29 my $user2 = $via ? $to : ' ';
30 my $user1 = $via ? $via : $to;
31 my $mycall = $self->call;
33 $text = ' ' if !$text;
34 return "PC10^$mycall^$user1^$text^*^$user2^$main::mycall^~";
37 # create a dx message (called $self->pc11(...)
40 my ($self, $freq, $dxcall, $text) = @_;
41 my $mycall = $self->call;
42 my $hops = get_hops(11);
44 $text = ' ' if !$text;
45 return sprintf "PC11^%.1f^$dxcall^%s^%s^$text^$mycall^$hops^~", $freq, cldate($t), ztime($t);
48 # create an announce message
51 my ($self, $text, $tonode, $sysop, $wx) = @_;
52 my $hops = get_hops(12);
53 $sysop = $sysop ? '*' : ' ';
54 $text = ' ' if !$text;
56 $tonode = '*' if !$tonode;
57 return "PC12^$self->{call}^$tonode^$text^$sysop^$main::mycall^$wx^$hops^~";
61 # add one or more users (I am expecting references that have 'call',
62 # 'confmode' & 'here' method)
64 # this will create a list of PC16 with up pc16_max_users in each
65 # called $self->pc16(..)
73 my $str = "PC16^$self->{call}";
76 for ($i = 0; @_ && $i < $DXProt::pc16_max_users; $i++) {
78 $str .= sprintf "^%s %s %d", $ref->call, $ref->confmode ? '*' : '-', $ref->here;
80 $str .= sprintf "^%s^", get_hops(16);
90 my $hops = get_hops(17);
91 return "PC17^$self->{call}^$main::mycall^$hops^";
97 return "PC18^wot a load of twaddle^$DXProt::myprot_version^~";
101 # add one or more nodes
109 my $str = "PC19^$self->{call}";
112 for ($i = 0; @_ && $i < $DXProt::pc19_max_nodes; $i++) {
114 $str .= "^$ref->{here}^$ref->{call}^$ref->{confmode}^$ref->{pcversion}";
116 $str .= sprintf "^%s^", get_hops(19);
131 my ($ref, $reason) = @_;
132 my $call = $ref->call;
133 my $hops = get_hops(21);
134 $reason = "Gone." if !$reason;
135 return "PC21^$call^$reason^$hops^";
144 # send all the DX clusters I reckon are connected
147 my @list = DXNode->get_all();
151 foreach $list (@list) {
152 push @nodes, $list->call;
154 return "PC38^" . join(',', @nodes) . "^~";
157 # periodic update of users, plus keep link alive device (always H99)
160 my $n = DXNodeuser->count;
161 return "PC50^$main::mycall^$n^H99^";
167 my ($self, $to, $from, $val) = @_;
168 return "PC51^$to^$from^$val^";