Exemple #1
0
        internal static void ScanForDeviceChangesInternal(OneWireBus bus, int numDevices, int numScans)
        {
            if (numDevices > 0)
            {
                File.WriteAllText(Path.Combine(SysfsDevicesPath, bus.BusId, "w1_master_max_slave_count"), numDevices.ToString());
            }

            File.WriteAllText(Path.Combine(SysfsDevicesPath, bus.BusId, "w1_master_search"), numScans.ToString());
        }
Exemple #2
0
 /// <summary>
 /// Enumerate all devices found on 1-wire busses in this system.
 /// </summary>
 /// <param name="family">Family id used to filter devices.</param>
 /// <returns>A list of devices found.</returns>
 public static IEnumerable <(string busId, string devId)> EnumerateDeviceIds(DeviceFamily family = DeviceFamily.Any)
 {
     foreach (var busId in OneWireBus.EnumerateBusIdsInternal())
     {
         foreach (var devId in OneWireBus.EnumerateDeviceIdsInternal(busId, family))
         {
             yield return(busId, devId);
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// Check if device is compatible with this family of devices.
        /// </summary>
        /// <param name="busId">The 1-wire bus the device is found on.</param>
        /// <param name="devId">The id of the device.</param>
        /// <returns>Returns true if device is compatible.</returns>
        public static bool IsCompatible(string busId, string devId)
        {
            var family = OneWireBus.GetDeviceFamilyInternal(busId, devId);

            return(IsCompatible(family));
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OneWireDevice"/> class.
 /// </summary>
 /// <param name="busId">The 1-wire bus the device is found on.</param>
 /// <param name="devId">The id of the device.</param>
 public OneWireDevice(string busId, string devId)
 {
     BusId    = busId;
     DeviceId = devId;
     Family   = OneWireBus.GetDeviceFamilyInternal(busId, devId);
 }