internal unsafe ConcreteToolResultUpdatedEventArgs(VsaRunningInfo *runninfInfo) { uint dwDetectTime = runninfInfo->dwDetectTime; uint dwBankTriggerNo = runninfInfo->dwBankTriggerNo; bool flag = runninfInfo->byDetectOk == (byte)1; SensorSetting *[] sensorSettings = ConcreteToolResultUpdatedEventArgs.GetSensorSettings(runninfInfo); SensorResult *[] sensorResults = ConcreteToolResultUpdatedEventArgs.GetSensorResults(runninfInfo); this._toolResults = new ToolResultBase[17]; for (int index = 0; index < sensorResults.Length; ++index) { this._toolResults[index] = (ToolResultBase)ToolKindBase.Create(sensorResults[index], sensorSettings[index]); } this.ProcessingTimeMicroSec = dwDetectTime; this.TotalStatusResult = flag; this.TriggerCount = dwBankTriggerNo; this.PositionAdjust = this._toolResults[0]; }
private static unsafe SensorResult *[] GetSensorResults(VsaRunningInfo *runninfInfo) { return(new SensorResult *[17] { &runninfInfo->asSensorResult0, &runninfInfo->asSensorResult1, &runninfInfo->asSensorResult2, &runninfInfo->asSensorResult3, &runninfInfo->asSensorResult4, &runninfInfo->asSensorResult5, &runninfInfo->asSensorResult6, &runninfInfo->asSensorResult7, &runninfInfo->asSensorResult8, &runninfInfo->asSensorResult9, &runninfInfo->asSensorResult10, &runninfInfo->asSensorResult11, &runninfInfo->asSensorResult12, &runninfInfo->asSensorResult13, &runninfInfo->asSensorResult14, &runninfInfo->asSensorResult15, &runninfInfo->asSensorResult16 }); }
private static unsafe SensorSetting *[] GetSensorSettings( VsaRunningInfo *runninfInfo) { return(new SensorSetting *[17] { &runninfInfo->sSettingInfo.asSensor0, &runninfInfo->sSettingInfo.asSensor1, &runninfInfo->sSettingInfo.asSensor2, &runninfInfo->sSettingInfo.asSensor3, &runninfInfo->sSettingInfo.asSensor4, &runninfInfo->sSettingInfo.asSensor5, &runninfInfo->sSettingInfo.asSensor6, &runninfInfo->sSettingInfo.asSensor7, &runninfInfo->sSettingInfo.asSensor8, &runninfInfo->sSettingInfo.asSensor9, &runninfInfo->sSettingInfo.asSensor10, &runninfInfo->sSettingInfo.asSensor11, &runninfInfo->sSettingInfo.asSensor12, &runninfInfo->sSettingInfo.asSensor13, &runninfInfo->sSettingInfo.asSensor14, &runninfInfo->sSettingInfo.asSensor15, &runninfInfo->sSettingInfo.asSensor16 }); }
public unsafe ReplyForGetSensorData(WorkSpace readBuffer) { *(ReplyForGetSensorData *)ref this = new ReplyForGetSensorData(); int size = readBuffer.Size; this.Pheader = (CommHeader *)(void *)readBuffer.Address; int num = size - sizeof(CommHeader); if (num < 0) { throw new ConnectionLostException("Received Header size is invalid."); } // ISSUE: reference to a compiler-generated field byte fixedElementField = this.Pheader->uOption0.abyCode.FixedElementField; byte *numPtr1 = (byte *)((CommHeader *)(void *)readBuffer.Address + 1); if (((int)fixedElementField >> 1 & 1) == 1 && sizeof(StructSize) <= num && ((StructSize *)numPtr1)->lLength == sizeof(VisionSensorState)) { num -= sizeof(StructSize) + sizeof(VisionSensorState); if (num < 0) { throw new ConnectionLostException("Received SensorState data size is invalid."); } byte *numPtr2 = numPtr1 + sizeof(StructSize); this.PSensorState = (VisionSensorState *)numPtr2; numPtr1 = numPtr2 + sizeof(VisionSensorState); } if (((int)fixedElementField & 1) == 1 && sizeof(StructSize) <= num && ((StructSize *)numPtr1)->lLength == sizeof(ImageSetMono)) { num -= sizeof(StructSize) + sizeof(ImageSetMono); if (num < 0) { throw new ConnectionLostException("Received monochrome image data size is invalid"); } byte *numPtr2 = numPtr1 + sizeof(StructSize); this.PMonoImage = (ImageSetMono *)numPtr2; numPtr1 = numPtr2 + sizeof(ImageSetMono); } if (((int)fixedElementField & 1) == 1 && sizeof(StructSize) <= num && ((StructSize *)numPtr1)->lLength == sizeof(ImageSetColor)) { num -= sizeof(StructSize) + sizeof(ImageSetColor); if (num < 0) { throw new ConnectionLostException("Received color Image data size is invalid."); } byte *numPtr2 = numPtr1 + sizeof(StructSize); this.PColorImage = (ImageSetColor *)numPtr2; numPtr1 = numPtr2 + sizeof(ImageSetColor); } if (((int)fixedElementField >> 2 & 1) == 1 && sizeof(StructSize) <= num && ((StructSize *)numPtr1)->lLength == sizeof(VsaRunningInfo)) { num -= sizeof(StructSize) + sizeof(VsaRunningInfo); if (num < 0) { throw new ConnectionLostException("Received runninf info size is invalid."); } byte *numPtr2 = numPtr1 + sizeof(StructSize); this.PRunninfInfo = (VsaRunningInfo *)numPtr2; numPtr1 = numPtr2 + sizeof(VsaRunningInfo); } if (((int)fixedElementField >> 3 & 1) == 1 && sizeof(StructSize) <= num && ((StructSize *)numPtr1)->lLength == sizeof(Summary)) { num -= sizeof(StructSize) + sizeof(Summary); if (num < 0) { throw new ConnectionLostException("Received summary data size is invalid."); } byte *numPtr2 = numPtr1 + sizeof(StructSize); this.PSummary = (Summary *)numPtr2; numPtr1 = numPtr2 + sizeof(Summary); } if (((int)fixedElementField >> 4 & 1) != 1 || sizeof(StructSize) > num || ((StructSize *)numPtr1)->lLength != sizeof(Histogram)) { return; } if (num - (sizeof(StructSize) + sizeof(Histogram)) < 0) { throw new ConnectionLostException("Received histogram data size is invalid."); } this.PHistogram = (Histogram *)(numPtr1 + sizeof(StructSize)); }