PDA

View Full Version : Manual call on IC Control API



czetsuya
June 10, 2014, 04:01:31
Hi,

We're currently developing a stand alone .net application in C# that use the DFK AFU130-L53 device. Is it possible to call the api manually? For example after embedding the IC Control, can I create another button that will trigger the camera focus feature?

Thanks,
Edward

Stefan Geissler
June 10, 2014, 15:18:06
Edward

yes, this is possible. Some nice C# functions, that will do this.


// ************************************************** **************
// C# functions for Focus One_Push Button interface
// Usage
// if( IsFocusOne_PushAvailable(icImagingControl1) == true )
// {
// PushFocusOne_Push(icImagingControl1);
// }

bool IsFocusOne_PushAvailable(TIS.Imaging.ICImagingCont rol ic)
{
bool bResult = false;
if( ic.DeviceValid == true )
{
TIS.Imaging.VCDButtonProperty Property;
Property = (TIS.Imaging.VCDButtonProperty)ic.VCDPropertyItems .FindInterface(TIS.Imaging.VCDIDs.VCDID_Focus, TIS.Imaging.VCDIDs.VCDElement_OnePush, TIS.Imaging.VCDIDs.VCDInterface_Button);
if (Property != null)
{
bResult = true;
}
}
return bResult;
}



void PushFocusOne_Push(TIS.Imaging.ICImagingControl ic)
{
if( ic.DeviceValid == true )
{
TIS.Imaging.VCDButtonProperty Property;
Property = (TIS.Imaging.VCDButtonProperty)ic.VCDPropertyItems .FindInterface(TIS.Imaging.VCDIDs.VCDID_Focus, TIS.Imaging.VCDIDs.VCDElement_OnePush, TIS.Imaging.VCDIDs.VCDInterface_Button);
if (Property != null)
{
Property.Push();
}
}
}


// ************************************************** **************
// C# functions for Zoom Value Range interface
// Usage :
// int Value, Minimum,Maximum;
// if( IsZoomValueAvailable(icImagingControl1) )
// {
// Value = GetZoomValueValue(icImagingControl1);
// Minimum = GetZoomValueMin(icImagingControl1);
// Maximum = GetZoomValueMax(icImagingControl1);
// SetZoomValueValue(icImagingControl1, 10);
// }

bool IsZoomValueAvailable(TIS.Imaging.ICImagingControl ic)
{
bool bResult = false;
if( ic.DeviceValid == true )
{
TIS.Imaging.VCDRangeProperty Property;
Property = (TIS.Imaging.VCDRangeProperty)ic.VCDPropertyItems. FindInterface(TIS.Imaging.VCDIDs.VCDID_Zoom, TIS.Imaging.VCDIDs.VCDElement_Value, TIS.Imaging.VCDIDs.VCDInterface_Range);
if (Property != null)
{
bResult = true;
}
}
return bResult;
}


int GetZoomValueValue(TIS.Imaging.ICImagingControl ic)
{
if( ic.DeviceValid == true )
{
TIS.Imaging.VCDRangeProperty Property;
Property = (TIS.Imaging.VCDRangeProperty)ic.VCDPropertyItems. FindInterface(TIS.Imaging.VCDIDs.VCDID_Zoom, TIS.Imaging.VCDIDs.VCDElement_Value, TIS.Imaging.VCDIDs.VCDInterface_Range);
if (Property != null)
{
return Property.Value;
}
}

return 0;
}

void SetZoomValueValue(TIS.Imaging.ICImagingControl ic, int Value)
{
if( ic.DeviceValid == true )
{
TIS.Imaging.VCDRangeProperty Property;
Property = (TIS.Imaging.VCDRangeProperty)ic.VCDPropertyItems. FindInterface(TIS.Imaging.VCDIDs.VCDID_Zoom, TIS.Imaging.VCDIDs.VCDElement_Value, TIS.Imaging.VCDIDs.VCDInterface_Range);
if (Property != null)
{
Property.Value = Value;
}
}
}

int GetZoomValueMin(TIS.Imaging.ICImagingControl ic)
{
if( ic.DeviceValid == true )
{
TIS.Imaging.VCDRangeProperty Property;
Property = (TIS.Imaging.VCDRangeProperty)ic.VCDPropertyItems. FindInterface(TIS.Imaging.VCDIDs.VCDID_Zoom, TIS.Imaging.VCDIDs.VCDElement_Value, TIS.Imaging.VCDIDs.VCDInterface_Range);
if (Property != null)
{
return Property.RangeMin;
}
}

return 0;
}

int GetZoomValueMax(TIS.Imaging.ICImagingControl ic)
{
if( ic.DeviceValid == true )
{
TIS.Imaging.VCDRangeProperty Property;
Property = (TIS.Imaging.VCDRangeProperty)ic.VCDPropertyItems. FindInterface(TIS.Imaging.VCDIDs.VCDID_Zoom, TIS.Imaging.VCDIDs.VCDElement_Value, TIS.Imaging.VCDIDs.VCDInterface_Range);
if (Property != null)
{
return Property.RangeMax;
}
}
return 0;
}