adding RST procesing

pull/2/head
Jean-Marc MEESSEN 4 years ago
parent debe727339
commit 6cef57acba

@ -55,9 +55,10 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
//TODO: input null protection? //TODO: input null protection?
//Flag telling that we are processing data to the right of the callsign //Flag telling that we are processing data to the right of the callsign
//isRightOfCall := false isRightOfCall := false
//TODO: Make something more intelligent //TODO: Make something more intelligent
//TODO: What happens if we have partial lines
previousLine.Call = "" previousLine.Call = ""
previousLine.RSTsent = "" previousLine.RSTsent = ""
previousLine.RSTrcvd = "" previousLine.RSTrcvd = ""
@ -116,26 +117,29 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
callErrorMsg := "" callErrorMsg := ""
logLine.Call, callErrorMsg = ValidateCall(element) logLine.Call, callErrorMsg = ValidateCall(element)
errorMsg = errorMsg + callErrorMsg errorMsg = errorMsg + callErrorMsg
//isRightOfCall = true isRightOfCall = true
continue continue
} }
// Is it a "full" time ? // Is it a "full" time ?
if regexpIsFullTime.MatchString(element) { if isRightOfCall == false {
logLine.Time = element if regexpIsFullTime.MatchString(element) {
continue
}
// Is it a partial time ?
if regexpIsTimePart.MatchString(element) {
if logLine.Time == "" {
logLine.Time = element logLine.Time = element
} else { continue
goodPart := logLine.Time[:len(logLine.Time)-len(element)] }
logLine.Time = goodPart + element
// Is it a partial time ?
if regexpIsTimePart.MatchString(element) {
if logLine.Time == "" {
logLine.Time = element
} else {
goodPart := logLine.Time[:len(logLine.Time)-len(element)]
logLine.Time = goodPart + element
}
continue
} }
continue
} }
// Is it the OM's name (starting with "@") // Is it the OM's name (starting with "@")
if regexpIsOMname.MatchString(element) { if regexpIsOMname.MatchString(element) {
@ -150,6 +154,12 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
continue continue
} }
if isRightOfCall {
//This is probably a RST
//TODO: is it a number (or a data report)
//TODO: it is sent or rcvd
}
//If we come here, we could not make sense of what we found //If we come here, we could not make sense of what we found
errorMsg = errorMsg + "Unable to parse " + element + " " errorMsg = errorMsg + "Unable to parse " + element + " "

@ -67,6 +67,11 @@ func TestParseLine(t *testing.T) {
args{ inputStr: "#grid", previousLine: LogLine{ Mode: "SSB", }}, args{ inputStr: "#grid", previousLine: LogLine{ Mode: "SSB", }},
LogLine{ GridLoc: "grid", Mode: "SSB",}, "", LogLine{ GridLoc: "grid", Mode: "SSB",}, "",
}, },
{
"parse partial RST",
args{ inputStr: "1230 on4kjm 5", previousLine: LogLine{ Mode: "CW", }},
LogLine{ Call: "ON4KJM", Time: "1230", RSTsent: "559", Mode: "CW",}, "",
},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {

@ -6,12 +6,15 @@
## Test framework ## Test framework
* [x] enable TDD * [x] enable TDD
* [ ] automate build and test * [x] automate build and test
* [ ] type of target (cross compile) ? * [ ] Improve build processing (cross compile, directory)
* [ ] Perform the test of the complete app
## Input processing ## Input processing
* [ ] infer rst * [ ] infer rst
* [ ] DATE keyword is now optional
* [ ] New MYGRID keyword
* [ ] Create the logic to take over from the previous line * [ ] Create the logic to take over from the previous line
* [ ] Support different date delimiter * [ ] Support different date delimiter
* [ ] Support extrapolated date * [ ] Support extrapolated date

Loading…
Cancel
Save