GetConfiguration Method - intrepidcs API
C/C++ declare -
VB declare - VB.NET declare -
C# declare - Parameters - Return
Values - Remarks - C/C++ example
- VB example - VB.NET example
- C#
example
This method reads the configuration from the
hardware device.
Note: This function is only to be used for neoVI Blue and ValueCAN. For neoVI
Fire and neoVI Red use the GetFireSettings
method. For ValueCAN3 use the GetVCAN3Settings
method.
int _stdcall icsneoGetConfiguration(int hObject, unsigned char *pData, int *plNumBytes);
Visual Basic Declare
Public
Declare
Function
icsneoGetConfiguration Lib
"icsneo40.dll" (ByVal
hObject As
Long,
ByRef pData
As
Byte,
ByRef lNumBytes
As
Long)
As
Long
Visual Basic .NET Declare
Public
Declare
Function
icsneoGetConfiguration Lib
"icsneo40.dll" (ByVal
hObject As Int32,
ByRef pData
As
Byte,
ByRef lNumBytes
As Int32)
As
Int32
C# Declare
[DllImport("icsneo40.dll")]
public
static
extern Int32 icsneoGetConfiguration(Int32 hObject,
ref byte
pData, ref Int32 lNumBytes);
Parameters
hObject
[in] Specifies the driver object created with the OpenNeoDevice
method.
pData
[out] Pointer to an array of 1024 bytes. Each index of the
array corresponds to a configuration value. For a list of configuration values
to change, please see the Configuration Array
topic.
plNumBytes
[out] This will return the number of bytes written to the
array. For the current version of the API this will be 1024 bytes.
Returns 1 if successful, 0 if an error
occurred. GetLastAPIError
must be called to obtain the specific error. The errors that can be generated by
this function are:
NEOVI_ERROR_DLL_NEOVI_NO_RESPONSE = 75
None.
Examples
Dim lNumBytes
As Long
Dim bConfigBytes(0 To 1024) As Byte
Dim lResult As Long
'// we must set 1024 bytes
lNumBytes = 1024
'// get the configuration
lResult = icsneoGetConfiguration(m_hObject, bConfigBytes(0), lNumBytes)
'// make sure the read was successful
If Not CBool(lResult) Then
MsgBox "Problem reading configuration"
Exit Sub
End If
'// load the cnf values into text boxes
txtCNF1 = Hex(bConfigBytes(NEO_CFG_MPIC_HS_CAN_CNF1))
txtCNF2 = Hex(bConfigBytes(NEO_CFG_MPIC_HS_CAN_CNF2))
txtCNF3 = Hex(bConfigBytes(NEO_CFG_MPIC_HS_CAN_CNF3))
Displays the Value of CNF1 of ValueCAN/neoVI HSCAN
unsigned char bConfigBytes[1024];
int iNumConfigBytes = 1024;
lResult =
icsneoGetConfiguration(hObject, bConfigBytes, &iNumConfigBytes);
if (lResult == 0)
MessageBox(hWnd,TEXT("Problem Reading
Configuration"),TEXT("neoVI Example"),0);
else
{
wsprintf(szOut,TEXT("HSCAN CNF1 =
%x"),bConfigBytes[NEO_CFG_MPIC_HS_CAN_CNF1]);
MessageBox(hWnd,szOut,TEXT("neoVI Example"),0);
}
Visual Basic .NET Example
byte[]
bConfigBytes = new byte[1024];
//Storage for Data Bytes from Device
int iNumBytes =
1204; //Storage for Number of Bytes
int lResult; //Storage
for Result of Called Function
int Counter;
//Clear listbox
lstConfigInformation.Items.Clear();
//Call Get Configuration
lResult = icsNeoDll.icsneoGetConfiguration(m_hObject, ref
bConfigBytes[0],ref
iNumBytes);
//Fill ListBox with Data From function
Call
for(Counter=0;Counter<1024;Counter++)
{
lstConfigInformation.Items.Add("Byte Number-" +
Counter + " Byte Data-" + bConfigBytes[Counter]);
}
intrepidcs API Documentation - (C) Copyright 2000-2012 Intrepid Control Systems, Inc. (www.intrepidcs.com) |
Last Updated : Wednesday, December 17, 2008