Start processing frequency

pull/2/head
Jean-Marc MEESSEN 4 years ago
parent 2fd54e3734
commit 247f869bf5

@ -56,6 +56,7 @@ var regexpIsTimePart = regexp.MustCompile("^[0-5]{1}[0-9]{1}$|^[1-9]{1}$")
var regexpIsOMname = regexp.MustCompile("^@")
var regexpIsGridLoc = regexp.MustCompile("^#")
var regexpIsRst = regexp.MustCompile("^[\\d]{1,3}$")
var regexpIsFreq = regexp.MustCompile("^[\\d]+.[\\d]+$")
// ParseLine cuts a FLE line into useful bits
func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg string){
@ -123,6 +124,16 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
continue
}
// Is it a Frequency?
if regexpIsFreq.MatchString(element) {
//TODO: check if we are in the band limits (is a band defined?)
//TODO: how do we handle/report errors
//TODO: take only 3 decimal digits
//TODO: update the column display
logLine.Frequency = element
continue
}
// Is it a call sign ?
if validCallRegexp.MatchString(strings.ToUpper(element)) {
callErrorMsg := ""

@ -67,6 +67,11 @@ func TestParseLine(t *testing.T) {
args{ inputStr: "#grid", previousLine: LogLine{ Mode: "SSB", }},
LogLine{ GridLoc: "grid", Mode: "SSB", RSTsent: "59", RSTrcvd: "59"}, "",
},
{
"Parse frequency",
args{ inputStr: "14.453 on4kjm", previousLine: LogLine{ Mode: "SSB", Band: "20m"}},
LogLine{ Band: "20m", Frequency: "14.453", Call: "ON4KJM" ,Mode: "SSB", RSTsent: "59", RSTrcvd: "59"}, "",
},
{
"parse partial RST (sent) - CW",
args{ inputStr: "1230 on4kjm 5", previousLine: LogLine{ Mode: "CW", ModeType: "CW"}},

@ -11,14 +11,15 @@
## Input processing
* [x] infer RST
* [x] Create the logic to take over from the previous line
* [ ] decode and check frequency
* [ ] DATE keyword is now optional
* [ ] New MYGRID keyword
* [ ] Create the logic to take over from the previous line
* [ ] Support different date delimiter
* [ ] Support extrapolated date
* [ ] Support date not prefixed by "date" (non header mode)
* [ ] Support date increment
* [ ] decode and check frequency
## Later
* [ ] Process contest reports

Loading…
Cancel
Save