func ParseToCOSTLV()

in server/coscel/cos_tlv.go [93:103]


func ParseToCOSTLV(t cel.TLV) (COSTLV, error) {
	if !IsCOSTLV(t) {
		return COSTLV{}, fmt.Errorf("TLV type %v is not a COS event", t.Type)
	}
	nestedEvent := cel.TLV{}
	err := nestedEvent.UnmarshalBinary(t.Value)
	if err != nil {
		return COSTLV{}, err
	}
	return COSTLV{ContentType(nestedEvent.Type), nestedEvent.Value}, nil
}