2024-04-15 20:03:48 +01:00
|
|
|
package vstp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"git.fjla.uk/owlboard/go-types/pkg/upstreamApi"
|
|
|
|
"git.fjla.uk/owlboard/timetable-mgr/log"
|
|
|
|
)
|
|
|
|
|
2024-04-24 23:09:34 +01:00
|
|
|
// Unmarshals the JSON data and returns the schedule data
|
|
|
|
func unmarshalData(jsonData []byte) (*upstreamApi.VSTPSchedule, error) {
|
2024-04-15 20:03:48 +01:00
|
|
|
var schedule upstreamApi.MsgData
|
2024-04-24 23:09:34 +01:00
|
|
|
err := json.Unmarshal(jsonData, &schedule)
|
2024-04-15 20:03:48 +01:00
|
|
|
if err != nil {
|
|
|
|
log.Error("Unable to unmarshal message body: " + err.Error())
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
log.Debug("Unmarshalling Complete")
|
|
|
|
return &schedule.Data.CIFMsg, nil
|
|
|
|
}
|