21 lines
520 B
Go
21 lines
520 B
Go
package vstp
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"git.fjla.uk/owlboard/go-types/pkg/upstreamApi"
|
|
"git.fjla.uk/owlboard/timetable-mgr/log"
|
|
)
|
|
|
|
// Unmarshals the JSON data and returns the schedule data
|
|
func unmarshalData(jsonData []byte) (*upstreamApi.VSTPSchedule, error) {
|
|
var schedule upstreamApi.MsgData
|
|
err := json.Unmarshal(jsonData, &schedule)
|
|
if err != nil {
|
|
log.Error("Unable to unmarshal message body: " + err.Error())
|
|
return nil, err
|
|
}
|
|
log.Debug("Unmarshalling Complete")
|
|
return &schedule.Data.CIFMsg, nil
|
|
}
|