Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The functions you need to implement and export from your Transport DLL are described below.
The exported functions should use the C calling convention. If you are using C or C++ this would normally be the default, so no special syntax is needed. If it is not, the keyword to force a function to the C calling convention is normally __cdecl in most C/C++ compilers. The function prototypes in this document assume C calling convention is the default.
To make your functions export from the DLL in C or C++ you would normally precede the function declaration with __declspec(dllexport).
The symbols and data structures used by the Transport DLL interface are defined in the midlib2.h and midlib2_trans.h header files.
Several of these functions are required to be implemented and exported from your DLL. If they are not exported then the Aptina libraries will not load the DLL. The remaining functions are optional. If an optional function is not present then either a default handler will be provided to the application, of the feature will not be available. Whether a function is required or optional will be noted for each one below.

Note; WinPcap is required - it can be downloaded from here.

Anchor
_Ref7852008
_Ref7852008
Anchor
_Toc364859123
_Toc364859123
DLL Export SetHelpersDLL()

...

MI_CAMERA_SUCCESS

Initialization successful.

MI_SENSOR_FILE_PARSE_ERROR

A syntax error was found in the sensor data file.

MI_SENSOR_DOES_NOT_MATCH

No sensor data file was found that matches the current sensor.

MI_CAMERA_ERROR

Various other error conditions.

...


Anchor
_Toc364859125
_Toc364859125
Helper Function updateFrameSize()

Definition:
void updateFrameSize(mi_camera_t* pCamera , mi_u32 nWidth, mi_u32 nHeight, mi_s32 nBitsPerClock, mi_s32 nClocksPerPixel);
Summary:
Boilerplate code for UpdateFrameSizeDLL(). Sets pCamera->sensor->width, >height, ->pixelBits, and ->pixelBytes according to the parameters. Also sets BITS_PER_CLOCK and CLOCKS_PER_PIXEL in the camera context structure (see setContext() below). Sets pCamera>sensor->bufferSize to width * height * pixelBytes; you may need to fix up the bufferSize after calling this function. Call from UpdateFrameSizeDLL(). See sample code.
Parameters (same as UpdateFrameSizeDLL()):

pCamera

Pointer to a camera structure.

nWidth

New image width, or 0 to keep the current width.

nHeight

New image height, or 0 to keep the current height.

nBitsPerClock

New bits/pixel clock, or 0 to keep the current value.

nClocksPerPixel

New clocks/pixel, or 0 to keep the same value.


Returns:

void

 

...



Anchor
_Toc364859126
_Toc364859126
Helper Function updateImageType()

...

pCamera

Pointer to a camera structure.


Returns:

void

 

...



Anchor
_Toc364859127
_Toc364859127
Helper Function errorLog()

...

errorcode

Always returns the first parameter.

...


Anchor
_Toc364859128
_Toc364859128
Helper Function log()

...

logType

A log message type defined in midlib2.h. The different log types can be turned on/off by the user on the DevWare Options dialog.
MI_LOG_SHIP – A SHiP (I2C) operation.
MI_LOG_USB – A USB command.
MI_LOG_DEBUG – Debug info.
MI_LOG – Any other kind of message.

logMsg

The text of the message.

szSource

Source code file name where this log() call is located. Normally _FILE_.

szFunc

Name of function where this log() call is located. Normally _FUNCTION_.

nLine

Source code line number of this log() call. Normally _LINE_.


Returns:

void 

 



Anchor
_Toc364859129
_Toc364859129
Helper Function setMode()

...

MI_CAMERA_SUCCESS

Function was successful.

MI_CAMERA_ERROR

An error occurred.

 


Anchor
_Toc364859130
_Toc364859130
Helper Function getMode()

...

MI_CAMERA_SUCCESS

Function was successful.

MI_CAMERA_ERROR

An error occurred.

 


Anchor
_Toc364859131
_Toc364859131
Helper Function setContext()

...

MI_CAMERA_SUCCESS

Function was successful.

MI_CAMERA_ERROR

An error occurred.

...


Field MI_CONTEXT_PRIVATE_DATA

...

pCamera

Pointer to the camera structure.

pInBuffer

Pointer to the raw data


Returns:

void

 

 



Anchor
_Toc364859134
_Toc364859134
Helper Function readReg()

...

Register or bitfield value

 

...



Anchor
_Toc364859135
_Toc364859135
Helper Function getBoardConfig()

...

MI_CAMERA_SUCCESS

Initialization successful (even if no matching cdat files were found).

MI_PARSE_FILE_ERROR

Error opening the config file.

...


Anchor
_Toc364859136
_Toc364859136
DLL Export OpenCameraDLL()

...


Returns:

device name string 



Optional:
This function is optional. However, if it's not implemented and the user opens two applications at the same time, the processes won't be synchronized, possibly causing unexpected results.

...

MI_CAMERA_SUCCESS

Message was received and accepted.

MI_CAMERA_ERROR

pCamera pointer does not match the application's pCamera.notifyCode value is not a recognized notification code.lParam value is illegal.Application is not ready.Illegal calling thread.

...


Anchor
_Toc364859166
_Toc364859166
MI_NOTIFY_PAUSE

...