public eReturn GetSensorOutputData(string deviceIdIndex, DeviceData deviceObject) { DeviceCapabilities deviceCapabilities = new DeviceCapabilities(); byte[] deviceStatusData = new byte[18]; eReturn eReturn; switch (((GENEAG3WinUSBPCDriver)this.m_DeviceIdentity[(object)deviceIdIndex]).GetDeviceStatus(ref deviceStatusData)) { case GeneaPCDriver.eReturn.SUCCESS: eReturn = deviceCapabilities.ParseAndPackGetStatus(deviceObject, deviceStatusData); break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } return(eReturn); }
public eReturn UpdateDevice(string deviceID) { byte[] deviceInfoBuffer = new byte[452]; byte[] calibInfoBuffer = new byte[28]; byte[] deviceStatusData = new byte[18]; byte[] configInfoBuffer = new byte[45]; byte[] memoryStatusBuffer = new byte[3]; eReturn eReturn; if (this.m_DeviceIdentity.Contains((object)deviceID)) { GENEAG3WinUSBPCDriver geneaWinUSBPCDriverObject = (GENEAG3WinUSBPCDriver)this.m_DeviceIdentity[(object)deviceID]; if (this.m_DataManager.deviceIDTable.Contains((object)deviceID)) { DeviceData deviceData = (DeviceData)this.m_DataManager.deviceIDTable[(object)deviceID]; switch (geneaWinUSBPCDriverObject.GetDeviceInfo(ref deviceInfoBuffer)) { case GeneaPCDriver.eReturn.SUCCESS: eReturn = this.m_ParseAndPackDataObj.ParseAndPackGetID(deviceInfoBuffer, deviceData); if (eReturn == eReturn.SUCCESS) { string uniqueSerialCode = deviceData.ObjDeviceInfo.DeviceUniqueSerialCode; //eReturn = this.GetDeviceCapabilities(geneaWinUSBPCDriverObject, deviceData); if (eReturn == eReturn.SUCCESS) { switch (geneaWinUSBPCDriverObject.GetCalibInfo(ref calibInfoBuffer)) { case GeneaPCDriver.eReturn.SUCCESS: eReturn = this.m_ParseAndPackDataObj.ParseAndPackGetCalibInfo(calibInfoBuffer, deviceData.ObjCalibInfo); break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } } if (eReturn == eReturn.SUCCESS) { DeviceCapabilities deviceCapabilities = new DeviceCapabilities(); switch (geneaWinUSBPCDriverObject.GetDeviceStatus(ref deviceStatusData)) { case GeneaPCDriver.eReturn.SUCCESS: eReturn = deviceCapabilities.ParseAndPackGetStatus(deviceData, deviceStatusData); break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } } if (eReturn == eReturn.SUCCESS) { switch (geneaWinUSBPCDriverObject.GetConfiguration(ref configInfoBuffer)) { case GeneaPCDriver.eReturn.SUCCESS: eReturn = this.m_ParseAndPackDataObj.ParseAndPackGetConfigInfo(deviceData, configInfoBuffer); break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } } if (eReturn == eReturn.SUCCESS) { switch (geneaWinUSBPCDriverObject.GetMemoryUsed(ref memoryStatusBuffer)) { case GeneaPCDriver.eReturn.SUCCESS: eReturn = this.m_ParseAndPackDataObj.ParseAndPackMemoryInfo(memoryStatusBuffer, deviceData.ObjDeviceStatusInfo); break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } } if (eReturn == eReturn.SUCCESS) { eReturn = this.m_DataManager.AddDeviceObject(uniqueSerialCode, deviceData); break; } break; } break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } } else { eReturn = eReturn.FAILURE; } } else { eReturn = eReturn.FAILURE; } return(eReturn); }
private eReturn InitializeDevice(int deviceIdIndex) { byte[] deviceInfoBuffer = new byte[452]; byte[] calibInfoBuffer = new byte[28]; byte[] deviceStatusData = new byte[18]; byte[] configInfoBuffer = new byte[45]; byte[] memoryStatusBuffer = new byte[3]; eReturn eReturn = eReturn.FAILURE; GENEAG3WinUSBPCDriver geneaWinUSBPCDriverObject = new GENEAG3WinUSBPCDriver(); if (geneaWinUSBPCDriverObject.InitialiseDevice(this.m_DevicePathList[deviceIdIndex])) { switch (geneaWinUSBPCDriverObject.GetDeviceInfo(ref deviceInfoBuffer)) { case GeneaPCDriver.eReturn.SUCCESS: DeviceData deviceData = new DeviceData(); eReturn = this.m_ParseAndPackDataObj.ParseAndPackGetID(deviceInfoBuffer, deviceData); if (eReturn == eReturn.SUCCESS) { string uniqueSerialCode = deviceData.ObjDeviceInfo.DeviceUniqueSerialCode; if (!this.m_DeviceIdentity.Contains((object)uniqueSerialCode)) { this.m_DeviceIdentity.Add((object)uniqueSerialCode, (object)geneaWinUSBPCDriverObject); this.m_DevicePathID.Add((object)this.m_DevicePathList[deviceIdIndex], (object)uniqueSerialCode); //eReturn = this.GetDeviceCapabilities(geneaWinUSBPCDriverObject, deviceData); if (eReturn == eReturn.SUCCESS) { switch (geneaWinUSBPCDriverObject.GetCalibInfo(ref calibInfoBuffer)) { case GeneaPCDriver.eReturn.SUCCESS: eReturn = this.m_ParseAndPackDataObj.ParseAndPackGetCalibInfo(calibInfoBuffer, deviceData.ObjCalibInfo); break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } } if (eReturn == eReturn.SUCCESS) { DeviceCapabilities deviceCapabilities = new DeviceCapabilities(); switch (geneaWinUSBPCDriverObject.GetDeviceStatus(ref deviceStatusData)) { case GeneaPCDriver.eReturn.SUCCESS: eReturn = deviceCapabilities.ParseAndPackGetStatus(deviceData, deviceStatusData); break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } } if (eReturn == eReturn.SUCCESS) { switch (geneaWinUSBPCDriverObject.GetConfiguration(ref configInfoBuffer)) { case GeneaPCDriver.eReturn.SUCCESS: //eReturn = this.m_ParseAndPackDataObj.ParseAndPackGetConfigInfo(deviceData, configInfoBuffer); break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } } if (eReturn == eReturn.SUCCESS) { switch (geneaWinUSBPCDriverObject.GetMemoryUsed(ref memoryStatusBuffer)) { case GeneaPCDriver.eReturn.SUCCESS: eReturn = this.m_ParseAndPackDataObj.ParseAndPackMemoryInfo(memoryStatusBuffer, deviceData.ObjDeviceStatusInfo); break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } } if (eReturn == eReturn.SUCCESS) { eReturn = this.m_DataManager.AddDeviceObject(uniqueSerialCode, deviceData); break; } break; } eReturn = eReturn.DEVICE_ID_ALREADY_PRESENT; break; } break; case GeneaPCDriver.eReturn.ERROR_DEVICE_COMMUNICATION: eReturn = eReturn.ERROR_DEVICE_COMMUNICATION; break; case GeneaPCDriver.eReturn.ERROR_FIRMWARE: eReturn = eReturn.ERROR_FIRMWARE; break; default: eReturn = eReturn.FAILURE; break; } } return(eReturn); }