Пример #1
0
        internal static IEnumerable <string> EnumerateDeviceIdsInternal(string busId, DeviceFamily family)
        {
            var devIds = File.ReadLines(Path.Combine(SysfsDevicesPath, busId, "w1_master_slaves"));

            return(family switch
            {
                DeviceFamily.Any => devIds,
                DeviceFamily.Thermometer => devIds.Where(devId => OneWireThermometerDevice.IsCompatible(busId, devId)),
                _ => devIds.Where(devId => GetDeviceFamilyInternal(busId, devId) == family),
            });
Пример #2
0
        internal static IEnumerable <string> EnumerateDeviceIdsInternal(string busId, DeviceFamily family)
        {
            var devIds = File.ReadLines(Path.Combine(SysfsDevicesPath, busId, "w1_master_slaves"));

            switch (family)
            {
            case DeviceFamily.Any:
                return(devIds);

            case DeviceFamily.Ds18s20:
            case DeviceFamily.Ds18b20:
            case DeviceFamily.Ds1825:
            case DeviceFamily.Ds28ea00:
                return(devIds.Where(devId => GetDeviceFamilyInternal(busId, devId) == family));

            case DeviceFamily.Thermometer:
                return(devIds.Where(devId => OneWireThermometerDevice.IsCompatible(busId, devId)));
            }

            return(null);
        }