ScriptReadAppSignal 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 is used to read an application signal from a script running on a neoVI device.

C/C++ Declare

int _stdcall icsneoScriptReadAppSignal(int hObject unsigned int iIndex, double *dValue);

Visual Basic Declare

Public Declare Function icsneoScriptReadAppSignal Lib "icsneo40.dll" (ByVal hObject As Long, ByVal iIndex As Long, ByRef dValue As Double) As Long


Visual Basic .NET Declare

Public Declare Function icsneoScriptReadAppSignal Lib "icsneo40.dll" (ByVal hObject As Int32, ByVal iIndex As UInt32, ByRef dValue As Double) As Int32

C# Declare

[DllImport("icsneo40.dll")]
public static extern Int32 icsneoScriptReadAppSignal(Int32 hObject, UInt32 iIndex, ref double dValue);

Parameters

hObject
   
[in] Specifies the driver object created by OpenNeoDevice.

unsigned int iIndex
   
[in] The index value of the transmit message to read

double *dValue
   
[in] Contains the current value of the application signal.

Return Values

1 if the function succeeded. 0 if it failed for any reason. 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
NEOVI_ERROR_DLL_SCRIPT_INVALID_APPSIG_INDEX = 225
NEOVI_ERROR_DLL_SCRIPT_NO_SCRIPT_RUNNING = 226

Remarks

The script containing the specified application signal must have been successfully downloaded to the neoVI using ScriptLoadScript. The script must also have been started using ScriptStart. This function will fail if ScriptStop has been called. The valid index values for application signals within a script can be found in the cmvspy.vs3cmb.h file that is produced by Vehicle Spy. Please see Vehicle Spy documentation.


Examples

Visual Basic Example

Dim iResult As Long
Dim
ValueToSet As Double

'//Read App signal
iResult = icsneoScriptReadAppSignal(m_hObject, CLng(cboAppSig.ListIndex), ValueToSet)

If iResult = 0 Then
    txtAppSigVal.Text = "Problem!"
Else
    txtAppSigVal.Text = CStr(ValueToSet)
End
If


C/C++ Example:

int iRetVal;
unsigned long lLastErrNum;
double dValue = 0;

iRetVal = icsneoScriptReadAppSignal(hObject, App_Signal_1, &dValue);
if(iRetVal == 0)
{
    printf(
"\nFailed to read the application signal.);
}
else
{
    printf("\nApplication signal = %f\r\n", dValue);
}


C# Example:

Int32 iResult;
Double ValueToSet=0;

//Read App signal
iResult = icsNeoDll.icsneoScriptReadAppSignal(m_hObject, Convert.ToUInt32(cboAppSig.SelectedIndex),ref ValueToSet);

if (iResult == 0)
{
    txtAppSigVal.Text = "Problem!";
}
else
{
    txtAppSigVal.Text = Convert.ToString(ValueToSet);
}
 

Visual Basic .NET Example:

Dim iResult As Int32
Dim ValueToSet As Double

'//Read App signal
iResult = icsneoScriptReadAppSignal(m_hObject, Convert.ToUInt32(cboAppSig.SelectedIndex), ValueToSet)

If iResult = 0 Then
    txtAppSigVal.Text = "Problem!"
Else
    txtAppSigVal.Text = Convert.ToString(ValueToSet)
End If

intrepidcs API Documentation - (C) Copyright 2000-2010 Intrepid Control Systems, Inc.  (www.intrepidcs.com)

Last Updated : Tuesday, December 30, 2008