driver

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Command                   = "command"
	UsbProtocol               = "USB"
	Path                      = "Path"
	SerialNumber              = "SerialNumber"
	CardName                  = "CardName"
	BasePath                  = "/dev/video"
	AutoStreaming             = "AutoStreaming"
	InputIndex                = "InputIndex"
	UrlRawQuery               = "urlRawQuery"
	RtspServerHostName        = "RtspServerHostName"
	DefaultRtspServerHostName = "localhost"
	RtspTcpPort               = "RtspTcpPort"
	DefaultRtspTcpPort        = "8554"
	RtspUriScheme             = "rtsp"
	Stream                    = "stream"
	PrefixInput               = "Input"
	PrefixOutput              = "Output"

	// API route specific to Device Service
	ApiRefreshDevicePaths = "/refreshdevicepaths"

	// Metadata descriptions
	DescNotSpecified = "not specified"
	DescTimePerFrame = "time per frame"
	DescHighQuality  = "high quality"

	// Command names
	MetadataDeviceCapability    = "METADATA_DEVICE_CAPABILITY"
	MetadataCurrentVideoInput   = "METADATA_CURRENT_VIDEO_INPUT"
	MetadataCameraStatus        = "METADATA_CAMERA_STATUS"
	MetadataDataFormat          = "METADATA_DATA_FORMAT"
	MetadataCroppingAbility     = "METADATA_CROPPING_ABILITY"
	MetadataStreamingParameters = "METADATA_STREAMING_PARAMETERS"
	MetadataImageFormats        = "METADATA_IMAGE_FORMATS"
	VideoStartStreaming         = "VIDEO_START_STREAMING"
	VideoStopStreaming          = "VIDEO_STOP_STREAMING"
	VideoStreamUri              = "VIDEO_STREAM_URI"
	VideoStreamingStatus        = "VIDEO_STREAMING_STATUS"

	// FFmpeg options
	FFmpegFrames      = "-frames:d"
	FFmpegFps         = "-r"
	FFmpegSize        = "-s"
	FFmpegAspect      = "-aspect"
	FFmpegQScale      = "-qscale"
	FFmpegVCodec      = "-vcodec"
	FFmpegInputFormat = "-input_format"

	// udev device properties
	UdevSerialShort = "ID_SERIAL_SHORT"
	UdevV4lProduct  = "ID_V4L_PRODUCT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability struct {
	Driver     string
	Card       string
	BusInfo    string
	Version    string
	DriverCaps []string
	DeviceCaps []string
}

type CaptureMode

type CaptureMode struct {
	Desc  string
	Value v4l2.StreamParamFlag
}

type DataFormat

type DataFormat struct {
	Width        uint32
	Height       uint32
	PixelFormat  string
	Field        string
	BytesPerLine uint32
	SizeImage    uint32
	Colorspace   string
	XferFunc     string
	YcbcrEnc     string
	Quantization string
}

type Device

type Device struct {
	// contains filtered or unexported fields
}

func (*Device) StartStreaming

func (dev *Device) StartStreaming(ctx context.Context, cancel context.CancelFunc) (<-chan error, error)

func (*Device) StopStreaming

func (dev *Device) StopStreaming()

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

func NewProtocolDriver

func NewProtocolDriver() *Driver

NewProtocolDriver initializes the singleton Driver and returns it to the caller

func (*Driver) AddDevice

func (d *Driver) AddDevice(deviceName string, protocols map[string]models.ProtocolProperties,
	adminState models.AdminState) error

AddDevice is a callback function that is invoked when a new Device associated with this Device Service is added

func (*Driver) Discover

func (d *Driver) Discover()

Discover triggers protocol specific device discovery, which is an asynchronous operation. Devices found as part of this discovery operation are written to the channel devices.

func (*Driver) HandleReadCommands

func (d *Driver) HandleReadCommands(deviceName string, protocols map[string]models.ProtocolProperties,
	reqs []sdkModels.CommandRequest) ([]*sdkModels.CommandValue, error)

func (*Driver) HandleWriteCommands

func (d *Driver) HandleWriteCommands(deviceName string, protocols map[string]models.ProtocolProperties,
	reqs []sdkModels.CommandRequest, params []*sdkModels.CommandValue) error

func (*Driver) Initialize

func (d *Driver) Initialize(lc logger.LoggingClient, asyncCh chan<- *sdkModels.AsyncValues,
	deviceCh chan<- []sdkModels.DiscoveredDevice) error

Initialize performs protocol-specific initialization for the device service.

func (*Driver) RefreshExistingDevicePaths

func (d *Driver) RefreshExistingDevicePaths()

RefreshExistingDevicePaths checks whether the existing devices match the connected devices. If there is a mismatch between them, scan all paths to find the matching device and update the existing device with the correct path.

func (*Driver) RemoveDevice

func (d *Driver) RemoveDevice(deviceName string, protocols map[string]models.ProtocolProperties) error

RemoveDevice is a callback function that is invoked when a Device associated with this Device Service is removed

func (*Driver) Stop

func (d *Driver) Stop(force bool) error

func (*Driver) UpdateDevice

func (d *Driver) UpdateDevice(deviceName string, protocols map[string]models.ProtocolProperties,
	adminState models.AdminState) error

UpdateDevice is a callback function that is invoked when a Device associated with this Device Service is updated

type EdgeXErrorWrapper

type EdgeXErrorWrapper struct{}

func (EdgeXErrorWrapper) CommandError

func (e EdgeXErrorWrapper) CommandError(command string, err error) errors.EdgeX

type FFmpeg

type FFmpeg struct {
	// contains filtered or unexported fields
}

func (FFmpeg) ObtainInputFps

func (f FFmpeg) ObtainInputFps(value string) []string

func (FFmpeg) ObtainInputImageSize

func (f FFmpeg) ObtainInputImageSize(value string) []string

func (FFmpeg) ObtainInputPixelFormat

func (f FFmpeg) ObtainInputPixelFormat(value string) []string

func (FFmpeg) ObtainOutputAspect

func (f FFmpeg) ObtainOutputAspect(value string) []string

func (FFmpeg) ObtainOutputFps

func (f FFmpeg) ObtainOutputFps(value string) []string

func (FFmpeg) ObtainOutputFrames

func (f FFmpeg) ObtainOutputFrames(value string) []string

func (FFmpeg) ObtainOutputImageSize

func (f FFmpeg) ObtainOutputImageSize(value string) []string

func (FFmpeg) ObtainOutputVideoCodec

func (f FFmpeg) ObtainOutputVideoCodec(value string) []string

func (FFmpeg) ObtainOutputVideoQuality

func (f FFmpeg) ObtainOutputVideoQuality(value string) []string

type HttpHandler

type HttpHandler struct {
	// contains filtered or unexported fields
}

func NewHttpHandler

func NewHttpHandler(driver *Driver) HttpHandler

func (HttpHandler) RefreshExistingDevicePaths

func (h HttpHandler) RefreshExistingDevicePaths(writer http.ResponseWriter, request *http.Request)

type ImageFormat

type ImageFormat struct {
	Index       uint32
	BufType     v4l2.BufType
	Flags       v4l2.FmtDescFlag
	Description string
	PixelFormat string
	MbusCode    uint32
	FrameSizes  []v4l2.FrameSize
}

type StreamingCapability

type StreamingCapability struct {
	Desc  string
	Value v4l2.StreamParamFlag
}

type StreamingParameters

type StreamingParameters struct {
	Capability   StreamingCapability
	CaptureMode  CaptureMode
	TimePerFrame v4l2.Fract
	ReadBuffers  uint32
}

Jump to

Keyboard shortcuts

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