Documentation
¶
Overview ¶
Package bcudp carries a Baichuan byte stream over the UDP transport that battery cameras speak instead of TCP port 9000. See docs/udp.md.
Index ¶
- Variables
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(b []byte) (int, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(time.Time) error
- func (c *Conn) Write(b []byte) (int, error)
- type Event
- type Info
Constants ¶
This section is empty.
Variables ¶
var ErrSilent = errors.New("bcudp: camera stopped answering")
ErrSilent means the camera sent nothing for silenceLimit.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is one UDP session with a battery camera, as a reliable ordered byte stream. It implements net.Conn.
func Dial ¶
Dial wakes the battery camera at host, opens a session with it, and returns the session as a byte stream carrying Baichuan.
func (*Conn) Read ¶
Read reads the camera's byte stream. A D2C_DISC from the camera reads as io.EOF once everything before it has been read.
func (*Conn) RemoteAddr ¶
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline is accepted and ignored: Write never blocks on the camera.
type Event ¶
Event is one decrypted cloud event report. Body is the JSON the camera sent, for example {"event":3} for motion. Seq is the sequence number, which is also the key the body was encrypted under.
func DecodeEvent ¶
DecodeEvent parses and decrypts a cf31 event packet. It verifies the checksum against the ciphertext exactly as the camera computes it, and rejects a truncated or corrupt packet rather than returning half an event.
type Info ¶
type Info struct {
Addr net.IP
UID string
Asleep bool // the reply carried a battery block, which only a sleeping camera sends
Battery int // percent, or -1 when the reply carried none
}
Info is a battery camera's answer to a search.