C# 클래스 NGIOdotNET.NGIO

The NGIO class provides an application program with full access to the data acquisition capabilities built into the LabQuest and the LabQuest Mini. This class is a very thin managed code wrapper around the unmanaged NGIO library. The NGIO class API is fairly broad, so knowing where to start is hard. The documentation for the NGIO_Device_Open() and the NGIO_Device_SendCmdAndGetResponse() functions are a good starting place.

Refer to the NGIO_ParmBlk class for the command and response data structures passed into NGIO_Device_SendCmdAndGetResponse().

The NGIOdotNet XML docs are a work in progress. More complete documentation can be found in the NGIO_lib_interface.h file.

파일 보기 프로젝트 열기: concord-consortium/sensor-projects

공개 메소드들

메소드 설명
Device_SendCmdAndGetResponse1 ( IntPtr hDevice, byte cmd, object parameters, object &response, UInt32 &nRespBytes, UInt32 timeoutMs ) : Int32

Send a command to the specified device hardware and wait for a response.

Each device type has a command protocol that is unique to that device type. The command protocol used by NGIO_DEVTYPE_LABQUEST_AUDIO devices is a subset of the protocol used by NGIO_DEVTYPE_LABQUEST devices. This protocol is documented in the NGIOSourceCmds class. Additional documentation can be found in NGIOSourceCmds.h.

Note that NGIO_Device_SendCmdAndGetResponse() will fail if you send a NGIO_CMD_ID_START_MEASUREMENTS command while NGIO_Device_GetNumMeasurementsAvailable() says measurements are available.

So...if you are restarting measurements, you should clear any old measurements in the NGIO Measurement Buffer first by reading in the measurements until the Buffer is empty, or you should call NGIO_Device_ClearIO().

Every command supported by NGIO_Device_SendCmdAndGetResponse() has an associated response. If no response specific to a command is defined, then the format of the response is NGIODefaultCmdResponse. Some commands have associated parameter blocks defined for them.

If NGIO_Device_SendCmdAndGetResponse() returns -1, additional information about a NGIO_Device_SendCmdAndGetResponse() error may be obtained by calling NGIO_Device_GetLastCmdResponseStatus().

Device_SendCmdAndGetResponse2 ( IntPtr hDevice, byte cmd, object parameters, UInt32 timeoutMs ) : Int32

Device_SendCmdAndGetResponse2() is the same as Device_SendCmdAndGetResponse1() except that no response block is returned by the function(even though some sort of response always comes back from the device unless there is a communication failure). This is reasonable if the caller only cares about when the function succeeds or fails, which can be determined from the return value.

Device_SendCmdAndGetResponse3 ( IntPtr hDevice, byte cmd, object &response, UInt32 &nRespBytes, UInt32 timeoutMs ) : Int32

Device_SendCmdAndGetResponse3() is the same as Device_SendCmdAndGetResponse1() except that no parameter block is sent to the device. That works fine for commands that do not require parameters.

Device_SendCmdAndGetResponse4 ( IntPtr hDevice, byte cmd, UInt32 timeoutMs ) : Int32

Device_SendCmdAndGetResponse4() is the same as Device_SendCmdAndGetResponse1() except that no parameter block is sent to the device and no response block is returned by the function. That works fine for commands that do not require parameters when the caller is only interested in success or failure.

비공개 메소드들

