📄 hpe1463a.c
字号:
} checkErr( hpe1463a_DefaultInstrSetup (vi)); Error: Ivi_UnlockSession (vi, VI_NULL); return error;}/***************************************************************************** * Function: hpe1463a_self_test * Purpose: This function executes the instrument self-test and returns the * result. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_self_test (ViSession vi, ViInt16 *testResult, ViChar testMessage[]){ ViStatus error = VI_SUCCESS; checkErr( Ivi_LockSession (vi, VI_NULL)); if (testResult == VI_NULL) viCheckParm( IVI_ERROR_INVALID_PARAMETER, 2, "Null address for Test Result"); if (testMessage == VI_NULL) viCheckParm( IVI_ERROR_INVALID_PARAMETER, 3, "Null address for Test Message"); viCheckWarn( VI_WARN_NSUP_SELF_TEST);Error: Ivi_UnlockSession(vi, VI_NULL); return error;}/***************************************************************************** * Function: hpe1463a_error_query * Purpose: This function queries the instrument error queue and returns * the result. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_error_query (ViSession vi, ViInt32 *errCode, ViChar errMessage[]){ ViStatus error = VI_SUCCESS; checkErr( Ivi_LockSession (vi, VI_NULL)); if (errCode == VI_NULL) viCheckParm( IVI_ERROR_INVALID_PARAMETER, 2, "Null address for Error Code"); if (errMessage == VI_NULL) viCheckParm( IVI_ERROR_INVALID_PARAMETER, 3, "Null address for Error Message"); viCheckWarn( VI_WARN_NSUP_ERROR_QUERY);Error: Ivi_UnlockSession(vi, VI_NULL); return error;}/***************************************************************************** * Function: hpe1463a_error_message * Purpose: This function translates the error codes returned by this * instrument driver into user-readable strings. * * Note: The caller can pass VI_NULL for the vi parameter. This * is useful if one of the init functions fail. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_error_message (ViSession vi, ViStatus errorCode, ViChar errorMessage[256]){ ViStatus error = VI_SUCCESS; static IviStringValueTable errorTable = { IVISWTCH_ERROR_CODES_AND_MSGS, {VI_NULL, VI_NULL} }; if (vi) Ivi_LockSession(vi, VI_NULL); /* all VISA and IVI error codes are handled as well as codes in the table */ if (errorMessage == VI_NULL) viCheckParm( IVI_ERROR_INVALID_PARAMETER, 3, "Null address for Error Message"); checkErr( Ivi_GetSpecificDriverStatusDesc(vi, errorCode, errorMessage, errorTable));Error: if (vi) Ivi_UnlockSession(vi, VI_NULL); return error;}/***************************************************************************** * Function: hpe1463a_revision_query * Purpose: This function returns the driver and instrument revisions. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_revision_query (ViSession vi, ViChar driverRev[], ViChar instrRev[]){ ViChar rdBuffer[BUFFER_SIZE]; ViStatus error = VI_SUCCESS; checkErr( Ivi_LockSession (vi, VI_NULL)); if (driverRev == VI_NULL) viCheckParm( IVI_ERROR_INVALID_PARAMETER, 2, "Null address for Driver Revision"); if (instrRev == VI_NULL) viCheckParm( IVI_ERROR_INVALID_PARAMETER, 3, "Null address for Instrument Revision"); checkErr( Ivi_GetAttributeViString (vi, VI_NULL, IVI_ATTR_DRIVER_REVISION, 0, -1, driverRev)); viCheckWarn( VI_WARN_NSUP_REV_QUERY);Error: Ivi_UnlockSession(vi, VI_NULL); return error;}/***************************************************************************** * Function: hpe1463a_Connect * Purpose: This function connects channels 1 and 2. The driver * calculates the shortest path between the two channels. * If a path is not available, the function returns one of the * following errors: * - HPE1463A_ERROR_EXPLICIT_CONNECTION_EXISTS, if the two channels * are already explicitly connected. * - HPE1463A_ERROR_IS_CONFIGURATION_CHANNEL, if a channel is a * configuration channel. The error elaboration tells you which * channel is a configuration channel. * - HPE1463A_ERROR_ATTEMPT_TO_CONNECT_SOURCES, if both channels are * connected to a different source. The error elaboration tells * you to which source channel channels 1 and 2 are connected. * - HPE1463A_ERROR_RSRC_IN_USE, if a channel is a connected common * multiplexer channel. * - HPE1463A_ERROR_CANNOT_CONNECT_TO_ITSELF, if the two channels * are identical. * - HPE1463A_ERROR_PATH_NOT_FOUND, if the driver cannot find a * path between the two channels. * The user can call the hpe1463a_GetPath function to obtain the path * the driver calculates. The user can call the hpe1463a_SetPath * function to use an explicit path to make a connection. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_Connect (ViSession vi, ViConstString channel1, ViConstString channel2){ ViStatus error = VI_SUCCESS; ViString path = VI_NULL; ViInt32 maxDepth; checkErr( Ivi_LockSession (vi, VI_NULL)); if (Ivi_RangeChecking (vi)) { checkErr( hpe1463a_VerifyIsEitherAConfigChannel (vi, channel1, channel2)); checkErr( hpe1463a_VerifySourceChannelConflict (vi, channel1, channel2)); } checkErr( Ivi_GetAttributeViInt32 (vi, VI_NULL, HPE1463A_ATTR_MAXIMUM_DEPTH, 0, &maxDepth)); checkErr( hpe1463a_GetPossiblePath (vi, channel1, channel2, maxDepth, &path)); checkErr( hpe1463a_ConnectPathOnInstrument (vi, VI_NULL, path)); checkErr( hpe1463a_MarkPathAsConnected (vi, path));Error: if (path != VI_NULL) Ivi_Free (vi, path); Ivi_UnlockSession (vi, VI_NULL); return error;}/***************************************************************************** * Function: hpe1463a_Disconnect * Purpose: This function disconnects the two channels. If no path * exists between the two channels, the function returns the * HPE1463A_ERROR_NO_SUCH_PATH error. You can verify the * validity and the current status of a path by calling the * hpe1463a_CanConnect function. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_Disconnect (ViSession vi, ViConstString channel1, ViConstString channel2){ ViStatus error = VI_SUCCESS; ViString path = VI_NULL; checkErr( Ivi_LockSession (vi, VI_NULL)); checkErr( hpe1463a_GetExistingPath (vi, channel1, channel2, &path)); checkErr( hpe1463a_MarkPathAsDisconnected (vi, path)); viCheckWarn( HPE1463A_WARN_PATH_REMAINS);Error: if (path != VI_NULL) Ivi_Free (vi, path); Ivi_UnlockSession (vi, VI_NULL); return error;}/***************************************************************************** * Function: hpe1463a_DisconnectAll * Purpose: This function disconnects all currently existing paths. This * does not reset the switch card. If the card is not capable of * removing all paths and always leaves at least one connected, * the function returns the HPE1463A_WARN_PATH_REMAINS warning. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_DisconnectAll (ViSession vi){ ViStatus error = VI_SUCCESS; checkErr( Ivi_LockSession (vi, VI_NULL)); checkErr( Ivi_SetAttributeViInt32 (vi, VI_NULL, HPE1463A_ATTR_SWITCH_STATE_L, 0, HPE1463A_VAL_ALL_NC)); checkErr( Ivi_SetAttributeViInt32 (vi, VI_NULL, HPE1463A_ATTR_SWITCH_STATE_H, 0, HPE1463A_VAL_ALL_NC)); checkErr( hpe1463a_MarkAllAsDisconnected (vi)); viCheckWarn( HPE1463A_WARN_PATH_REMAINS);Error: Ivi_UnlockSession (vi, VI_NULL); return error;}/***************************************************************************** * Function: hpe1463a_GetPath * Purpose: The user can create a path between two channels with the * hpe1463a_Connect function, which calculates the shortest * path between the two channels. The user can call this function * to obtain the actual path. If no path currently exists between * the two channels, this function returns the * HPE1463A_ERROR_NO_SUCH_PATH error. * It is possible for the user to inadvertently connect two channels * without making an explicit path between them. In this case,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -