📄 hpe1463a.c
字号:
Error: Ivi_UnlockSession (vi, VI_NULL); return error;}/***************************************************************************** * Function: hpe1463a_GetAttribute<type> Functions * Purpose: These functions enable the instrument driver user to get * attribute values directly. There are typesafe versions for * ViInt32, ViReal64, ViString, ViBoolean, and ViSession attributes. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_GetAttributeViInt32 (ViSession vi, ViConstString channelName, ViAttr attributeId, ViInt32 *value){ return Ivi_GetAttributeViInt32 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} ViStatus _VI_FUNC hpe1463a_GetAttributeViReal64 (ViSession vi, ViConstString channelName, ViAttr attributeId, ViReal64 *value){ return Ivi_GetAttributeViReal64 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} ViStatus _VI_FUNC hpe1463a_GetAttributeViString (ViSession vi, ViConstString channelName, ViAttr attributeId, ViInt32 bufSize, ViChar value[]) { return Ivi_GetAttributeViString (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, bufSize, value);} ViStatus _VI_FUNC hpe1463a_GetAttributeViBoolean (ViSession vi, ViConstString channelName, ViAttr attributeId, ViBoolean *value){ return Ivi_GetAttributeViBoolean (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} ViStatus _VI_FUNC hpe1463a_GetAttributeViSession (ViSession vi, ViConstString channelName, ViAttr attributeId, ViSession *value){ return Ivi_GetAttributeViSession (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} /***************************************************************************** * Function: hpe1463a_SetAttribute<type> Functions * Purpose: These functions enable the instrument driver user to set * attribute values directly. There are typesafe versions for * ViInt32, ViReal64, ViString, ViBoolean, and ViSession datatypes. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_SetAttributeViInt32 (ViSession vi, ViConstString channelName, ViAttr attributeId, ViInt32 value){ return Ivi_SetAttributeViInt32 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} ViStatus _VI_FUNC hpe1463a_SetAttributeViReal64 (ViSession vi, ViConstString channelName, ViAttr attributeId, ViReal64 value){ return Ivi_SetAttributeViReal64 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} ViStatus _VI_FUNC hpe1463a_SetAttributeViString (ViSession vi, ViConstString channelName, ViAttr attributeId, ViConstString value) { return Ivi_SetAttributeViString (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} ViStatus _VI_FUNC hpe1463a_SetAttributeViBoolean (ViSession vi, ViConstString channelName, ViAttr attributeId, ViBoolean value){ return Ivi_SetAttributeViBoolean (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} ViStatus _VI_FUNC hpe1463a_SetAttributeViSession (ViSession vi, ViConstString channelName, ViAttr attributeId, ViSession value){ return Ivi_SetAttributeViSession (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} /***************************************************************************** * Function: hpe1463a_CheckAttribute<type> Functions * Purpose: These functions enable the instrument driver user to check * attribute values directly. These functions check the value you * specify even if you set the HPE1463A_ATTR_RANGE_CHECK * attribute to VI_FALSE. There are typesafe versions for ViInt32, * ViReal64, ViString, ViBoolean, and ViSession datatypes. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_CheckAttributeViInt32 (ViSession vi, ViConstString channelName, ViAttr attributeId, ViInt32 value){ return Ivi_CheckAttributeViInt32 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);}ViStatus _VI_FUNC hpe1463a_CheckAttributeViReal64 (ViSession vi, ViConstString channelName, ViAttr attributeId, ViReal64 value){ return Ivi_CheckAttributeViReal64 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} ViStatus _VI_FUNC hpe1463a_CheckAttributeViString (ViSession vi, ViConstString channelName, ViAttr attributeId, ViConstString value) { return Ivi_CheckAttributeViString (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} ViStatus _VI_FUNC hpe1463a_CheckAttributeViBoolean (ViSession vi, ViConstString channelName, ViAttr attributeId, ViBoolean value){ return Ivi_CheckAttributeViBoolean (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} ViStatus _VI_FUNC hpe1463a_CheckAttributeViSession (ViSession vi, ViConstString channelName, ViAttr attributeId, ViSession value){ return Ivi_CheckAttributeViSession (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL, value);} /***************************************************************************** * Function: hpe1463a_LockSession and hpe1463a_UnlockSession Functions * Purpose: These functions enable the instrument driver user to lock the * session around a sequence of driver calls during which other * execution threads must not disturb the instrument state. * * NOTE: The callerHasLock parameter must be a local variable * initialized to VI_FALSE and passed by reference, or you can pass * VI_NULL. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_LockSession (ViSession vi, ViBoolean *callerHasLock) { return Ivi_LockSession(vi,callerHasLock); } ViStatus _VI_FUNC hpe1463a_UnlockSession (ViSession vi, ViBoolean *callerHasLock) { return Ivi_UnlockSession(vi,callerHasLock); } /***************************************************************************** * Function: hpe1463a_GetErrorInfo and hpe1463a_ClearErrorInfo Functions * Purpose: These functions enable the instrument driver user to * get or clear the error information the driver associates with the * IVI session. *****************************************************************************/ViStatus _VI_FUNC hpe1463a_GetErrorInfo (ViSession vi, ViStatus *primaryError, ViStatus *secondaryError, ViChar errorElaboration[256]) { return Ivi_GetErrorInfo(vi, primaryError, secondaryError, errorElaboration); } ViStatus _VI_FUNC hpe1463a_ClearErrorInfo (ViSession vi) { return Ivi_ClearErrorInfo (vi); }/***************************************************************************** *-------------------- Utility Functions (Not Exported) ---------------------* *****************************************************************************//***************************************************************************** * Function: hpe1463a_GetPossiblePath * Purpose: This function creates a string containing the shortest path * between the channels channel1 and channel2. The caller is * responsible for freeing the pathRef variable. * The caller should already verify that channels 1 and 2 are not * configuration channels and that they are not connected to * different source channels. *****************************************************************************/static ViStatus hpe1463a_GetPossiblePath (ViSession vi, ViConstString channel1, ViConstString channel2, ViInt32 maxDepth, ViString *pathRef){ ViStatus error = VI_SUCCESS; ViInt32 ndxChannel1, ndxChannel2, numChannels; ViInt32 **connections; ViInt32 steps = 0; ViBoolean isConnectedMuxChannel; ViString path = VI_NULL; checkErr( Ivi_GetAttributeViInt32 (vi, VI_NULL, HPE1463A_ATTR_NUM_CHANNELS, 0, &numChannels)); checkErr( Ivi_GetChannelIndex (vi, channel1, &ndxChannel1)); checkErr( Ivi_GetChannelIndex (vi, channel2, &ndxChannel2)); if (ndxChannel1 == ndxChannel2) viCheckErrElab( HPE1463A_ERROR_CANNOT_CONNECT_TO_ITSELF, channel1); checkErr( Ivi_GetAttributeViAddr (vi, VI_NULL, HPE1463A_ATTR_CHANNEL_MATRIX, 0, (ViAddr*)&connections)); if (Ivi_RangeChecking (vi)) { if (hpe1463a_ChannelsAreExplicitlyConnected( ndxChannel1, ndxChannel2)) viCheckErr( HPE1463A_ERROR_EXPLICIT_CONNECTION_EXISTS); /* Mux channels can be external channels or configuration channels, and can be connected to only one channel. The same is true for any type of configuration channel, but some non-mux external channels can be connected to multiple channels. If the external channels 1 and 2 are mux channels, they must not be connected. NOTE: hpe1463a_GetPossiblePathRecursively makes sure that no configuration channels along the path are already connected. */ checkErr( hpe1463a_IsConnectedMuxChannel (vi, channel1, &isConnectedMuxChannel)); if (isConnectedMuxChannel) viCheckErrElab( HPE1463A_ERROR_RSRC_IN_USE, channel1); checkErr( hpe1463a_IsConnectedMuxChannel (vi, channel2, &isConnectedMuxChannel)); if (isConnectedMuxChannel) viCheckErrElab( HPE1463A_ERROR_RSRC_IN_USE, channel2); } checkErr( hpe1463a_GetPossiblePathRecursively (vi, ndxChannel1, ndxChannel2, connections, numChannels, &path, 0, maxDepth, &steps)); if (path == VI_NULL) viCheckErr( HPE1463A_ERROR_PATH_NOT_FOUND); Error: *pathRef = path; return error;}/***************************************************************************** * Function: hpe1463a_GetPossiblePathRecursively * Purpose: This function creates the string containing the shortest path * between the channels with indices ndxChannel1 and ndxChannel2. * The caller should already verify that neither channel 1 nor 2 * is a configuration channel or a connected mux common channel. * Each invocation of this function makes one connection step * and calls itself recursively to make additional steps if * necessary. * If the caller has already found a path and is trying to find a * better one, then the maxDept
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -