未验证 提交 32ce2120 编写于 作者: K Krzysztof Wicher 提交者: GitHub

Update device listing (#1300)

上级 2032f587
# AHT10/15/20 Temperature and Humidity Sensor Modules # AHT10/15/20 - Temperature and humidity sensor modules
## Summary ## Summary
The AHT10/15 and AHT20 sensors are high-precision, calibrated temperature and relative humidity sensor modules with an I2C digital interface. The AHT10/15 and AHT20 sensors are high-precision, calibrated temperature and relative humidity sensor modules with an I2C digital interface.
......
hygrometers hygrometer
thermometers thermometer
\ No newline at end of file
# APA102 (Double line transmission integrated control LED) # APA102 - Double line transmission integrated control LED
APA102 is a intelligent control LED light source that the control circuit and RGB chip are integrated in a package of 5050/2020 components. It internal include 3 groups shift register and Selfdetection sign decoder circuit. APA102 is a intelligent control LED light source that the control circuit and RGB chip are integrated in a package of 5050/2020 components. It internal include 3 groups shift register and Selfdetection sign decoder circuit.
......
characterlcd characterlcd
lcd lcd
display
multiplexer multiplexer
\ No newline at end of file gpio
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
* [ADS1115 - Analog to Digital Converter](Ads1115/README.md) * [ADS1115 - Analog to Digital Converter](Ads1115/README.md)
* [ADXL345 - Accelerometer](Adxl345/README.md) * [ADXL345 - Accelerometer](Adxl345/README.md)
* [AGS01DB - MEMS VOC Gas Sensor](Ags01db/README.md) * [AGS01DB - MEMS VOC Gas Sensor](Ags01db/README.md)
* [AHT10/15/20 - Temperature and humidity sensor modules](Ahtxx/README.md)
* [AK8963 - Magnetometer](Ak8963/README.md) * [AK8963 - Magnetometer](Ak8963/README.md)
* [APA102 - Double line transmission integrated control LED](Apa102/README.md)
* [Bh1745 - RGB Sensor](Bh1745/README.md) * [Bh1745 - RGB Sensor](Bh1745/README.md)
* [BH1750FVI - Ambient Light Sensor](Bh1750fvi/README.md) * [BH1750FVI - Ambient Light Sensor](Bh1750fvi/README.md)
* [BMP180 - barometer, altitude and temperature sensor](Bmp180/README.md) * [BMP180 - barometer, altitude and temperature sensor](Bmp180/README.md)
...@@ -16,10 +18,15 @@ ...@@ -16,10 +18,15 @@
* [BNO055 - inertial measurement unit](Bno055/README.md) * [BNO055 - inertial measurement unit](Bno055/README.md)
* [BrickPi3](BrickPi3/README.md) * [BrickPi3](BrickPi3/README.md)
* [Buzzer - Piezo Buzzer Controller](Buzzer/README.md) * [Buzzer - Piezo Buzzer Controller](Buzzer/README.md)
* [CCS811 Gas sensor](Ccs811/README.md)
* [Character LCD (Liquid Crystal Display)](CharacterLcd/README.md) * [Character LCD (Liquid Crystal Display)](CharacterLcd/README.md)
* [Charlieplex Segment binding](Charlieplex/README.md)
* [Cpu Temperature](CpuTemperature/README.md) * [Cpu Temperature](CpuTemperature/README.md)
* [DC Motor Controller](DCMotor/README.md) * [DC Motor Controller](DCMotor/README.md)
* [DHTxx - Digital-Output Relative Humidity & Temperature Sensor Module](Dhtxx/README.md) * [DHTxx - Digital-Output Relative Humidity & Temperature Sensor Module](Dhtxx/README.md)
* [Digital liquid level switch](LiquidLevel/README.md)
* [Explorer HAT Pro (Pimoroni)](ExplorerHat/README.md)
* [Generic shift register](ShiftRegister/README.md)
* [GoPiGo3](GoPiGo3/README.md) * [GoPiGo3](GoPiGo3/README.md)
* [GrovePi](GrovePi/README.md) * [GrovePi](GrovePi/README.md)
* [HC-SR04 - Ultrasonic Ranging Module](Hcsr04/README.md) * [HC-SR04 - Ultrasonic Ranging Module](Hcsr04/README.md)
...@@ -32,10 +39,13 @@ ...@@ -32,10 +39,13 @@
* [LSM9DS1 - 3D accelerometer, gyroscope and magnetometer](Lsm9Ds1/README.md) * [LSM9DS1 - 3D accelerometer, gyroscope and magnetometer](Lsm9Ds1/README.md)
* [MAX44009 - Ambient Light Sensor](Max44009/README.md) * [MAX44009 - Ambient Light Sensor](Max44009/README.md)
* [Max7219 (LED Matrix driver)](Max7219/README.md) * [Max7219 (LED Matrix driver)](Max7219/README.md)
* [MBI5027 -- 16-bit shift register with error detection](Mbi5027/README.md)
* [Mcp23xxx - I/O Expander device family](Mcp23xxx/README.md) * [Mcp23xxx - I/O Expander device family](Mcp23xxx/README.md)
* [Mcp25xxx device family - CAN bus](Mcp25xxx/README.md) * [Mcp25xxx device family - CAN bus](Mcp25xxx/README.md)
* [Mcp3428 - Analog to Digital Converter (I2C)](Mcp3428/README.md) * [Mcp3428 - Analog to Digital Converter (I2C)](Mcp3428/README.md)
* [MCP3xxx family of Analog to Digital Converters](Mcp3xxx/README.md) * [MCP3xxx family of Analog to Digital Converters](Mcp3xxx/README.md)
* [MCP9808 - Digital Temperature Sensor](Mcp9808/README.md)
* [MH-Z19B CO2-Sensor](Mhz19b/README.md)
* [MLX90614 - Infra Red Thermometer](Mlx90614/README.md) * [MLX90614 - Infra Red Thermometer](Mlx90614/README.md)
* [MotorHat](MotorHat/README.md) * [MotorHat](MotorHat/README.md)
* [MPR121 - Proximity Capacitive Touch Sensor Controller](Mpr121/README.md) * [MPR121 - Proximity Capacitive Touch Sensor Controller](Mpr121/README.md)
...@@ -43,9 +53,12 @@ ...@@ -43,9 +53,12 @@
* [nRF24L01 - Single Chip 2.4 GHz Transceiver](Nrf24l01/README.md) * [nRF24L01 - Single Chip 2.4 GHz Transceiver](Nrf24l01/README.md)
* [NXP/TI PCx857x](Pcx857x/README.md) * [NXP/TI PCx857x](Pcx857x/README.md)
* [On-board LED driver](BoardLed/README.md) * [On-board LED driver](BoardLed/README.md)
* [OpenHardwareMonitor client library](HardwareMonitor/README.md)
* [Pca95x4 - I2C GPIO Expander](Pca95x4/README.md) * [Pca95x4 - I2C GPIO Expander](Pca95x4/README.md)
* [Pca9685 - I2C PWM Driver](Pca9685/README.md) * [Pca9685 - I2C PWM Driver](Pca9685/README.md)
* [PN5180 - RFID and NFC reader](Pn5180/README.md)
* [PN532 - RFID and NFC reader](Pn532/README.md) * [PN532 - RFID and NFC reader](Pn532/README.md)
* [Quadrature Rotary Encoder](RotaryEncoder/README.md)
* [Radio Receiver](RadioReceiver/README.md) * [Radio Receiver](RadioReceiver/README.md)
* [Radio Transmitter](RadioTransmitter/README.md) * [Radio Transmitter](RadioTransmitter/README.md)
* [Realtime Clock](Rtc/README.md) * [Realtime Clock](Rtc/README.md)
...@@ -55,7 +68,9 @@ ...@@ -55,7 +68,9 @@
* [Sense HAT](SenseHat/README.md) * [Sense HAT](SenseHat/README.md)
* [Servo Motor](ServoMotor/README.md) * [Servo Motor](ServoMotor/README.md)
* [SHT3x - Temperature & Humidity Sensor](Sht3x/README.md) * [SHT3x - Temperature & Humidity Sensor](Sht3x/README.md)
* [SHTC3 - Temperature & Humidity Sensor](Shtc3/README.md)
* [Si7021 - Temperature & Humidity Sensor](Si7021/README.md) * [Si7021 - Temperature & Humidity Sensor](Si7021/README.md)
* [SN74HC595 -- 8-bit shift register](Sn74hc595/README.md)
* [SocketCan - CAN BUS library (Linux only)](SocketCan/README.md) * [SocketCan - CAN BUS library (Linux only)](SocketCan/README.md)
* [Software PWM](SoftPwm/README.md) * [Software PWM](SoftPwm/README.md)
* [Software SPI](SoftwareSpi/README.md) * [Software SPI](SoftwareSpi/README.md)
...@@ -67,4 +82,5 @@ ...@@ -67,4 +82,5 @@
* [TM1637 - Segment Display](Tm1637/README.md) * [TM1637 - Segment Display](Tm1637/README.md)
* [VL53L0X - distance sensor](Vl53L0X/README.md) * [VL53L0X - distance sensor](Vl53L0X/README.md)
* [Ws28xx LED drivers](Ws28xx/README.md) * [Ws28xx LED drivers](Ws28xx/README.md)
* [μFire ISE Probe - pH, ORP and temperature sensor](UFireIse/README.md)
</devices> </devices>
# OpenHardwareMonitor # OpenHardwareMonitor client library
Client binding for OpenHardwareMonitor. Client binding for OpenHardwareMonitor.
......
multiplexer multiplexer
\ No newline at end of file gpio
...@@ -30,6 +30,13 @@ Our vision: the majority of .NET bindings are written completely in .NET languag ...@@ -30,6 +30,13 @@ Our vision: the majority of .NET bindings are written completely in .NET languag
* [AGS01DB - MEMS VOC Gas Sensor](Ags01db/README.md) * [AGS01DB - MEMS VOC Gas Sensor](Ags01db/README.md)
* [BMxx80 Device Family](Bmxx80/README.md) * [BMxx80 Device Family](Bmxx80/README.md)
* [CCS811 Gas sensor](Ccs811/README.md)
* [MH-Z19B CO2-Sensor](Mhz19b/README.md)
### Liquid sensors
* [Digital liquid level switch](LiquidLevel/README.md)
* [μFire ISE Probe - pH, ORP and temperature sensor](UFireIse/README.md)
### Light sensor ### Light sensor
...@@ -52,6 +59,7 @@ Our vision: the majority of .NET bindings are written completely in .NET languag ...@@ -52,6 +59,7 @@ Our vision: the majority of .NET bindings are written completely in .NET languag
### Thermometers ### Thermometers
* [AHT10/15/20 - Temperature and humidity sensor modules](Ahtxx/README.md)
* [BMP180 - barometer, altitude and temperature sensor](Bmp180/README.md) * [BMP180 - barometer, altitude and temperature sensor](Bmp180/README.md)
* [BMxx80 Device Family](Bmxx80/README.md) * [BMxx80 Device Family](Bmxx80/README.md)
* [Cpu Temperature](CpuTemperature/README.md) * [Cpu Temperature](CpuTemperature/README.md)
...@@ -59,11 +67,15 @@ Our vision: the majority of .NET bindings are written completely in .NET languag ...@@ -59,11 +67,15 @@ Our vision: the majority of .NET bindings are written completely in .NET languag
* [HTS221 - Capacitive digital sensor for relative humidity and temperature](Hts221/README.md) * [HTS221 - Capacitive digital sensor for relative humidity and temperature](Hts221/README.md)
* [LM75 - Digital Temperature Sensor](Lm75/README.md) * [LM75 - Digital Temperature Sensor](Lm75/README.md)
* [LPS25H - Piezoresistive pressure and thermometer sensor](Lps25h/README.md) * [LPS25H - Piezoresistive pressure and thermometer sensor](Lps25h/README.md)
* [MCP9808 - Digital Temperature Sensor](Mcp9808/README.md)
* [MLX90614 - Infra Red Thermometer](Mlx90614/README.md) * [MLX90614 - Infra Red Thermometer](Mlx90614/README.md)
* [MPU6500/MPU9250 - Gyroscope, Accelerometer, Temperature and Magnetometer (MPU9250 only)](Mpu9250/README.md) * [MPU6500/MPU9250 - Gyroscope, Accelerometer, Temperature and Magnetometer (MPU9250 only)](Mpu9250/README.md)
* [OpenHardwareMonitor client library](HardwareMonitor/README.md)
* [Sense HAT](SenseHat/README.md) * [Sense HAT](SenseHat/README.md)
* [SHT3x - Temperature & Humidity Sensor](Sht3x/README.md) * [SHT3x - Temperature & Humidity Sensor](Sht3x/README.md)
* [SHTC3 - Temperature & Humidity Sensor](Shtc3/README.md)
* [Si7021 - Temperature & Humidity Sensor](Si7021/README.md) * [Si7021 - Temperature & Humidity Sensor](Si7021/README.md)
* [μFire ISE Probe - pH, ORP and temperature sensor](UFireIse/README.md)
### Gyroscopes ### Gyroscopes
...@@ -85,6 +97,7 @@ Our vision: the majority of .NET bindings are written completely in .NET languag ...@@ -85,6 +97,7 @@ Our vision: the majority of .NET bindings are written completely in .NET languag
* [28BYJ-48 Stepper Motor 5V 4-Phase 5-Wire & ULN2003 Driver Board](Uln2003/README.md) * [28BYJ-48 Stepper Motor 5V 4-Phase 5-Wire & ULN2003 Driver Board](Uln2003/README.md)
* [DC Motor Controller](DCMotor/README.md) * [DC Motor Controller](DCMotor/README.md)
* [Explorer HAT Pro (Pimoroni)](ExplorerHat/README.md)
* [MotorHat](MotorHat/README.md) * [MotorHat](MotorHat/README.md)
* [Servo Motor](ServoMotor/README.md) * [Servo Motor](ServoMotor/README.md)
...@@ -104,17 +117,15 @@ Our vision: the majority of .NET bindings are written completely in .NET languag ...@@ -104,17 +117,15 @@ Our vision: the majority of .NET bindings are written completely in .NET languag
* [MPU6500/MPU9250 - Gyroscope, Accelerometer, Temperature and Magnetometer (MPU9250 only)](Mpu9250/README.md) * [MPU6500/MPU9250 - Gyroscope, Accelerometer, Temperature and Magnetometer (MPU9250 only)](Mpu9250/README.md)
* [Sense HAT](SenseHat/README.md) * [Sense HAT](SenseHat/README.md)
### Liquid Crystal Displays
* [Character LCD (Liquid Crystal Display)](CharacterLcd/README.md)
### Hygrometers ### Hygrometers
* [AHT10/15/20 - Temperature and humidity sensor modules](Ahtxx/README.md)
* [BMxx80 Device Family](Bmxx80/README.md) * [BMxx80 Device Family](Bmxx80/README.md)
* [DHTxx - Digital-Output Relative Humidity & Temperature Sensor Module](Dhtxx/README.md) * [DHTxx - Digital-Output Relative Humidity & Temperature Sensor Module](Dhtxx/README.md)
* [HTS221 - Capacitive digital sensor for relative humidity and temperature](Hts221/README.md) * [HTS221 - Capacitive digital sensor for relative humidity and temperature](Hts221/README.md)
* [Sense HAT](SenseHat/README.md) * [Sense HAT](SenseHat/README.md)
* [SHT3x - Temperature & Humidity Sensor](Sht3x/README.md) * [SHT3x - Temperature & Humidity Sensor](Sht3x/README.md)
* [SHTC3 - Temperature & Humidity Sensor](Shtc3/README.md)
* [Si7021 - Temperature & Humidity Sensor](Si7021/README.md) * [Si7021 - Temperature & Humidity Sensor](Si7021/README.md)
### Clocks ### Clocks
...@@ -141,6 +152,8 @@ Our vision: the majority of .NET bindings are written completely in .NET languag ...@@ -141,6 +152,8 @@ Our vision: the majority of .NET bindings are written completely in .NET languag
### Displays ### Displays
* [Adafruit Seesaw - extension board (ADC, PWM, GPIO expander)](Seesaw/README.md) * [Adafruit Seesaw - extension board (ADC, PWM, GPIO expander)](Seesaw/README.md)
* [APA102 - Double line transmission integrated control LED](Apa102/README.md)
* [Character LCD (Liquid Crystal Display)](CharacterLcd/README.md)
* [Max7219 (LED Matrix driver)](Max7219/README.md) * [Max7219 (LED Matrix driver)](Max7219/README.md)
* [RGBLedMatrix - RGB LED Matrix](RGBLedMatrix/README.md) * [RGBLedMatrix - RGB LED Matrix](RGBLedMatrix/README.md)
* [Segment display driver (HT16K33)](Display/README.md) * [Segment display driver (HT16K33)](Display/README.md)
...@@ -188,30 +201,42 @@ Our vision: the majority of .NET bindings are written completely in .NET languag ...@@ -188,30 +201,42 @@ Our vision: the majority of .NET bindings are written completely in .NET languag
### LED drivers ### LED drivers
* [Adafruit Seesaw - extension board (ADC, PWM, GPIO expander)](Seesaw/README.md) * [Adafruit Seesaw - extension board (ADC, PWM, GPIO expander)](Seesaw/README.md)
* [APA102 - Double line transmission integrated control LED](Apa102/README.md)
* [Explorer HAT Pro (Pimoroni)](ExplorerHat/README.md)
* [On-board LED driver](BoardLed/README.md) * [On-board LED driver](BoardLed/README.md)
* [Segment display driver (HT16K33)](Display/README.md) * [Segment display driver (HT16K33)](Display/README.md)
* [Ws28xx LED drivers](Ws28xx/README.md) * [Ws28xx LED drivers](Ws28xx/README.md)
### Shift registers
* [ShiftRegister -- generic shift register](ShiftRegister/README.md)
* [SN74HC595 -- 8 bit shift register](Sn75hc595/README.md)
* [Mbi5027 -- 16-bit shift register](Mbi5027/README.md)
### RFID/NFC modules ### RFID/NFC modules
* [PN5180 - RFID and NFC reader](Pn5180/README.md)
* [PN532 - RFID and NFC reader](Pn532/README.md) * [PN532 - RFID and NFC reader](Pn532/README.md)
* [RFID shared elements](Card/README.md) * [RFID shared elements](Card/README.md)
### Media libraries ### Media libraries
* [Buzzer - Piezo Buzzer Controller](Buzzer/README.md)
* [Still image recording library](Media/README.md) * [Still image recording library](Media/README.md)
### USB devices ### USB devices
* [SPI, GPIO and I2C drivers for FT4222](Ft4222/README.md) * [SPI, GPIO and I2C drivers for FT4222](Ft4222/README.md)
### GPIO or bit operating devices
* [Charlieplex Segment binding](Charlieplex/README.md)
* [Digital liquid level switch](LiquidLevel/README.md)
* [Generic shift register](ShiftRegister/README.md)
* [MBI5027 -- 16-bit shift register with error detection](Mbi5027/README.md)
* [Quadrature Rotary Encoder](RotaryEncoder/README.md)
* [SN74HC595 -- 8-bit shift register](Sn74hc595/README.md)
### Multi-device or robot kit
* [GoPiGo3](GoPiGo3/README.md)
* [GrovePi](GrovePi/README.md)
* [Sense HAT](SenseHat/README.md)
### Protocols providers/libraries ### Protocols providers/libraries
* [1-wire](OneWire/README.md) * [1-wire](OneWire/README.md)
......
...@@ -19,18 +19,15 @@ This binding implements scaled quadrature rotary encoder as `ScaledQuadratureEnc ...@@ -19,18 +19,15 @@ This binding implements scaled quadrature rotary encoder as `ScaledQuadratureEnc
The code below shows an example of using the encoder as an FM tuner control. The code below shows an example of using the encoder as an FM tuner control.
```csharp ```csharp
using (GpioController controller = new GpioController()) // create a RotaryEncoder that represents an FM Radio tuning dial with a range of 88 -> 108 MHz
ScaledQuadratureEncoder encoder = new ScaledQuadratureEncoder(pinA: 5, pinB: 6, PinEventTypes.Falling, pulsesPerRotation: 20, pulseIncrement: 0.1, rangeMin: 88.0, rangeMax: 108.0) { Value = 88 };
// 2 milliseconds debonce time
encoder.Debounce = TimeSpan.FromMilliseconds(2);
// Register to Value change events
encoder.ValueChanged += (o, e) =>
{ {
// create a RotaryEncoder that represents an FM Radio tuning dial with a range of 88 -> 108 MHz Console.WriteLine($"Tuned to {e.Value}MHz");
ScaledQuadratureEncoder encoder = new ScaledQuadratureEncoder(new GpioController(), pinA: 5, pinB: 6, PinEventTypes.Falling, pulsesPerRotation: 20 , pulseIncrement: 0.1, rangeMin: 88.0, rangeMax: 108.0) { Value = 88 }; };
encoder.ValueChanged += (o, e) =>
{
Console.WriteLine($"Value {e.Value}");
};
// Do Other Stuff
}
``` ```
This binding also features This binding also features
...@@ -47,4 +44,4 @@ This binding is suitable for manual and small rotations where it is not a big de ...@@ -47,4 +44,4 @@ This binding is suitable for manual and small rotations where it is not a big de
This binding **is not** suitable for motor control with a very high rate and very precise number of counts. This binding **is not** suitable for motor control with a very high rate and very precise number of counts.
The precision really depends of the hardware you are using and it is not possible to give specific range of usage. You may have to try to understand if this is working for you or not. The precision really depends of the hardware you are using and it is not possible to give specific range of usage. You may have to try to understand if this is working for you or not.
\ No newline at end of file
...@@ -6,20 +6,17 @@ using System.Device.Gpio; ...@@ -6,20 +6,17 @@ using System.Device.Gpio;
using Iot.Device.RotaryEncoder; using Iot.Device.RotaryEncoder;
Console.WriteLine("Tune your radio station with RotaryEncoder and press a key to exit"); Console.WriteLine("Tune your radio station with RotaryEncoder and press a key to exit");
using (GpioController controller = new GpioController()) // create a RotaryEncoder that represents an FM Radio tuning dial with a range of 88 -> 108 MHz
ScaledQuadratureEncoder encoder = new ScaledQuadratureEncoder(pinA: 5, pinB: 6, PinEventTypes.Falling, pulsesPerRotation: 20, pulseIncrement: 0.1, rangeMin: 88.0, rangeMax: 108.0) { Value = 88 };
// 2 milliseconds debonce time
encoder.Debounce = TimeSpan.FromMilliseconds(2);
// Register to Value change events
encoder.ValueChanged += (o, e) =>
{ {
// create a RotaryEncoder that represents an FM Radio tuning dial with a range of 88 -> 108 MHz Console.WriteLine($"Tuned to {e.Value}MHz");
ScaledQuadratureEncoder encoder = new ScaledQuadratureEncoder(pinA: 5, pinB: 6, PinEventTypes.Falling, pulsesPerRotation: 20, pulseIncrement: 0.1, rangeMin: 88.0, rangeMax: 108.0) { Value = 88 }; };
// 2 milliseconds debonce time
encoder.Debounce = TimeSpan.FromMilliseconds(2);
// Register to Value change events
encoder.ValueChanged += (o, e) =>
{
Console.WriteLine($"Tuned to {e.Value}MHz");
};
while (!Console.KeyAvailable) while (!Console.KeyAvailable)
{ {
System.Threading.Tasks.Task.Delay(100).Wait(); System.Threading.Tasks.Task.Delay(100).Wait();
}
} }
...@@ -7,3 +7,4 @@ gyroscope ...@@ -7,3 +7,4 @@ gyroscope
accelerometer accelerometer
joystick joystick
display display
multi
multiplexer multiplexer
\ No newline at end of file gpio
multiplexer multiplexer
\ No newline at end of file gpio
# μFire ISE Probe Interface - I2C Driver # μFire ISE Probe - pH, ORP and temperature sensor
## Summary ## Summary
......
// Licensed to the .NET Foundation under one or more agreements. // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license. // The .NET Foundation licenses this file to you under the MIT license.
using System; using System;
...@@ -14,13 +14,17 @@ namespace Iot.Tools.DeviceListing ...@@ -14,13 +14,17 @@ namespace Iot.Tools.DeviceListing
public string Title { get; private set; } public string Title { get; private set; }
public string ReadmePath { get; private set; } public string ReadmePath { get; private set; }
public HashSet<string> Categories { get; private set; } = new HashSet<string>(); public HashSet<string> Categories { get; private set; } = new HashSet<string>();
public string CategoriesFilePath { get; private set; }
public bool CategoriesFileExists { get; private set; }
public DeviceInfo(string readmePath, string categoriesFilePath) public DeviceInfo(string readmePath, string categoriesFilePath)
{ {
ReadmePath = readmePath; ReadmePath = readmePath;
Title = GetTitle(readmePath) ?? "Error"; Title = GetTitle(readmePath) ?? "Error";
CategoriesFilePath = categoriesFilePath;
CategoriesFileExists = File.Exists(categoriesFilePath);
ImportCategories(categoriesFilePath); ImportCategories();
} }
public int CompareTo(DeviceInfo? other) public int CompareTo(DeviceInfo? other)
...@@ -28,15 +32,15 @@ namespace Iot.Tools.DeviceListing ...@@ -28,15 +32,15 @@ namespace Iot.Tools.DeviceListing
return Title.CompareTo(other?.Title); return Title.CompareTo(other?.Title);
} }
private void ImportCategories(string categoriesFilePath) private void ImportCategories()
{ {
if (!File.Exists(categoriesFilePath)) if (!CategoriesFileExists)
{ {
Console.WriteLine($"Warning: {categoriesFilePath} is missing"); Console.WriteLine($"Warning: Category file is missing. [{CategoriesFilePath}]");
return; return;
} }
foreach (string line in File.ReadAllLines(categoriesFilePath)) foreach (string line in File.ReadAllLines(CategoriesFilePath))
{ {
if (line is not { Length: > 0 }) if (line is not { Length: > 0 })
{ {
...@@ -45,7 +49,7 @@ namespace Iot.Tools.DeviceListing ...@@ -45,7 +49,7 @@ namespace Iot.Tools.DeviceListing
if (!Categories.Add(line)) if (!Categories.Add(line))
{ {
Console.WriteLine($"Warning: Category `{line}` is duplicated in `{categoriesFilePath}`"); Console.WriteLine($"Warning: Category `{line}` is duplicated in `{CategoriesFilePath}`");
} }
} }
} }
......
...@@ -14,6 +14,7 @@ string[] categoriesToDisplay = new string[] ...@@ -14,6 +14,7 @@ string[] categoriesToDisplay = new string[]
"adc", "adc",
"accelerometer", "accelerometer",
"gas", "gas",
"liquid",
"light", "light",
"barometer", "barometer",
"altimeter", "altimeter",
...@@ -24,7 +25,6 @@ string[] categoriesToDisplay = new string[] ...@@ -24,7 +25,6 @@ string[] categoriesToDisplay = new string[]
"motor", "motor",
"imu", "imu",
"magnetometer", "magnetometer",
"lcd",
"hygrometer", "hygrometer",
"clock", "clock",
"sonar", "sonar",
...@@ -43,7 +43,9 @@ string[] categoriesToDisplay = new string[] ...@@ -43,7 +43,9 @@ string[] categoriesToDisplay = new string[]
"nfc", "nfc",
"media", "media",
"usb", "usb",
"protocol" "gpio",
"multi",
"protocol",
}; };
Dictionary<string, string?> categoriesDescriptions = new() Dictionary<string, string?> categoriesDescriptions = new()
...@@ -52,6 +54,7 @@ Dictionary<string, string?> categoriesDescriptions = new() ...@@ -52,6 +54,7 @@ Dictionary<string, string?> categoriesDescriptions = new()
{ "accelerometer", "Accelerometers" }, { "accelerometer", "Accelerometers" },
{ "voc", "Volatile Organic Compound sensors" }, { "voc", "Volatile Organic Compound sensors" },
{ "gas", "Gas sensors" }, { "gas", "Gas sensors" },
{ "liquid", "Liquid sensors" },
{ "light", "Light sensor" }, { "light", "Light sensor" },
{ "barometer", "Barometers" }, { "barometer", "Barometers" },
{ "altimeter", "Altimeters" }, { "altimeter", "Altimeters" },
...@@ -86,6 +89,8 @@ Dictionary<string, string?> categoriesDescriptions = new() ...@@ -86,6 +89,8 @@ Dictionary<string, string?> categoriesDescriptions = new()
{ "nfc", "RFID/NFC modules" }, { "nfc", "RFID/NFC modules" },
{ "media", "Media libraries" }, { "media", "Media libraries" },
{ "usb", "USB devices" }, { "usb", "USB devices" },
{ "gpio", "GPIO or bit operating devices" },
{ "multi", "Multi-device or robot kit" },
// Bucket for stuff we want mentioned but there is no clear category // Bucket for stuff we want mentioned but there is no clear category
// In other words: anything allowing a way to create PWM channel, SPI/I2C/... device // In other words: anything allowing a way to create PWM channel, SPI/I2C/... device
{ "protocol", "Protocols providers/libraries" }, { "protocol", "Protocols providers/libraries" },
...@@ -95,6 +100,7 @@ Dictionary<string, string?> categoriesDescriptions = new() ...@@ -95,6 +100,7 @@ Dictionary<string, string?> categoriesDescriptions = new()
{ "gopigo3", null }, { "gopigo3", null },
{ "grovepi", null }, { "grovepi", null },
{ "i2c", null }, { "i2c", null },
{ "multiplexer", null },
}; };
HashSet<string> ignoredDeviceDirectories = new() HashSet<string> ignoredDeviceDirectories = new()
...@@ -132,7 +138,7 @@ foreach (string directory in Directory.EnumerateDirectories(devicesPath)) ...@@ -132,7 +138,7 @@ foreach (string directory in Directory.EnumerateDirectories(devicesPath))
if (device.Title == null) if (device.Title == null)
{ {
Console.WriteLine($"Warning: Directory `{directory}` contains readme file without title on the first line."); Console.WriteLine($"Warning: Device directory contains readme file without title on the first line. [{directory}]");
continue; continue;
} }
...@@ -140,7 +146,7 @@ foreach (string directory in Directory.EnumerateDirectories(devicesPath)) ...@@ -140,7 +146,7 @@ foreach (string directory in Directory.EnumerateDirectories(devicesPath))
} }
else else
{ {
Console.WriteLine($"Warning: Directory `{directory}` does not have a README.md file."); Console.WriteLine($"Warning: Device directory does not have a README.md file. [{directory}]");
} }
} }
...@@ -150,15 +156,24 @@ var allCategories = new HashSet<string>(); ...@@ -150,15 +156,24 @@ var allCategories = new HashSet<string>();
foreach (DeviceInfo device in devices) foreach (DeviceInfo device in devices)
{ {
bool beingDisplayed = false;
foreach (string category in device.Categories) foreach (string category in device.Categories)
{ {
if (allCategories.Add(category)) if (allCategories.Add(category))
{ {
if (!categoriesDescriptions.ContainsKey(category)) if (!categoriesDescriptions.ContainsKey(category))
{ {
Console.WriteLine($"Warning: Category `{category}` is missing description (`{device.Title}`)."); Console.WriteLine($"Warning: Category `{category}` is missing description (`{device.Title}`). [{device.ReadmePath}]");
} }
} }
beingDisplayed |= !beingDisplayed && categoriesToDisplay.Contains(category);
}
if (!beingDisplayed && device.CategoriesFileExists)
{
// We do not want to show the warning when file doesn't exist as you will get separate warning that category.txt is missing in that case.
Console.WriteLine($"Warning: Device `{device.Title}` is not being displayed under any category. [{device.CategoriesFilePath}]");
} }
} }
...@@ -186,11 +201,18 @@ string GetCategorizedDeviceListing(string devicesPath, IEnumerable<DeviceInfo> d ...@@ -186,11 +201,18 @@ string GetCategorizedDeviceListing(string devicesPath, IEnumerable<DeviceInfo> d
var deviceListing = new StringBuilder(); var deviceListing = new StringBuilder();
foreach (string categoryToDisplay in categoriesToDisplay) foreach (string categoryToDisplay in categoriesToDisplay)
{ {
deviceListing.AppendLine($"### {categoriesDescriptions[categoryToDisplay]}"); if (categoriesDescriptions.TryGetValue(categoryToDisplay, out string? categoryDescription))
deviceListing.AppendLine(); {
deviceListing.AppendLine($"### {categoryDescription}");
deviceListing.AppendLine();
string listingInCurrentCategory = GetDeviceListing(devicesPath, devices.Where((d) => d.Categories.Contains(categoryToDisplay))); string listingInCurrentCategory = GetDeviceListing(devicesPath, devices.Where((d) => d.Categories.Contains(categoryToDisplay)));
deviceListing.AppendLine(listingInCurrentCategory); deviceListing.AppendLine(listingInCurrentCategory);
}
else
{
Console.WriteLine($"Warning: Category `{categoryToDisplay}` should be displayed but is missing description.");
}
} }
return deviceListing.ToString(); return deviceListing.ToString();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册