Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnexpectedStatus = errors.New("unexpected camera response status")
ErrUnexpectedStatus is returned when a camera answers with anything other than 200 OK. Callers that need to react to an unreachable-but-answering camera (rather than to any failure) can match it with errors.Is.
Functions ¶
func MakeAuthenticatedRequest ¶
func MakeAuthenticatedRequest(auth *string, method string, body string, url string) (*bytes.Buffer, int, error)
MakeAuthenticatedRequest Sends a request to the camera. Example usage: c.makeAuthenticatedRequest("GET", "/base","/some.cgi?preset=1") Returns the response body as a buffer.
Anything other than 200 OK is an error: a camera that is powered down but still answering, one that rejects the configured credentials, or one that fails internally must not look like a successful preset change or a valid snapshot to the caller. The status code is still returned alongside the error so callers can tell "unauthorized" from "not found" without matching on the message.
func SaveResponseBuffer ¶
SaveResponseBuffer saves the response buffer to a file. A failed write leaves no file behind: a truncated snapshot on disk is indistinguishable from a whole one for everything downstream, so the partial file is removed instead.
Types ¶
This section is empty.