Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package participanthandler
|
||||
|
||||
import "log"
|
||||
|
||||
func (c *ParticipantHandler) GetAllParticipants() []*CheckIfParticipantIsValidReturn {
|
||||
// Erstellen einer Anfrage zur Überprüfung der Teilnehmergültigkeit
|
||||
req := CheckIfParticipantIsValidRequest{Type: "baseDlRequest", UUID: "UUID"}
|
||||
|
||||
// Senden der Anfrage über das ParticipantManagement
|
||||
c.ParticipantManagement.WriteJSON(req)
|
||||
|
||||
var res CheckIfParticipantIsValidResponse
|
||||
for {
|
||||
// Lesen der Antwort vom ParticipantManagement
|
||||
err := c.ParticipantManagement.ReadJSON(&res)
|
||||
if err != nil {
|
||||
log.Fatal("CheckIfParticipantIsValidRequest - Error getting participant data:", err)
|
||||
}
|
||||
|
||||
// Überprüfen, ob die Antwort den erwarteten Typ hat
|
||||
if res.Type == "participantBaseData" {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var participantData []*CheckIfParticipantIsValidReturn
|
||||
// Durchlaufen der Teilnehmerdaten, um den passenden Teilnehmer zu finden
|
||||
for _, participant := range res.Data {
|
||||
if participant.PartyID == 2 || participant.PartyID == 3 || participant.PartyID == 4 {
|
||||
if participant.EquipmentNumber != 0 {
|
||||
participantData = append(participantData, &CheckIfParticipantIsValidReturn{
|
||||
TacticalIdentifier: participant.TacticalIdentifier,
|
||||
Designator: participant.Designator,
|
||||
EquipmentNumber: participant.EquipmentNumber,
|
||||
Valid: true,
|
||||
PartyId: participant.PartyID,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return participantData
|
||||
}
|
||||
Reference in new issue
Block a user