# Is there a way to generate a customised mock driver similar to CVMock.vin?

**URL:** <https://forum.commonvisionblox.com/t/is-there-a-way-to-generate-a-customised-mock-driver-similar-to-cvmock-vin/1571>\
**Category:** Programming Questions\
**Created:** [December 21, 2021, 12:37pm UTC](https://forum.commonvisionblox.com/t/is-there-a-way-to-generate-a-customised-mock-driver-similar-to-cvmock-vin/1571 "2021-12-21T12:37:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Foster](https://avatars.discourse-cdn.com/v4/letter/f/aca169/32.png) [@Foster](https://forum.commonvisionblox.com/u/Foster)\
**Post date:** [December 21, 2021, 12:37pm UTC](https://forum.commonvisionblox.com/t/is-there-a-way-to-generate-a-customised-mock-driver-similar-to-cvmock-vin/1571/1 "2021-12-21T12:37:43Z")

</div>

Hi there,  
When I do not have a camera attached, for my testing I use the CVMock.vin driver. However, it would be preferred if I could have mock image data that is more applicable to the application to aid camera-less testing. Is it possible to generate our own ‘mock.vin’ file, and if so, how can one go about doing this?

Thanks in advance…

---

<div class="post-metadata">

**Author:** ![illusive](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/illusive/32/61_2.png) [@illusive](https://forum.commonvisionblox.com/u/illusive)\
**Post date:** [December 21, 2021, 1:16pm UTC](https://forum.commonvisionblox.com/t/is-there-a-way-to-generate-a-customised-mock-driver-similar-to-cvmock-vin/1571/2 "2021-12-21T13:16:45Z")

</div>

Hi @Foster

yes, it is in fact possible to configure what the _CVMock.vin_ driver shows. The driver evaluates the _CVMock.ini_ file which it is searching in either _%CVBDATA%Drivers_ or in the application’s current directory (if the file exists in both locations, the one in the current directory has priority over the one in _%CVBDATA%Drivers_.

The file is - as the name implies - an old-style ini file with name/value pairs. There are a few of them sprinkled over the :cvb: installation and most of them contain a description of how to fill them out, along with one or more sample configurations:

```auto
; INI for CVMock.vin 

; --------------------------------------------------------------------------------------------------
; The CVMock.vin driver will first attempt to find this configuration file in the working directory
; of the calling application. If none is found, the CVMock.ini from %CVBDATA%drivers is used.
; --------------------------------------------------------------------------------------------------

; MockType:
; 0 -> MockVin generated image
; 1 -> Load Emu file from loadPath
; If .emu files with loadAtOnce = 0 are loaded, the buffer size is set to
; imgBuff which then mustn't be 0!
; 2 -> Load image files from loadPath

; LoadPath
; Location where images or .emu to load are stored. Shortcuts for the leading path
; component are available for: 
;
; Environment strings:
; To utilize an environment string as a part of the path, use the 
; respective name enclosed in percentage signs (%).
; E.g. %CVB%/tutorial
;
; Application directory:
; If the images are to be read from the application directory itself, 
; @APPDIR is dynamically adapted to reference this path.
; E.g. @APPDIR/clara.bmp

; ImgPrefix
; Name which is part of each image to be loaded e.g. img001, img002
; either as regex img.*.bmp or img*.bmp

; FrameRate
; Display images in frames per second. This value overrides the .emu's frame rate specified by the "Delay" value.

; BufferCount
; Amount of images to be preloaded. 0 will load all available images at once
; except when loading from .emu which defines loadAtOnce on its own.

; ------------------------------------------------------------------------------------
; Following parameters are only needed for mockType=0.
; ------------------------------------------------------------------------------------

; BufferWidth
; Width of the buffer/image in pixels.

; BufferHeight
; Height of the buffer/image inpixels.

; BufferFormats:
; 0 -> Mono8 ramp pattern
; 1 -> RGB24 red ramp others 0
; 2 -> RGB24 green ramp others 0
; 3 -> RGB24 blue ramp others 0
; 4 -> Mon10 4 x Mono8 ramp
; 5 -> RGB30 4 x red ramp others 0
; 6 -> RGB30 4 x green ramp others 0
; 7 -> RGB30 4 x blue ramp others 0
; 8 -> Mono12 16 x Mono8 ramp
; 9 -> RGB36 16 x red ramp others 0
; 10 -> RGB36 16 x green ramp others 0
; 11 -> RGB36 16 x blue ramp others 0

; BufferRoll
; Steps to advance between images for moving buffer
; 256 steps available for all formats

; required for valid ini format
ProfileName=Default

[Board0_Channel0]
; default values if nothing but the port node is defined
; these lines cannot have comments next to themselves
MockType=1
LoadPath=%CVB%/tutorial/Polimago/Images/Cookies/_LoadMe.emu
FrameRate=50
ImgPrefix=.*.bmp
imgBuff=5

```

---

<div class="post-metadata">

**Author:** ![Foster](https://avatars.discourse-cdn.com/v4/letter/f/aca169/32.png) [@Foster](https://forum.commonvisionblox.com/u/Foster)\
**Post date:** [December 22, 2021, 2:25pm UTC](https://forum.commonvisionblox.com/t/is-there-a-way-to-generate-a-customised-mock-driver-similar-to-cvmock-vin/1571/3 "2021-12-22T14:25:31Z")

</div>

Hi @illusive,  
Excellent - this is exactly what I needed…

Many thanks and Frohe Weihnachten!  
Lee
