class UsbVideoStream

Defined at line 101 of file ../../src/camera/drivers/usb_video/usb_video_stream.h

UsbVideoStream State Machine:

[DISCONNECTED] ------

<GetChannel

()>---------> [STOPPED]

/|

\

/ |

| --------

<stream

.OnClose()> |

<control

.OnClose>--/-------------- / |

| /

\

|

\

|/

[STREAMING]

<

--Start()--- [READY]

<

---

<CreateStream

()>

All states ------> Unbind() ----> [UNBOUND]

State transition table:

Cells marked with Error will return an error if attempted, but

will not result in a state transition.

Cells marked with N/A are not possible due to lack of channel to

make the call.

Initial State

| DISCONNECTED | STOPPED | READY | STREAMING

GetChannel | STOPPED | Error! | Error! | Error!

CreateStream | N/A | READY | Error! | Error!

Start | N/A | N/A | STREAMING | Error!

Stop | N/A | N/A | Error! | READY

stream close | N/A | N/A | STOPPED | STOPPED

control close | N/A | DISCONNECTED| DISCONNECTED | DISCONNECTED

DdkUnbind | UNBOUND | UNBOUND | UNBOUND | UNBOUND

The Unbind action closes all channels, and disallows any further state transitions.

The state can be determined as follows:

if (unbind txn set) -> UNBOUND

if (!control channel) -> DISCONNECTED

elif (!stream channel) -> STOPPED

elif (!is_streaming_) -> READY

else -> STREAMING

This device does not allow multiple simultaneous control connections via GetChannel,

nor does it allow multiple streaming connections via CreateStream.

Any failure in communication over the control or stream channel will result in that channel

being closed, along with the state transitions that closure implies.

Calling Stop() may not stop the usb device from streaming video frames, but

It will cause this device to stop notifying the client of new frames via OnFrameAvailable.

When Start() is called after calling Stop(), OnFrameAvailable will be called when the next

available frame is filled, so the capture time may have occurred before Start() was called.

The stream_token eventpair passed with CreateStream will be ignored by this device,

although it will retain ownership of the token until the stream is shut down following

closure of the stream channel.

Unless specified otherwise, all methods of this class are assumed to be called

on the single threaded dispatcher owned by this class.

Public Methods

void UsbVideoStream (zx_device_t * parent, usb_protocol_t usb, StreamingSetting settings)

Constructor is assumed to be called only through Bind, or suitable testing rig.

This method will not be called on the fidl_dispatch_loop_.

Defined at line 53 of file ../../src/camera/drivers/usb_video/usb_video_stream.cc

zx_status_t Bind (void * ctx, zx_device_t * device)

This method will not be called on the fidl_dispatch_loop_.

Defined at line 63 of file ../../src/camera/drivers/usb_video/usb_video_stream.cc

void DdkUnbind (::ddk::UnbindTxn txn)

DDK device implementation

DdkUnbind posts an async task on the fidl_dispatch_loop_.

Defined at line 112 of file ../../src/camera/drivers/usb_video/usb_video_stream.h

void DdkRelease ()

Release is guaranteed to only be called after receiving the async reply

to DdkUnbind.

This method will not be called on the fidl_dispatch_loop_.

Defined at line 120 of file ../../src/camera/drivers/usb_video/usb_video_stream.h

void ~UsbVideoStream ()

Defined at line 121 of file ../../src/camera/drivers/usb_video/usb_video_stream.h

Friends

void UsbVideoStream (async_dispatcher_t * async_task_t * zx_status_t )