-
Notifications
You must be signed in to change notification settings - Fork 0
/
qrmstation.js
50 lines (46 loc) · 1.45 KB
/
qrmstation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { DEFAULT, StationMessage } from './defaults.js'
import { Station } from "./station.js"
import * as random from './random.js'
export class QrmStation extends Station {
constructor(call) {
super()
this.Patience = 1 + random.RandomInt(0, 5)
this.MyCall = call
this.HisCall = DEFAULT.CALL
this.Amplitude = 5000 + 25000 * Math.random()
this.Pitch = random.RandomInt(0, random.RndGaussLim(0, 300))
this.Wpm = 30 + random.RandomInt(0, 20)
this.TimeOut = 1
switch (random.RandomInt(0, 7)) {
case 0:
this.SendMsg(StationMessage.Qrl)
break
case 1:
case 2:
this.SendMsg(StationMessage.Qrl2)
break
case 3:
case 4:
case 5:
this.SendMsg(StationMessage.LongCQ)
break
case 6:
this.SendMsg(StationMessage.Qsy)
break
}
}
ProcessEvent(AEvent) {
switch (AEvent) {
case Station.Event.MsgSent:
this.Patience--
if (this.Patience === 0)
this.done = true
else
this.TimeOut = Math.round(random.RndGaussLim(random.SecondsToBlocks(4), 2))
break
case Station.Event.Timeout:
this.SendMsg(StationMessage.LongCQ)
break
}
}
}