# UniTAP.dev.ports.modules.vtg.pg

class PGStatus:

Class `PGStatus` describes possible states of `PatternGenerator`.

PGStatus(value: int)
error: PGStatus.PGError

Returns pg error.

###### Returns:

> object of `PGError`

is_video_produced: bool

Returns state of video produced.

###### Returns:

> object of bool - is video produced or not

non_applied_changes: bool

Returns state of applied changes.

###### Returns:

> object of bool - were there any changes or not

class PGStatus.PGError(enum.IntEnum):

Class `PGError` contains codes of errors with the possibility of string representation.

NotReady = <PGError.NotReady: -1>
OK = <PGError.OK: 0>
HWFault = <PGError.HWFault: 1>
PixelClock = <PGError.PixelClock: 2>
MemoryError = <PGError.MemoryError: 3>
DscFileZero = <PGError.DscFileZero: 4>
DscPixelClockExceeds = <PGError.DscPixelClockExceeds: 5>
DscSourceNotSupport = <PGError.DscSourceNotSupport: 6>
DscSinkNotSupport = <PGError.DscSinkNotSupport: 7>
DscFailReadDpcd = <PGError.DscFailReadDpcd: 8>
DscFailWriteDpcd = <PGError.DscFailWriteDpcd: 9>
WrongColorFormat = <PGError.WrongColorFormat: 10>
WrongColorimetry = <PGError.WrongColorimetry: 11>
WrongBitsPerComponent = <PGError.WrongBitsPerComponent: 12>
WrongDynamicRange = <PGError.WrongDynamicRange: 13>
NotEnoughMemoryForPattern = <PGError.NotEnoughMemoryForPattern: 14>

##### Inherited Members

enum.Enum
  name
  value
builtins.int
  conjugate
  bit_length
  bit_count
  to_bytes
  from_bytes
  as_integer_ratio
  real
  imag
  numerator
  denominator

class PatternGenerator:

Main class `PatternGenerator` allows working with PG functionality on the device: set different types of pattern `set_pattern`, set different video modes `set_vm`, set additional parameters for some patterns `set_pattern_params`, get information about current video mode on stream `get_stream_video_mode`, `apply` all transferred setting, `reset` settings and read pattern generator `status`.

PatternGenerator( port_io: UniTAP.libs.lib_tsi.tsi_io.PortIO, memory_manager: UniTAP.dev.modules.memory_manager.memory_manager.MemoryManager, stream: int)
def set_pattern( self, pattern: Union[ UniTAP.dev.ports.modules.vtg.types.VideoPattern , str, bytearray, UniTAP.common.video_frame.VideoFrame , UniTAP.common.dsc_video_frame.VideoFrameDSC ]):

Allows setting video pattern on current stream. Possible variants:

- type `VideoPattern` - value from enum `VideoPattern` (one of th e possible predefined patterns).
- type str - path to image (bmp, png, jpeg, dsc and so on).
- type bytearray - raw image data, which will be loaded to device memory.
- type `VideoFrame` - object of class that contains the image data.
- type `VideoFrameDSC` - object of class that contains dsc image data.

###### Arguments:

- pattern (Union[`VideoPattern`, str, bytearray, `VideoFrame`, `VideoFrameDSC`])

def set_vm(self, vm: UniTAP.common.video_mode.VideoMode ):

Allows setting `VideoMode` on current stream.

###### Arguments:

- vm (VideoMode)

def set_pattern_params(self, pattern_params: ~PGPatternParams):

Allows setting additional parameters for some patters on current stream. See available `PGPatternParams` types: `SolidColorParams`, `WhiteVStripsParams`, `GradientStripsParams`, `MotionParams`,`SquareWindowParams` (see in pg pattern params).

###### Arguments:

- pattern_params (PGPatternParams)

def get_stream_video_mode(self) -> UniTAP.common.video_mode.VideoMode:

Returns `VideoMode` information about current stream.

###### Returns:

> object of VideoMode type

def apply(self) -> bool:

Apply all settings on current stream.

###### Returns:

> object of bool type - settings were set successfully or not

def status(self) -> PGStatus:

Returns `PGStatus` of current stream.

###### Returns:

> object of PGStatus type.

def reset(self):

Reset all setting on current stream.

def get_pixel_rate(self) -> int:

Returns current pixel rate.

###### Returns:

> object of int type

def panel_replay(self) -> Optional[ UniTAP.dev.ports.modules.panel_replay.pr.PanelReplay ]:

Returns object of PanelReplay if device supports this feature.

###### Returns:

> object of 'PanelReplay' type or None

class HdmiPatternGenerator(PatternGenerator):

Class `HdmiPatternGenerator` inherited from class `PatternGenerator`. Allows getting `timing_manager`, `max_stream_count`, `apply` PG settings. Also has all the `PatternGenerator` functionality.

HdmiPatternGenerator( port_io: UniTAP.libs.lib_tsi.tsi_io.PortIO, memory_manager: UniTAP.dev.modules.memory_manager.memory_manager.MemoryManager)
timing_manager: UniTAP.dev.ports.modules.vtg.timing_manager.TimingManager

Should be used for working with available timings on device.

###### Returns:

> object of `TimingManager` type.

max_stream_count: int

Returns maximum count of available streams.

###### Returns:

> object of int type.

def apply(self) -> bool:

Apply all settings.

###### Returns:

> object of bool type - settings were set successfully or not

##### Inherited Members

PatternGenerator
  set_pattern
  set_vm
  set_pattern_params
  get_stream_video_mode
  status
  reset
  get_pixel_rate
  panel_replay

