コード例 #1
0
        internal static SensorInformation GetSensorInformation(IntPtr handle)
        {
            SensorInformation info = new SensorInformation();

            _E(_GetSensorInformation(handle, ref info));
            return(info);
        }
コード例 #2
0
        public static Sensor GetSensorByHandle(IntPtr handle)
        {
            SensorInformation info = new SensorInformation();

            _E(_GetSensorInformation(handle, ref info));
            if (SensorDictionary.TryGetValue(info.serial_number, out Sensor s))
            {
                return(s);
            }
            return(SensorDictionary[info.serial_number] = SensorFactory(ref info));
        }
コード例 #3
0
        public static void UpdateSensors()
        {
            int ns      = _GetSensorCount();
            var handles = new HashSet <ulong>(SensorDictionary.Keys);

            SensorInformation info = new SensorInformation();

            for (int i = 0; i < ns; i++)
            {
                if (_GetSensorInformationByIndex(i, ref info) == SensorErrorCode.SUCCESS)
                {
                    SensorDictionary.GetOrAdd(info.serial_number, (sn) => SensorFactory(ref info));
                    handles.Remove(info.serial_number);
                }
            }
            foreach (ulong key in handles)
            {
                SensorDictionary.TryRemove(key, out _);
            }
        }
コード例 #4
0
 protected internal Sensor(ref SensorInformation information) => info = information;
コード例 #5
0
 private static extern SensorErrorCode _GetSensorInformationByIndex(int idx, [In, Out] ref SensorInformation info);
コード例 #6
0
 private static extern SensorErrorCode _GetSensorInformation(IntPtr handle, [In, Out] ref SensorInformation info);