Documentation ¶
Overview ¶
Package http implements a http-like hap server to handle requests and responses.
Index ¶
- func JSONDecode(r io.Reader, v interface{}) error
- func JSONEncode(v interface{}) (*bytes.Buffer, error)
- func ReadJSON(w http.ResponseWriter, r *http.Request, v interface{}) error
- func WriteJSON(w http.ResponseWriter, r *http.Request, v interface{}) error
- type CharacteristicRequest
- type CharacteristicResponse
- type CharacteristicsResponse
- type Config
- type ErrResponse
- type Server
- func (s *Server) Accept() (con net.Conn, err error)
- func (srv *Server) Accessories(w http.ResponseWriter, r *http.Request)
- func (s *Server) Addr() net.Addr
- func (srv *Server) Authenticate(next http.Handler) http.Handler
- func (srv *Server) Characteristics(w http.ResponseWriter, r *http.Request)
- func (s *Server) Close() error
- func (srv *Server) Identify(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListenAndServe(ctx context.Context) error
- func (s *Server) Port() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONDecode ¶ added in v1.2.3
func JSONEncode ¶ added in v1.2.3
Types ¶
type CharacteristicRequest ¶ added in v1.2.3
type CharacteristicResponse ¶ added in v1.2.3
type CharacteristicResponse struct { AccessoryID uint64 `json:"aid"` CharacteristicID uint64 `json:"iid"` Value interface{} `json:"value,omitempty"` // Status contains the status code. Should be interpreted as integer. // The property is omitted if not specified, which makes the payload smaller. Status *int `json:"status,omitempty"` }
type CharacteristicsResponse ¶ added in v1.2.3
type CharacteristicsResponse struct {
Characteristics []CharacteristicResponse `json:"characteristics"`
}
type ErrResponse ¶ added in v1.2.3
type ErrResponse struct {
Status int `json:status`
}
ErrResponse is an error response.
type Server ¶
func (*Server) Accessories ¶ added in v1.2.3
func (srv *Server) Accessories(w http.ResponseWriter, r *http.Request)
func (*Server) Authenticate ¶ added in v1.2.3
Authenticate verfies that a sesson for the request is available.
func (*Server) Characteristics ¶ added in v1.2.3
func (srv *Server) Characteristics(w http.ResponseWriter, r *http.Request)
Characteristics Handles GET and PUT requests for the /characteristics endpoint.
Click to show internal directories.
Click to hide internal directories.