class DpPatternGenerator(PatternGenerator):

Class `DpPatternGenerator` inherited from class `PatternGenerator`. Allows getting `timing_manager`, `adaptive_sync_status`, `apply` and `reset` PG settings and set additional settings: `set_as_config`, `set_scrolling_params`. Also has all the `PatternGenerator` functionality.

DpPatternGenerator( port_io: UniTAP.libs.lib_tsi.tsi_io.PortIO, memory_manager: UniTAP.dev.modules.memory_manager.memory_manager.MemoryManager, stream: int)
timing_manager: UniTAP.dev.ports.modules.vtg.timing_manager.TimingManager

Should be used for working with available timings on device.

###### Returns:

> object of `TimingManager` type.

def set_as_config(self, as_config: ~ASParams):

Allows setting adaptive sync configuration. See available `ASParams` types: `ConstantASParams`, `SquareASParams`, `ZigzagASParams`, `FixedASParams` (see in types).

###### Arguments:

- as_config (ASParams)

def set_scrolling_params(self, scrolling_params: ~PGScrollingParams):

Allows setting additional configuration for "Scrolling pattern". See available `PGScrollingParams` types: `StepsScrollingParams` (see in pg pattern params).

###### Arguments:

- scrolling_params (PGScrollingParams)

def adaptive_sync_status(self) -> bool:

Returns work status of adaptive sync.

###### Returns:

> object of bool type - adaptive sync enabled or not

def apply(self) -> bool:

Apply all settings.

###### Returns:

> object of bool type - settings were set successfully or not

def reset(self):

Reset all setting.

##### Inherited Members

PatternGenerator
  set_pattern
  set_vm
  set_pattern_params
  get_stream_video_mode
  status
  get_pixel_rate
  panel_replay

class DpMstPatternGenerator:

Class `DpMstPatternGenerator` allows working with one of the supported streams on the device (contains list of the `DpPatternGenerator` objects). To access the selected stream, use an override of `[ ]`. Also, allows working with stream number 0 directly and applying all settings of all streams together.

DpMstPatternGenerator( port_io: UniTAP.libs.lib_tsi.tsi_io.PortIO, memory_manager: UniTAP.dev.modules.memory_manager.memory_manager.MemoryManager, max_stream_count: int)
timing_manager: UniTAP.dev.ports.modules.vtg.timing_manager.TimingManager

Should be used for working with available timings on device.

###### Returns:

> object of `TimingManager` type.

max_stream_count: int

Returns maximum count of available streams.

###### Returns:

> object of int type.

def set_pattern( self, pattern: Union[ UniTAP.dev.ports.modules.vtg.types.VideoPattern , str, bytearray, UniTAP.common.video_frame.VideoFrame , UniTAP.common.dsc_video_frame.VideoFrameDSC ]):

Allows setting video pattern on stream number 0 of pattern generator. Possible variants:

- type `VideoPattern` - value from enum `VideoPattern` (one of th e possible predefined patterns).
- type str - path to image (bmp, png, jpeg, dsc and so on).
- type bytearray - raw image data, which will be loaded to device memory.
- type `VideoFrame` - object of class that contains the image data.
- type `VideoFrameDSC` - object of class that contains the dsc image data.

###### Arguments:

- pattern (Union[`VideoPattern`, str, bytearray, `VideoFrame`, `VideoFrameDSC`])

def set_vm(self, vm: UniTAP.common.video_mode.VideoMode ):

Allows setting `VideoMode` on stream number 0 of pattern generator.

###### Arguments:

- vm (VideoMode)

def set_pattern_params(self, pattern_params: ~PGPatternParams):

Allows setting additional parameters for some patters on stream number 0 of pattern generator. See available `PGPatternParams` types: `SolidColorParams`, `WhiteVStripsParams`, `GradientStripsParams`, `MotionParams`,`SquareWindowParams` (see in pg pattern params).

###### Arguments:

- pattern_params (PGPatternParams)

def set_as_config(self, as_config: ~ASParams):

Allows setting adaptive sync configuration on stream number 0 of pattern generator. See available `ASParams` types: `ConstantASParams`, `SquareASParams`, `ZigzagASParams`, `FixedASParams`. (see in types).

###### Arguments:

- as_config (ASParams)

def set_scrolling_params(self, scrolling_params: ~PGScrollingParams):

Allows setting additional configuration for "Scrolling pattern" on stream number 0 of pattern generator. See available `PGScrollingParams` types: `StepsScrollingParams` (see in pg pattern params).

###### Arguments:

- scrolling_params (PGScrollingParams)

def get_stream_video_mode(self) -> UniTAP.common.video_mode.VideoMode:

Returns `VideoMode` information about current configuration of PG on stream 0.

###### Returns:

> object of VideoMode type

def apply(self) -> bool:

Apply all setting on stream number 0 of pattern generator.

###### Returns:

> object of bool type - settings were set successfully or not

def status(self) -> PGStatus:

Returns `PGStatus` on stream number 0 of pattern generator.

###### Returns:

> object of PGStatus type.

def reset(self):

Reset all setting on stream number 0 of pattern generator.

def apply_all(self):

Apply all setting on all supported streams of pattern generator.

def get_pixel_rate(self, stream: int = 0) -> int:

Returns current pixel rate for selected stream.

###### Returns:

> object of int type

panel_replay: UniTAP.dev.ports.modules.panel_replay.pr.PanelReplay

Returns object of PanelReplay if device supports this feature (first stream).

###### Returns:

> object of 'PanelReplay' type or None