메소드 설명
CloseDeviceListSnapshot ( IntPtr hList ) : Int32
DeviceListSnapshot_GetNthEntry ( IntPtr hList, UInt32 N, StringBuilder devnameBuf, UInt32 bufSize, UInt32 &deviceStatusMask ) : Int32
Device_AcquireExclusiveOwnership ( IntPtr hDevice, UInt32 timeoutMs ) : Int32
Device_CalibrateData ( IntPtr hDevice, sbyte channel, System.Single volts ) : System.Single
Device_CalibrateData2 ( IntPtr hDevice, sbyte channel, Int32 rawMeasurement ) : System.Single
Device_ClearIO ( IntPtr hDevice, sbyte channel ) : Int32
Device_Close ( IntPtr hDevice ) : Int32
Device_ConvertToVoltage ( IntPtr hDevice, sbyte channel, Int32 rawMeasurement, Int32 probeType ) : System.Single
Device_DDSMem_CalculateChecksum ( IntPtr hDevice, sbyte channel, byte &checksum ) : Int32
Device_DDSMem_ClearRecord ( IntPtr hDevice, sbyte channel ) : Int32
Device_DDSMem_GetActiveCalPage ( IntPtr hDevice, sbyte channel, byte &ActiveCalPage ) : Int32
Device_DDSMem_GetAveraging ( IntPtr hDevice, sbyte channel, byte &Averaging ) : Int32
Device_DDSMem_GetCalPage ( IntPtr hDevice, sbyte channel, byte CalPageIndex, float &CalibrationCoefficientA, float &CalibrationCoefficientB, float &CalibrationCoefficientC, StringBuilder units, UInt16 maxNumBytesToCopy ) : Int32
Device_DDSMem_GetCalibrationEquation ( IntPtr hDevice, sbyte channel, sbyte &CalibrationEquation ) : Int32
Device_DDSMem_GetChecksum ( IntPtr hDevice, sbyte channel, byte Checksum ) : Int32
Device_DDSMem_GetCurrentRequirement ( IntPtr hDevice, sbyte channel, byte &CurrentRequirement ) : Int32
Device_DDSMem_GetExperimentType ( IntPtr hDevice, sbyte channel, byte &ExperimentType ) : Int32
Device_DDSMem_GetHighestValidCalPageIndex ( IntPtr hDevice, sbyte channel, byte &HighestValidCalPageIndex ) : Int32
Device_DDSMem_GetLongName ( IntPtr hDevice, sbyte channel, StringBuilder longName, UInt16 maxNumBytesToCopy ) : IntPtr
Device_DDSMem_GetManufacturerID ( IntPtr hDevice, sbyte channel, byte &ManufacturerID ) : Int32
Device_DDSMem_GetMemMapVersion ( IntPtr hDevice, sbyte channel, byte &MemMapVersion ) : Int32
Device_DDSMem_GetMinSamplePeriod ( IntPtr hDevice, sbyte channel, System.Single &MinSamplePeriod ) : Int32
Device_DDSMem_GetOperationType ( IntPtr hDevice, sbyte channel, byte &OperationType ) : Int32
Device_DDSMem_GetRecord ( IntPtr hDevice, sbyte channel, VSTCoreDefsdotNET.VSTSensorDDSMemRec &rec ) : Int32
Device_DDSMem_GetSensorNumber ( IntPtr hDevice, sbyte channel, byte &SensorNumber, byte sendQueryToHardwareflag, UInt32 &channelSignature, UInt32 timeoutMs ) : Int32
Device_DDSMem_GetSerialNumber ( IntPtr hDevice, sbyte channel, byte &leastSigByte_SerialNumber, byte &midSigByte_SerialNumber, byte &mostSigByte_SerialNumber ) : Int32
Device_DDSMem_GetShortName ( IntPtr hDevice, sbyte channel, StringBuilder shortName, UInt16 maxNumBytesToCopy ) : IntPtr
Device_DDSMem_GetSignificantFigures ( IntPtr hDevice, sbyte channel, byte &SignificantFigures ) : Int32
Device_DDSMem_GetTypNumberofSamples ( IntPtr hDevice, sbyte channel, UInt16 &TypNumberofSamples ) : Int32
Device_DDSMem_GetTypSamplePeriod ( IntPtr hDevice, sbyte channel, System.Single &TypSamplePeriod ) : Int32
Device_DDSMem_GetUncertainty ( IntPtr hDevice, sbyte channel, byte &Uncertainty ) : Int32
Device_DDSMem_GetWarmUpTime ( IntPtr hDevice, sbyte channel, UInt16 &WarmUpTime ) : Int32
Device_DDSMem_GetYmaxValue ( IntPtr hDevice, sbyte channel, System.Single &YmaxValue ) : Int32
Device_DDSMem_GetYminValue ( IntPtr hDevice, sbyte channel, System.Single &YminValue ) : Int32
Device_DDSMem_GetYscale ( IntPtr hDevice, sbyte channel, byte &Yscale ) : Int32
Device_DDSMem_ReadRecord ( IntPtr hDevice, sbyte channel, byte strictDDSValidationFlag, UInt32 timeoutMs ) : Int32
Device_DDSMem_SetActiveCalPage ( IntPtr hDevice, sbyte channel, byte ActiveCalPage ) : Int32
Device_DDSMem_SetAveraging ( IntPtr hDevice, sbyte channel, byte Averaging ) : Int32
Device_DDSMem_SetCalPage ( IntPtr hDevice, sbyte channel, byte CalPageIndex, float CalibrationCoefficientA, float CalibrationCoefficientB, float CalibrationCoefficientC, String units ) : Int32
Device_DDSMem_SetCalibrationEquation ( IntPtr hDevice, sbyte channel, sbyte CalibrationEquation ) : Int32
Device_DDSMem_SetChecksum ( IntPtr hDevice, sbyte channel, byte Checksum ) : Int32
Device_DDSMem_SetCurrentRequirement ( IntPtr hDevice, sbyte channel, byte CurrentRequirement ) : Int32
Device_DDSMem_SetExperimentType ( IntPtr hDevice, sbyte channel, byte ExperimentType ) : Int32
Device_DDSMem_SetHighestValidCalPageIndex ( IntPtr hDevice, sbyte channel, byte HighestValidCalPageIndex ) : Int32
Device_DDSMem_SetLongName ( IntPtr hDevice, sbyte channel, String longName ) : IntPtr
Device_DDSMem_SetLotCode ( IntPtr hDevice, sbyte channel, byte YY_BCD, byte WW_BCD ) : Int32
Device_DDSMem_SetManufacturerID ( IntPtr hDevice, sbyte channel, byte ManufacturerID ) : Int32
Device_DDSMem_SetMemMapVersion ( IntPtr hDevice, sbyte channel, byte MemMapVersion ) : Int32
Device_DDSMem_SetMinSamplePeriod ( IntPtr hDevice, sbyte channel, System.Single MinSamplePeriod ) : Int32
Device_DDSMem_SetOperationType ( IntPtr hDevice, sbyte channel, byte OperationType ) : Int32
Device_DDSMem_SetRecord ( IntPtr hDevice, sbyte channel, VSTCoreDefsdotNET.VSTSensorDDSMemRec &rec ) : Int32
Device_DDSMem_SetSensorNumber ( IntPtr hDevice, sbyte channel, byte SensorNumber ) : Int32
Device_DDSMem_SetSerialNumber ( IntPtr hDevice, sbyte channel, byte leastSigByte_SerialNumber, byte midSigByte_SerialNumber, byte mostSigByte_SerialNumber ) : Int32
Device_DDSMem_SetShortName ( IntPtr hDevice, sbyte channel, String shortName ) : IntPtr
Device_DDSMem_SetSignificantFigures ( IntPtr hDevice, sbyte channel, byte SignificantFigures ) : Int32
Device_DDSMem_SetTypNumberofSamples ( IntPtr hDevice, sbyte channel, UInt16 TypNumberofSamples ) : Int32
Device_DDSMem_SetTypSamplePeriod ( IntPtr hDevice, sbyte channel, System.Single TypSamplePeriod ) : Int32
Device_DDSMem_SetUncertainty ( IntPtr hDevice, sbyte channel, byte Uncertainty ) : Int32
Device_DDSMem_SetWarmUpTime ( IntPtr hDevice, sbyte channel, UInt16 WarmUpTime ) : Int32
Device_DDSMem_SetYmaxValue ( IntPtr hDevice, sbyte channel, System.Single YmaxValue ) : Int32
Device_DDSMem_SetYminValue ( IntPtr hDevice, sbyte channel, System.Single YminValue ) : Int32
Device_DDSMem_SetYscale ( IntPtr hDevice, sbyte channel, byte Yscale ) : Int32
Device_DDSMem_WriteRecord ( IntPtr hDevice, sbyte channel, UInt32 timeoutMs ) : Int32
Device_Frm_AllocateCollectionFrames ( IntPtr hDevice, UInt16 numFrames, NGIOSetCollectionParams &collectionParams ) : Int32
Device_Frm_CopyRawMeasurements ( IntPtr hDevice, UInt32 frameId, sbyte channel, UInt32 firstMeasurementIndex, Int32 measurements, System.Int64 timestamps, UInt32 maxCount ) : Int32
Device_Frm_FreeCollectionFrames ( IntPtr hDevice ) : Int32
Device_Frm_GetCapturedFrameRange ( IntPtr hDevice, UInt32 &firstFrameId, UInt16 &numCapturedFrames ) : Int32
Device_Frm_GetInterframeDelay ( IntPtr hDevice, UInt32 firstFrameId, UInt32 secondFrameId, System.Int64 &interFrameDelay, System.Int64 &minInterFrameDelay ) : Int32
Device_Frm_GetNumCollectionFramesAllocated ( IntPtr hDevice, UInt16 &numFrames ) : Int32
Device_Frm_GetNumMeasurementsAvailable ( IntPtr hDevice, UInt32 frameId, sbyte channel ) : Int32
Device_Frm_GetQuickAndDirtyCapturedFrameRange ( IntPtr hDevice, UInt32 &firstFrameId, UInt16 &numCapturedFrames ) : Int32
Device_Frm_RetireCapturedFrame ( IntPtr hDevice, UInt32 frameId ) : Int32
Device_GetChannelRange ( IntPtr hDevice, UInt32 &minChannel, UInt32 &maxChannel ) : Int32
Device_GetLatestRawMeasurement ( IntPtr hDevice, sbyte channel ) : Int32
Device_GetMaximumMeasurementPeriod ( IntPtr hDevice, sbyte channel ) : double
Device_GetMeasurementPeriod ( IntPtr hDevice, sbyte channel, Double &period, UInt32 timeoutMs ) : Int32
Device_GetMeasurementTick ( IntPtr hDevice, sbyte channel ) : double
Device_GetMinimumMeasurementPeriod ( IntPtr hDevice, sbyte channel ) : double
Device_GetNumMeasurementsAvailable ( IntPtr hDevice, sbyte channel ) : Int32
Device_GetOpenDeviceName ( IntPtr hDevice, StringBuilder devnameBuf, UInt32 bufSize ) : Int32
Device_GetProbeType ( IntPtr hDevice, sbyte channel ) : Int32
Device_IsRemoteCollectionActive ( IntPtr hDevice, byte &remoteCollectionActiveFlag, UInt32 timeoutMs ) : Int32
Device_Lock ( IntPtr hDevice, UInt32 timeoutMs ) : Int32
Device_NVMemBlk_GetAddrRange ( IntPtr hDevice, sbyte channel, UInt32 &minAddr, UInt32 &maxAddr ) : Int32
Device_Open ( IntPtr hLib, String deviceName, byte bDemandExclusiveOwnership ) : IntPtr
Device_ReadRawMeasurements ( IntPtr hDevice, sbyte channel, Int32 measurements, System.Int64 timestamps, UInt32 maxCount ) : Int32
Device_SendCmdAndGetResponse ( IntPtr hDevice, byte cmd, IntPtr parameters, UInt32 nParamBytes, IntPtr response, UInt32 &nRespBytes, UInt32 timeoutMs ) : Int32
Device_SetMeasurementPeriod ( IntPtr hDevice, sbyte channel, Double desiredPeriod, UInt32 timeoutMs ) : Int32
Device_UncalibrateData ( IntPtr hDevice, sbyte channel, System.Single measurement ) : System.Single
Device_Unlock ( IntPtr hDevice ) : Int32
Diags_GetDebugTraceThreshold ( IntPtr hLIb, Int32 &threshold ) : Int32
Diags_SetDebugTraceThreshold ( IntPtr hLIb, Int32 threshold ) : Int32
GetDLLVersion ( IntPtr hLib, UInt16 &MajorVersion, UInt16 &MinorVersion ) : Int32
GetDeviceTypeFromDeviceName ( String deviceName, UInt32 &deviceType ) : Int32
GetParentDeviceHandleFromChildName ( String childDeviceName, IntPtr &parentDeviceHandle ) : Int32
Init ( ) : IntPtr
IsDeviceExclusivelyOurs ( IntPtr hDevice, byte &exclusiveOwnershipFlag ) : Int32
OpenDeviceListSnapshot ( IntPtr hLib, UInt32 deviceType, UInt32 &numDevices, UInt32 &DeviceListSignature ) : IntPtr
SearchForDevices ( IntPtr hLib, UInt32 deviceType, UInt32 commTransportId, IntPtr pParams, UInt32 &DeviceListSignature ) : Int32
Uninit ( IntPtr hLib ) : Int32

메소드 상세

Device_SendCmdAndGetResponse1() 공개 정적인 메소드

Send a command to the specified device hardware and wait for a response.

Each device type has a command protocol that is unique to that device type. The command protocol used by NGIO_DEVTYPE_LABQUEST_AUDIO devices is a subset of the protocol used by NGIO_DEVTYPE_LABQUEST devices. This protocol is documented in the NGIOSourceCmds class. Additional documentation can be found in NGIOSourceCmds.h.

Note that NGIO_Device_SendCmdAndGetResponse() will fail if you send a NGIO_CMD_ID_START_MEASUREMENTS command while NGIO_Device_GetNumMeasurementsAvailable() says measurements are available.

So...if you are restarting measurements, you should clear any old measurements in the NGIO Measurement Buffer first by reading in the measurements until the Buffer is empty, or you should call NGIO_Device_ClearIO().

Every command supported by NGIO_Device_SendCmdAndGetResponse() has an associated response. If no response specific to a command is defined, then the format of the response is NGIODefaultCmdResponse. Some commands have associated parameter blocks defined for them.

If NGIO_Device_SendCmdAndGetResponse() returns -1, additional information about a NGIO_Device_SendCmdAndGetResponse() error may be obtained by calling NGIO_Device_GetLastCmdResponseStatus().

