This method returns the run status of a specified function block within a script on a neoVI device.
int _stdcall icsneoScriptGetFBlockStatus(void* hObject,unsignedint iFunctionBlockIndex,int*piStatus);
Public Declare Function icsneoScriptGetFBlockStatus Lib “icsneo40.dll” (ByVal hObject As IntPtr, ByVal fb_index As UInt32, ByRef piRunStatus As Int32) As Int32
[in] Specifies the driver object created by OpenNeoDevice.
iFunctionBlockIndex
[in] The index value of the function block to start
piStatus
[out] 0 = stopped 1 = running
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:
The script containing the specified function block must have been successfully downloaded to the neoVI using ScriptLoadScript. Execution of the script must have been started by using ScriptStartScript. The valid index values for function blocks within a script can be found in the cmvspy.vs3cmb.h file (Produced by Vehicle Spy. Please see Vehicle Spy documentation).
Examples
int iRetVal;int iRunStatus;unsignedlong lLastErrNum;iRetVal =icsneoScriptGetFBlockStatus(hObject, Function_Block_1,&iRunStatus);if(iRetVal ==0){printf("\nFailed to check function block status);}else{ printf("\nFunction block status =%s\r\n", iRunStatus == 0 ? "Stopped" : "Running");}
Int32 iResult;Int32 iStatus=0;//Get Status of Function Block in CoreMiniiResult =icsNeoDll.icsneoScriptGetFBlockStatus(m_hObject,Convert.ToUInt32(cboFBToChange.SelectedIndex),ref iStatus);if(iResult ==0){lblFBStatus.Text="Failed to get CoreMini Status";}else{switch(iStatus) {case (int)ScriptStates.SCRIPT_STATUS_RUNNING:lblFBStatus.Text="CoreMini Function Block Running";break;case (int)ScriptStates.SCRIPT_STATUS_STOPPED:lblFBStatus.Text="CoreMini Function Block Stopped";break;default:lblFBStatus.Text="Unhandled State";break; }}
Dim iResult As Int32
Dim iStatus As Int32
'//Get Status of Function Block in CoreMini
iResult = icsneoScriptGetFBlockStatus(m_hObject, Convert.ToUInt32(cboFBToChange.SelectedIndex), iStatus)
If iResult = 0 Then
lblFBStatus.Text = "Failed to get CoreMini Status"
Else
Select Case iStatus
Case SCRIPT_STATUS_RUNNING
lblFBStatus.Text = "CoreMini Function Block Running"
Case SCRIPT_STATUS_STOPPED
lblFBStatus.Text = "CoreMini Function Block Stopped"
Case Else
lblFBStatus.Text = "Unhandled State"
End Select
End If