Documentation ¶
Overview ¶
Package common defines common interfaces and types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorInvalidActivationRequest = errors.New("Invalid activation request ID")
ErrorInvalidActivationRequest ...
View Source
var ErrorInvalidTicket = errors.New("Invalid Ticket")
ErrorInvalidTicket ...
Functions ¶
This section is empty.
Types ¶
type BarCoder ¶
type BarCoder interface { SetFormat(enc EncodingFormat) Encode(w io.Writer, txt string) error }
BarCoder can generate bar codes, qr-codes, data matrixes, ...
type EncodingFormat ¶
type EncodingFormat int
EncodingFormat defines QR, DataMatrix, ...
const ( QR200x200H EncodingFormat = iota QR300x300H DM200x200 DM300x300 )
Encoding formats that are available.
type Role ¶
type Role int
Role defines the role a device can be granted.
type Storer ¶
type Storer interface { Pinger Close() error // Device management GetRole(deviceID string) Role SetRole(deviceID string, role Role) UnsetRole(deviceID string) // CreateRequestID generates a request ID to activate for a given role. CreateRequestID(role Role) (requestID string) // Activate using the generated requestID // You may implemet it so that activation can only happens within certain timeframe, // or only once, or only for a single device, ... Activate(deviceID string, requestID string) (Role, error) GetTicket(tid string) Ticket SaveTicket(t Ticket) error }
Storer is the minimum required interface for data storage.
type Ticket ¶
type Ticket struct { TID string // Ticket ID Holder string // Ticket holder information Mail string // Email to forward the ticket when issued Issued bool // If not issued, ticket is not yet valid. From, To time.Time // Validity period Entries, Exits int // Counters }
Ticket data structure.
Click to show internal directories.
Click to hide internal directories.