Documentation ¶
Overview ¶
Package mechcamera distributes available camera names along with shutterbug-to-camera associations to clients and receives camera association requests from clients.
Index ¶
- Constants
- func NewCameraHandleFunc(reg Registry, shutterbugs mechshutterbug.Containser) http.HandlerFunc
- type Associations
- type AssociationsSchema
- type RegAsc
- type Registry
- func (r Registry) AllAssociatedCameras() []string
- func (r Registry) AllAssociatedShutterbugs() []string
- func (r Registry) Associate(a ShutterbugAssociations) bool
- func (r Registry) Associated(shutterbug string) []string
- func (r Registry) AssociatedShutterbugs(camera string) []string
- func (r Registry) Associations(shutterbug string) (Associations, bool)
- func (r Registry) Contains(camera string) bool
- func (r Registry) Deregister(cameras ...string)
- func (r Registry) Disassociate(camera string)
- func (r Registry) DisassociateShutterbug(shutterbug string)
- func (r Registry) IsPartial(camera string) bool
- func (r Registry) Pop() (ShutterbugAssociations, error)
- func (r Registry) Register(cameras ...string)
- func (r Registry) Registered() []string
- func (r Registry) RemoveShutterbug(shutterbug string)
- func (r Registry) Watch() <-chan struct{}
- type ShutterbugAssociations
- type Stitching
Constants ¶
const ( // Uni implies no stitching. A single camera occupies the whole view. Uni = Stitching(iota) // Bi is two overlapping cameras. Both cameras occupy the whole view. Bi // BiPartial is a partial overlapping of one camera by another. The rear // camera occupies the whole view. The closest occupies a smaller rectangle. BiPartial // Tri is three overlapping cameras. All three cameras occupy the whole // view. Tri // TriPartial is a partial overlapping of one camera by two others. The rear // camera occupies the whole view. The two closer cameras occupy mutually // exclusive smaller rectangles. TriPartial // Quad is four overlapping cameras. All four cameras occupy the whole view. Quad // QuadPartial is a partial overlapping of one camera by three others. The // rear camera occupies the whole view. The three closer cameras occupy // mutually exclusive smaller rectangles. QuadPartial )
Variables ¶
This section is empty.
Functions ¶
func NewCameraHandleFunc ¶
func NewCameraHandleFunc( reg Registry, shutterbugs mechshutterbug.Containser, ) http.HandlerFunc
NewCameraHandleFunc creates a HTTP request handler which allows clients to interface with the camera registry.
The handler upgrades the HTTP request to a websocket. The websocket's first ever incoming message should be a valid shutterbug.
Types ¶
type Associations ¶
type Associations struct { Cameras []string // In farthest to closest stacking order. Stitching Stitching }
func (Associations) IsPartial ¶
func (a Associations) IsPartial(camera string) bool
IsPartial reports whether the given camera has a partial camera status in this association.
func (Associations) Key ¶
func (a Associations) Key() string
Key can be used as a unique key in, for example, a cache of stitched images for this exact combination of cameras and stitching.
func (Associations) StitchWithCPU ¶
func (a Associations) StitchWithCPU( s *wiregl.CPUStitcher, vp ...wiregl.Pixels, ) wiregl.PixelData
StitchWithCPU the given images where each image corresponds to the view from the camera with the same index in the associations.
In the case of a single camera just return the camera's pixel data unmodified.
type AssociationsSchema ¶
type Registry ¶
Registry is a register of currently available cameras by name and shutterbug to camera associations.
When the registered cameras or associated cameras state changes the new state is sent out to clients connected to the registry.
It also receives the new shutterbug/camera association requests from the connected clients and stores them in a queue.
func (Registry) AllAssociatedCameras ¶
AllAssociatedCameras to any shutterbug.
func (Registry) AllAssociatedShutterbugs ¶
AllAssociatedShutterbugs to any camera.
func (Registry) Associate ¶
func (r Registry) Associate(a ShutterbugAssociations) bool
Associate a shutterbug with the given cameras overwriting any existing associations.
Return false and do nothing if any of the given cameras are not registered.
func (Registry) Associated ¶
Associated cameras to the shutterbug.
func (Registry) AssociatedShutterbugs ¶
AssociatedShutterbugs is the shutterbugs associated with the camera.
func (Registry) Associations ¶
func (r Registry) Associations(shutterbug string) (Associations, bool)
Associations of the shutterbug if the shutterbug has any. Return false if there are no associations.
func (Registry) Deregister ¶
Deregister the cameras with the given names and disassociate them from any shutterbugs.
func (Registry) Disassociate ¶
Disassociate the given camera from any associated shutterbugs.
func (Registry) DisassociateShutterbug ¶
DisassociateShutterbug clears the given shutterbug's associations.
func (Registry) IsPartial ¶
IsPartial is true if the given camera is associated with any shutterbug in a partial capacity, that is, it is placed non first in any shutterbug's list of associated cameras and the association uses a partial stitching.
func (Registry) Pop ¶
func (r Registry) Pop() (ShutterbugAssociations, error)
Pop an association request from the front of the association requests queue.
func (Registry) RemoveShutterbug ¶
RemoveShutterbug from the registry disassociating it from any cameras and closing the associated HTTP request handlers using that shutterbug.
type ShutterbugAssociations ¶
type ShutterbugAssociations struct { Cameras []string // In farthest to closest stacking order. Shutterbug string Stitching Stitching }
ShutterbugAssociations between a shutterbug and some cameras.