-
Notifications
You must be signed in to change notification settings - Fork 3
/
beacon.go
21 lines (18 loc) · 843 Bytes
/
beacon.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package passbook
import (
"encoding/json"
"errors"
)
// Beacon Dictionary: Information about a location beacon. Available in iOS 7.0.
type Beacon struct {
ProximityUUID string `json:"proximityUUID"` // Unique identifier of a Bluetooth Low Energy location beacon.
Major uint16 `json:"major,omitempty"` // Major identifier of a Bluetooth Low Energy location beacon.
Minor uint16 `json:"minor,omitempty"` // Minor identifier of a Bluetooth Low Energy location beacon.
RelevantText string `json:"relevantText,omitempty"` // Text displayed on the lock screen when the pass is currently relevant.
}
func (b Beacon) Marshal() ([]byte, error) {
if b.ProximityUUID == "" {
return nil, errors.New("Unique identifier of a Bluetooth Low Energy location beacon must be set")
}
return json.Marshal(b)
}