public PalletStraight(PalletStraightInfo info) : base(info) { try { palletStraightInfo = info; ReleaseTimer.OnElapsed += ReleaseTimer_OnElapsed; ConstructDevice = new ConstructDevice(string.Empty); LineReleasePhotocellName = palletStraightInfo.LineReleasePhotocellName; DeviceInfo deviceInfo = DeviceInfos.Find(i => i.name == LineReleasePhotocellName); if (deviceInfo == null) { PalletPhotocellInfo photocellInfo = new PalletPhotocellInfo(); photocellInfo.name = "LineRelease"; photocellInfo.distanceFrom = PositionPoint.End; photocellInfo.distance = 0.125f; photocellInfo.type = ConstructDevice.DeviceTypes["Add Photocell"].Item1; //Item1 is the device type ...obviously! DeviceInfos.Add(photocellInfo); } ConstructDevice.InsertDevices(this as IConstructDevice); SetLineReleasePhotocell(); LineReleaseEvents(true); if (ControlType == ControlTypes.Local) { OnLoadArrived += Photocell_OnLoadArrived; } } catch (Exception ex) { Core.Environment.Log.Write(ex.Message); } }
public StraightPhotocellConveyor(StraightPhotocellConveyorInfo info) : base(info) { try { straightInfo = info; releaseTimer.OnElapsed += ReleaseTimer_OnElapsed; constructDevice = new ConstructDevice(string.Empty); LineReleasePhotocellName = straightInfo.LineReleasePhotocellName; DeviceInfo deviceInfo = DeviceInfos.Find(i => i.name == LineReleasePhotocellName); if (deviceInfo == null) { CasePhotocellInfo photocellInfo = new CasePhotocellInfo(); photocellInfo.name = "LineRelease"; photocellInfo.distanceFrom = PositionPoint.End; photocellInfo.distance = 0.125f; photocellInfo.type = constructDevice.DeviceTypes["Add Photocell"].Item1; //Item1 is the device type ...obviously! DeviceInfos.Add(photocellInfo); } constructDevice.InsertDevices(this as IConstructDevice); SetLineReleasePhotocell(); LineReleaseEvents(true); } catch (Exception ex) { Core.Environment.Log.Write(ex.Message); } }
private void HandleAllThingsData(List <DeviceInfo> deviceInfos) { foreach (DeviceInfo info in deviceInfos) { //TODO updating device information could be useful someday //so we could just override all and update the ui? if (!DeviceInfos.ContainsKey(info.Uid)) { DeviceInfos.Add(info.Uid, info); } } }
internal PlatformInfo(int index) { Index = index; // get a platform uint count = 0; OpenCL.clGetPlatformIDs(0, null, &count).CheckError(); var platforms = (void **)Marshal.AllocCoTaskMem((int)(count * IntPtr.Size)); void *platform; try { OpenCL.clGetPlatformIDs(count, platforms, &count).CheckError(); platform = platforms[index]; } finally { Marshal.FreeCoTaskMem(new IntPtr(platforms)); } // get platform infos foreach (cl_platform_info info in Enum.GetValues(typeof(cl_platform_info))) { var size = new IntPtr(); OpenCL.clGetPlatformInfo(platform, info, IntPtr.Zero, null, &size).CheckError(); byte[] value = new byte[(int)size]; fixed(byte *valuePointer = value) { OpenCL.clGetPlatformInfo(platform, info, size, valuePointer, null).CheckError(); infos.Add(Enum.GetName(typeof(cl_platform_info), info), value); } } // get devices var deviceIdStatus = OpenCL.clGetDeviceIDs(platform, cl_device_type.CL_DEVICE_TYPE_ALL, 0, null, &count); IsDeviceInfoObtainable = !deviceIdStatus.HasError(); if (IsDeviceInfoObtainable) { // create device infos for (int i = 0; i < count; i++) { DeviceInfos.Add(new DeviceInfo(platform, i)); } } }