endpoint

package
v1.1.1-0...-6dff958 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package endpoint implements the HAP endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessories

type Accessories struct {
	http.Handler
	// contains filtered or unexported fields
}

Accessories handles the /accessories endpoint and returns all accessories as JSON

This endpoint is not session based and the same for all connections because the encryption/decryption is handled by the connection automatically.

func NewAccessories

func NewAccessories(c hap.AccessoriesHandler, mutex *sync.Mutex) *Accessories

NewAccessories returns a new handler for accessories endpoint

func (*Accessories) ServeHTTP

func (handler *Accessories) ServeHTTP(response http.ResponseWriter, request *http.Request)

type Characteristics

type Characteristics struct {
	http.Handler
	// contains filtered or unexported fields
}

Characteristics handles the /characteristics endpoint

This endpoint is not session based and the same for all connections because the encryption/decryption is handled by the connection automatically.

func NewCharacteristics

func NewCharacteristics(context hap.Context, c hap.CharacteristicsHandler, mutex *sync.Mutex) *Characteristics

NewCharacteristics returns a new handler for characteristics endpoint

func (*Characteristics) ServeHTTP

func (handler *Characteristics) ServeHTTP(response http.ResponseWriter, request *http.Request)

type GetImageFunc

type GetImageFunc func(width, height uint) (*image.Image, error)

type Identify

type Identify struct {
	http.Handler
	// contains filtered or unexported fields
}

Identify handles the unencrypted /identify endpoint by calling IdentifyAccessory() on the IdentifyHandler

func NewIdentify

func NewIdentify(h hap.IdentifyHandler) *Identify

NewIdentify returns an object which serves the /identify endpoint

func (*Identify) ServeHTTP

func (i *Identify) ServeHTTP(response http.ResponseWriter, request *http.Request)

type ImageRequest

type ImageRequest struct {
	Type   string `json:"resource-type"`
	Width  uint   `json:"image-width"`
	Height uint   `json:"image-height"`
}

type PairSetup

type PairSetup struct {
	http.Handler
	// contains filtered or unexported fields
}

PairSetup handles the /pair-setup endpoint and returns TLV8 encoded data.

This endoint is session based and handles requests based on their connections. Which means that there is one pair setup controller for every connection. This is required to support simultaneous pairing connections.

When pairing finished, the DevicePaired event is sent using an event emitter.

func NewPairSetup

func NewPairSetup(context hap.Context, device hap.SecuredDevice, database db.Database, emitter event.Emitter) *PairSetup

NewPairSetup returns a new handler for pairing endpoint

func (*PairSetup) ServeHTTP

func (endpoint *PairSetup) ServeHTTP(response http.ResponseWriter, request *http.Request)

type PairVerify

type PairVerify struct {
	http.Handler
	// contains filtered or unexported fields
}

PairVerify handles the /pair-verify endpoint and returns TLV8 encoded data

This endoint is session based and handles requests based on their connections. Which means that there is one pair verify controller for every connection. This is required to support simultaneous verification connections.

func NewPairVerify

func NewPairVerify(context hap.Context, database db.Database) *PairVerify

NewPairVerify returns a new endpoint for pair verify endpoint

func (*PairVerify) ServeHTTP

func (endpoint *PairVerify) ServeHTTP(response http.ResponseWriter, request *http.Request)

type Pairing

type Pairing struct {
	http.Handler
	// contains filtered or unexported fields
}

Pairing handles the /pairings endpoint.

This endpoint is not session based and the same for all connections.

func NewPairing

func NewPairing(controller *pair.PairingController, emitter event.Emitter) *Pairing

NewPairing returns a new handler for pairing enpdoint

func (*Pairing) ServeHTTP

func (endpoint *Pairing) ServeHTTP(response http.ResponseWriter, request *http.Request)

type Resource

type Resource struct {
	http.Handler
	// contains filtered or unexported fields
}

Resource handles the /resource endpoint

func NewResource

func NewResource(context hap.Context, imgFn GetImageFunc) *Resource

NewResource returns a new handler for resource requests

func (*Resource) ServeHTTP

func (handler *Resource) ServeHTTP(response http.ResponseWriter, request *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL