Integration of Route into feragstring and production drop
This commit is contained in:
parent
ff7bf5fdf8
commit
5387d9b9ae
3 changed files with 189 additions and 15 deletions
|
|
@ -6,6 +6,48 @@ type ProductionDrop struct {
|
|||
FeragMessage
|
||||
agentName string
|
||||
numberOfCopies int
|
||||
dontProduce bool
|
||||
topsheetData string
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) TopsheetData() string {
|
||||
if pd.topsheetData == "" {
|
||||
return ""
|
||||
}
|
||||
tsd := pd.topsheetData
|
||||
if len(tsd) > 5996 {
|
||||
tsd = tsd[:5996]
|
||||
}
|
||||
|
||||
tsdSegment := fmt.Sprintf("+58%s", tsd)
|
||||
|
||||
fm := FeragMessage{
|
||||
messageStart: "2414",
|
||||
messageEnd: "!",
|
||||
}
|
||||
message := fm.MessageTemplate()
|
||||
return message(&fm, tsdSegment)
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) SetTopsheetData(topsheetData string) {
|
||||
pd.topsheetData = topsheetData
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) ControlCharacter() string {
|
||||
var ccCount int
|
||||
var cc string
|
||||
if pd.dontProduce == true {
|
||||
cc += "D"
|
||||
ccCount++
|
||||
}
|
||||
if ccCount == 0 {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("+14%-16s", cc)
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) SetDontProduce() {
|
||||
pd.dontProduce = true
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) NumberOfCopies() string {
|
||||
|
|
@ -30,6 +72,7 @@ func NewProductionDrop() *ProductionDrop {
|
|||
messageStart: "2403",
|
||||
messageEnd: "!",
|
||||
},
|
||||
dontProduce: false,
|
||||
}
|
||||
return &pd
|
||||
}
|
||||
|
|
@ -37,6 +80,7 @@ func NewProductionDrop() *ProductionDrop {
|
|||
func (pd *ProductionDrop) Payload() string {
|
||||
data := pd.AgentName()
|
||||
data += pd.NumberOfCopies()
|
||||
data += pd.ControlCharacter()
|
||||
return data
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue