C# Класс GoIOdotNET.GoIO

The GoIO class provides an application program with full access to the data acquisition capabilities built into the Go family of devices, which include the Go! Link, Go! Temp, Go! Motion, and Vernier Mini GC devices. This class is a very thin managed code wrapper around the unmanaged GoIO DLL library. The GoIO class API is fairly broad, so knowing where to start is hard. The documentation for the GoIO_Sensor_Open() and the GoIO_Sensor_SendCmdAndGetResponse() functions are good starting places.

Refer to the GoIO_ParmBlk class for the command and response data structures passed into GoIO_Sensor_SendCmdAndGetResponse().

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

Показать файл Открыть проект

Открытые методы

Метод Описание
Sensor_SendCmdAndGetResponse1 ( IntPtr hSensor, byte cmd, object parameters, object &response, UInt32 &nRespBytes, Int32 timeoutMs ) : Int32

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

The protocol that is used to communicate with the Go devices via the GoIO_Sensor_SendCmdAndGetResponse() function is documented in the GoIO_ParmBlk class.

Note that GoIO_Sensor_SendCmdAndGetResponse() will fail if you send a CMD_ID_START_MEASUREMENTS command while GoIO_Sensor_GetNumMeasurementsAvailable() says measurements are available.

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

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

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

Sensor_SendCmdAndGetResponse2 ( IntPtr hSensor, byte cmd, object parameters, Int32 timeoutMs ) : Int32

Sensor_SendCmdAndGetResponse2() is the same as Sensor_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.

Sensor_SendCmdAndGetResponse3 ( IntPtr hSensor, byte cmd, object &response, UInt32 &nRespBytes, Int32 timeoutMs ) : Int32

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

Sensor_SendCmdAndGetResponse4 ( IntPtr hSensor, byte cmd, Int32 timeoutMs ) : Int32

Sensor_SendCmdAndGetResponse4() is the same as Sensor_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.

Приватные методы

Метод Описание
Diags_GetDebugTraceThreshold ( Int32 &threshold ) : Int32
Diags_SetDebugTraceThreshold ( Int32 threshold ) : Int32
GetDLLVersion ( UInt16 &MajorVersion, UInt16 &MinorVersion ) : Int32
GetNthAvailableDeviceName ( StringBuilder devnameBuf, Int32 bufSize, Int32 vendorId, Int32 productId, Int32 N ) : Int32
Init ( ) : IntPtr
Sensor_CalibrateData ( IntPtr hSensor, Double volts ) : Double
Sensor_ClearIO ( IntPtr hSensor ) : Int32
Sensor_Close ( IntPtr hSensor ) : Int32
Sensor_ConvertToVoltage ( IntPtr hSensor, Int32 rawMeasurement ) : Double
Sensor_DDSMem_CalculateChecksum ( IntPtr hSensor, byte &checksum ) : Int32
Sensor_DDSMem_ClearRecord ( IntPtr hSensor ) : Int32
Sensor_DDSMem_GetActiveCalPage ( IntPtr hSensor, byte &ActiveCalPage ) : Int32
Sensor_DDSMem_GetAveraging ( IntPtr hSensor, byte &Averaging ) : Int32
Sensor_DDSMem_GetCalPage ( IntPtr hSensor, byte CalPageIndex, float &CalibrationCoefficientA, float &CalibrationCoefficientB, float &CalibrationCoefficientC, StringBuilder units, UInt16 maxNumBytesToCopy ) : Int32
Sensor_DDSMem_GetCalibrationEquation ( IntPtr hSensor, sbyte &CalibrationEquation ) : Int32
Sensor_DDSMem_GetChecksum ( IntPtr hSensor, byte Checksum ) : Int32
Sensor_DDSMem_GetCurrentRequirement ( IntPtr hSensor, byte &CurrentRequirement ) : Int32
Sensor_DDSMem_GetExperimentType ( IntPtr hSensor, byte &ExperimentType ) : Int32
Sensor_DDSMem_GetHighestValidCalPageIndex ( IntPtr hSensor, byte &HighestValidCalPageIndex ) : Int32
Sensor_DDSMem_GetLongName ( IntPtr hSensor, StringBuilder longName, UInt16 maxNumBytesToCopy ) : IntPtr
Sensor_DDSMem_GetManufacturerID ( IntPtr hSensor, byte &ManufacturerID ) : Int32
Sensor_DDSMem_GetMemMapVersion ( IntPtr hSensor, byte &MemMapVersion ) : Int32
Sensor_DDSMem_GetMinSamplePeriod ( IntPtr hSensor, System.Single &MinSamplePeriod ) : Int32
Sensor_DDSMem_GetOperationType ( IntPtr hSensor, byte &OperationType ) : Int32
Sensor_DDSMem_GetRecord ( IntPtr hSensor, VSTCoreDefsdotNET.VSTSensorDDSMemRec &rec ) : Int32
Sensor_DDSMem_GetSensorNumber ( IntPtr hSensor, byte &SensorNumber, byte sendQueryToHardwareflag, Int32 timeoutMs ) : Int32
Sensor_DDSMem_GetSerialNumber ( IntPtr hSensor, byte &leastSigByte_SerialNumber, byte &midSigByte_SerialNumber, byte &mostSigByte_SerialNumber ) : Int32
Sensor_DDSMem_GetShortName ( IntPtr hSensor, StringBuilder shortName, UInt16 maxNumBytesToCopy ) : IntPtr
Sensor_DDSMem_GetSignificantFigures ( IntPtr hSensor, byte &SignificantFigures ) : Int32
Sensor_DDSMem_GetTypNumberofSamples ( IntPtr hSensor, UInt16 &TypNumberofSamples ) : Int32
Sensor_DDSMem_GetTypSamplePeriod ( IntPtr hSensor, System.Single &TypSamplePeriod ) : Int32
Sensor_DDSMem_GetUncertainty ( IntPtr hSensor, byte &Uncertainty ) : Int32
Sensor_DDSMem_GetWarmUpTime ( IntPtr hSensor, UInt16 &WarmUpTime ) : Int32
Sensor_DDSMem_GetYmaxValue ( IntPtr hSensor, System.Single &YmaxValue ) : Int32
Sensor_DDSMem_GetYminValue ( IntPtr hSensor, System.Single &YminValue ) : Int32
Sensor_DDSMem_GetYscale ( IntPtr hSensor, byte &Yscale ) : Int32
Sensor_DDSMem_ReadRecord ( IntPtr hSensor, byte strictDDSValidationFlag, Int32 timeoutMs ) : Int32
Sensor_DDSMem_SetActiveCalPage ( IntPtr hSensor, byte ActiveCalPage ) : Int32
Sensor_DDSMem_SetAveraging ( IntPtr hSensor, byte Averaging ) : Int32
Sensor_DDSMem_SetCalPage ( IntPtr hSensor, byte CalPageIndex, float CalibrationCoefficientA, float CalibrationCoefficientB, float CalibrationCoefficientC, String units ) : Int32
Sensor_DDSMem_SetCalibrationEquation ( IntPtr hSensor, sbyte CalibrationEquation ) : Int32
Sensor_DDSMem_SetChecksum ( IntPtr hSensor, byte Checksum ) : Int32
Sensor_DDSMem_SetCurrentRequirement ( IntPtr hSensor, byte CurrentRequirement ) : Int32
Sensor_DDSMem_SetExperimentType ( IntPtr hSensor, byte ExperimentType ) : Int32
Sensor_DDSMem_SetHighestValidCalPageIndex ( IntPtr hSensor, byte HighestValidCalPageIndex ) : Int32
Sensor_DDSMem_SetLongName ( IntPtr hSensor, String longName ) : IntPtr
Sensor_DDSMem_SetLotCode ( IntPtr hSensor, byte YY_BCD, byte WW_BCD ) : Int32
Sensor_DDSMem_SetManufacturerID ( IntPtr hSensor, byte ManufacturerID ) : Int32
Sensor_DDSMem_SetMemMapVersion ( IntPtr hSensor, byte MemMapVersion ) : Int32
Sensor_DDSMem_SetMinSamplePeriod ( IntPtr hSensor, System.Single MinSamplePeriod ) : Int32
Sensor_DDSMem_SetOperationType ( IntPtr hSensor, byte OperationType ) : Int32
Sensor_DDSMem_SetRecord ( IntPtr hSensor, VSTCoreDefsdotNET.VSTSensorDDSMemRec &rec ) : Int32
Sensor_DDSMem_SetSensorNumber ( IntPtr hSensor, byte SensorNumber ) : Int32
Sensor_DDSMem_SetSerialNumber ( IntPtr hSensor, byte leastSigByte_SerialNumber, byte midSigByte_SerialNumber, byte mostSigByte_SerialNumber ) : Int32
Sensor_DDSMem_SetShortName ( IntPtr hSensor, String shortName ) : IntPtr
Sensor_DDSMem_SetSignificantFigures ( IntPtr hSensor, byte SignificantFigures ) : Int32
Sensor_DDSMem_SetTypNumberofSamples ( IntPtr hSensor, UInt16 TypNumberofSamples ) : Int32
Sensor_DDSMem_SetTypSamplePeriod ( IntPtr hSensor, System.Single TypSamplePeriod ) : Int32
Sensor_DDSMem_SetUncertainty ( IntPtr hSensor, byte Uncertainty ) : Int32
Sensor_DDSMem_SetWarmUpTime ( IntPtr hSensor, UInt16 WarmUpTime ) : Int32
Sensor_DDSMem_SetYmaxValue ( IntPtr hSensor, System.Single YmaxValue ) : Int32
Sensor_DDSMem_SetYminValue ( IntPtr hSensor, System.Single YminValue ) : Int32
Sensor_DDSMem_SetYscale ( IntPtr hSensor, byte Yscale ) : Int32
Sensor_DDSMem_WriteRecord ( IntPtr hSensor, Int32 timeoutMs ) : Int32
Sensor_GetLastCmdResponseStatus ( IntPtr hSensor, byte &LastCmd, byte &LastCmdStatus, byte &LastCmdWithErrorRespSentOvertheWire, byte &LastErrorSentOvertheWire ) : Int32
Sensor_GetLatestRawMeasurement ( IntPtr hSensor ) : Int32
Sensor_GetMaximumMeasurementPeriod ( IntPtr hSensor ) : double
Sensor_GetMeasurementPeriod ( IntPtr hSensor, Int32 timeoutMs ) : double
Sensor_GetMeasurementTickInSeconds ( IntPtr hSensor ) : double
Sensor_GetMinimumMeasurementPeriod ( IntPtr hSensor ) : double
Sensor_GetNumMeasurementsAvailable ( IntPtr hSensor ) : Int32
Sensor_GetOpenDeviceName ( IntPtr hSensor, StringBuilder devnameBuf, Int32 bufSize, Int32 &vendorId, Int32 &productId ) : Int32
Sensor_GetProbeType ( IntPtr hSensor ) : Int32
Sensor_Lock ( IntPtr hSensor, Int32 timeoutMs ) : Int32
Sensor_Open ( String deviceName, Int32 vendorId, Int32 productId, Int32 strictDDSValidationFlag ) : IntPtr
Sensor_ReadRawMeasurements ( IntPtr hSensor, Int32 measurements, UInt32 maxCount ) : Int32
Sensor_SendCmdAndGetResponse ( IntPtr hSensor, byte cmd, IntPtr parameters, UInt32 nParamBytes, IntPtr response, UInt32 &nRespBytes, Int32 timeoutMs ) : Int32
Sensor_SetMeasurementPeriod ( IntPtr hSensor, Double desiredPeriod, Int32 timeoutMs ) : Int32
Sensor_Unlock ( IntPtr hSensor ) : Int32
Uninit ( ) : Int32
UpdateListOfAvailableDevices ( Int32 vendorId, Int32 productId ) : Int32

Описание методов

Sensor_SendCmdAndGetResponse1() публичный статический Метод

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

The protocol that is used to communicate with the Go devices via the GoIO_Sensor_SendCmdAndGetResponse() function is documented in the GoIO_ParmBlk class.

Note that GoIO_Sensor_SendCmdAndGetResponse() will fail if you send a CMD_ID_START_MEASUREMENTS command while GoIO_Sensor_GetNumMeasurementsAvailable() says measurements are available.

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

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

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

public static Sensor_SendCmdAndGetResponse1 ( IntPtr hSensor, byte cmd, object parameters, object &response, UInt32 &nRespBytes, Int32 timeoutMs ) : Int32
hSensor 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.Int32 [in] # of milliseconds to wait for a reply before giving up. Most devices should reply to /// almost all the currently defined commands within GoIO.TIMEOUT_MS_DEFAULT milliseconds. In fact, typical response /// times are less than 50 milliseconds.
Результат System.Int32

Sensor_SendCmdAndGetResponse2() публичный статический Метод

Sensor_SendCmdAndGetResponse2() is the same as Sensor_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 Sensor_SendCmdAndGetResponse2 ( IntPtr hSensor, byte cmd, object parameters, Int32 timeoutMs ) : Int32
hSensor System.IntPtr
cmd byte
parameters object
timeoutMs System.Int32
Результат System.Int32

Sensor_SendCmdAndGetResponse3() публичный статический Метод

Sensor_SendCmdAndGetResponse3() is the same as Sensor_SendCmdAndGetResponse1() except that no parameter block is sent to the device. That works fine for commands that do not require parameters.
public static Sensor_SendCmdAndGetResponse3 ( IntPtr hSensor, byte cmd, object &response, UInt32 &nRespBytes, Int32 timeoutMs ) : Int32
hSensor System.IntPtr
cmd byte
response object
nRespBytes System.UInt32
timeoutMs System.Int32
Результат System.Int32

Sensor_SendCmdAndGetResponse4() публичный статический Метод

Sensor_SendCmdAndGetResponse4() is the same as Sensor_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 Sensor_SendCmdAndGetResponse4 ( IntPtr hSensor, byte cmd, Int32 timeoutMs ) : Int32
hSensor System.IntPtr
cmd byte
timeoutMs System.Int32
Результат System.Int32