public static Device_SendCmdAndGetResponse1 ( IntPtr hDevice, byte cmd, object parameters, object &response, UInt32 &nRespBytes, UInt32 timeoutMs ) : Int32
hDevice System.IntPtr [in] handle to open device.
cmd byte [in] command code.
parameters object [in] cmd specific parameter block
response object [out] response block
nRespBytes System.UInt32 [out] num of bytes passed back in the response block. /// Caller does not need to initialize this with the size of response block(as unmanaged code does) because the dotNET /// wrapper does so. ///
timeoutMs System.UInt32 [in] # of milliseconds to wait for a reply before giving up. Most devices should reply to /// almost all the currently defined commands within NGIO.TIMEOUT_MS_DEFAULT milliseconds. In fact, typical response /// times are less than 50 milliseconds.
리턴 System.Int32

Device_SendCmdAndGetResponse2() 공개 정적인 메소드

Device_SendCmdAndGetResponse2() is the same as Device_SendCmdAndGetResponse1() except that no response block is returned by the function(even though some sort of response always comes back from the device unless there is a communication failure). This is reasonable if the caller only cares about when the function succeeds or fails, which can be determined from the return value.
public static Device_SendCmdAndGetResponse2 ( IntPtr hDevice, byte cmd, object parameters, UInt32 timeoutMs ) : Int32
hDevice System.IntPtr
cmd byte
parameters object
timeoutMs System.UInt32
리턴 System.Int32

Device_SendCmdAndGetResponse3() 공개 정적인 메소드

Device_SendCmdAndGetResponse3() is the same as Device_SendCmdAndGetResponse1() except that no parameter block is sent to the device. That works fine for commands that do not require parameters.
public static Device_SendCmdAndGetResponse3 ( IntPtr hDevice, byte cmd, object &response, UInt32 &nRespBytes, UInt32 timeoutMs ) : Int32
hDevice System.IntPtr
cmd byte
response object
nRespBytes System.UInt32
timeoutMs System.UInt32
리턴 System.Int32

Device_SendCmdAndGetResponse4() 공개 정적인 메소드

Device_SendCmdAndGetResponse4() is the same as Device_SendCmdAndGetResponse1() except that no parameter block is sent to the device and no response block is returned by the function. That works fine for commands that do not require parameters when the caller is only interested in success or failure.
public static Device_SendCmdAndGetResponse4 ( IntPtr hDevice, byte cmd, UInt32 timeoutMs ) : Int32
hDevice System.IntPtr
cmd byte
timeoutMs System.UInt32
리턴 System.Int32