From 32ce21200c07cbc88fdd563e4e17ab542f844552 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Sat, 21 Nov 2020 17:43:44 +0100 Subject: [PATCH] Update device listing (#1300) --- src/devices/Ahtxx/README.md | 2 +- src/devices/Ahtxx/category.txt | 4 +- src/devices/Apa102/README.md | 2 +- src/devices/Buzzer/category.txt | 1 + src/devices/Ccs811/category.txt | 2 + src/devices/CharacterLcd/category.txt | 1 + src/devices/Charlieplex/category.txt | 3 +- src/devices/Device-Index.md | 16 +++++++ src/devices/GoPiGo3/category.txt | 1 + src/devices/GrovePi/category.txt | 1 + src/devices/HardwareMonitor/README.md | 2 +- src/devices/LiquidLevel/category.txt | 2 + src/devices/Mbi5027/category.txt | 3 +- src/devices/Mhz19b/category.txt | 1 + src/devices/README.md | 47 ++++++++++++++----- src/devices/RotaryEncoder/README.md | 21 ++++----- src/devices/RotaryEncoder/category.txt | 1 + .../samples/RotaryEncoder.Sample.cs | 25 +++++----- .../RotaryEncoder/samples/category.txt | 1 + src/devices/SenseHat/category.txt | 1 + src/devices/ShiftRegister/category.txt | 3 +- src/devices/Sn74hc595/category.txt | 3 +- src/devices/UFireIse/README.md | 2 +- src/devices/UFireIse/category.txt | 2 + tools/device-listing/DeviceInfo.cs | 18 ++++--- tools/device-listing/Program.cs | 40 ++++++++++++---- 26 files changed, 142 insertions(+), 63 deletions(-) create mode 100644 src/devices/Ccs811/category.txt create mode 100644 src/devices/LiquidLevel/category.txt create mode 100644 src/devices/Mhz19b/category.txt create mode 100644 src/devices/RotaryEncoder/category.txt create mode 100644 src/devices/RotaryEncoder/samples/category.txt create mode 100644 src/devices/UFireIse/category.txt diff --git a/src/devices/Ahtxx/README.md b/src/devices/Ahtxx/README.md index 680cfdba..0e600443 100644 --- a/src/devices/Ahtxx/README.md +++ b/src/devices/Ahtxx/README.md @@ -1,4 +1,4 @@ -# AHT10/15/20 Temperature and Humidity Sensor Modules +# AHT10/15/20 - Temperature and humidity sensor modules ## Summary The AHT10/15 and AHT20 sensors are high-precision, calibrated temperature and relative humidity sensor modules with an I2C digital interface. diff --git a/src/devices/Ahtxx/category.txt b/src/devices/Ahtxx/category.txt index 5f95b0d2..f10336fe 100644 --- a/src/devices/Ahtxx/category.txt +++ b/src/devices/Ahtxx/category.txt @@ -1,2 +1,2 @@ -hygrometers -thermometers \ No newline at end of file +hygrometer +thermometer diff --git a/src/devices/Apa102/README.md b/src/devices/Apa102/README.md index 3cf230d5..cce08f5b 100644 --- a/src/devices/Apa102/README.md +++ b/src/devices/Apa102/README.md @@ -1,4 +1,4 @@ -# 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. diff --git a/src/devices/Buzzer/category.txt b/src/devices/Buzzer/category.txt index a6dab90d..52ee17aa 100644 --- a/src/devices/Buzzer/category.txt +++ b/src/devices/Buzzer/category.txt @@ -1 +1,2 @@ buzzer +media diff --git a/src/devices/Ccs811/category.txt b/src/devices/Ccs811/category.txt new file mode 100644 index 00000000..5cf66800 --- /dev/null +++ b/src/devices/Ccs811/category.txt @@ -0,0 +1,2 @@ +gas +voc diff --git a/src/devices/CharacterLcd/category.txt b/src/devices/CharacterLcd/category.txt index 64b8ef72..b58cf6bf 100644 --- a/src/devices/CharacterLcd/category.txt +++ b/src/devices/CharacterLcd/category.txt @@ -1,2 +1,3 @@ characterlcd lcd +display diff --git a/src/devices/Charlieplex/category.txt b/src/devices/Charlieplex/category.txt index acf23eb8..2370a076 100644 --- a/src/devices/Charlieplex/category.txt +++ b/src/devices/Charlieplex/category.txt @@ -1 +1,2 @@ -multiplexer \ No newline at end of file +multiplexer +gpio diff --git a/src/devices/Device-Index.md b/src/devices/Device-Index.md index f5857d74..69312b0b 100755 --- a/src/devices/Device-Index.md +++ b/src/devices/Device-Index.md @@ -8,7 +8,9 @@ * [ADS1115 - Analog to Digital Converter](Ads1115/README.md) * [ADXL345 - Accelerometer](Adxl345/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) +* [APA102 - Double line transmission integrated control LED](Apa102/README.md) * [Bh1745 - RGB Sensor](Bh1745/README.md) * [BH1750FVI - Ambient Light Sensor](Bh1750fvi/README.md) * [BMP180 - barometer, altitude and temperature sensor](Bmp180/README.md) @@ -16,10 +18,15 @@ * [BNO055 - inertial measurement unit](Bno055/README.md) * [BrickPi3](BrickPi3/README.md) * [Buzzer - Piezo Buzzer Controller](Buzzer/README.md) +* [CCS811 Gas sensor](Ccs811/README.md) * [Character LCD (Liquid Crystal Display)](CharacterLcd/README.md) +* [Charlieplex Segment binding](Charlieplex/README.md) * [Cpu Temperature](CpuTemperature/README.md) * [DC Motor Controller](DCMotor/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) * [GrovePi](GrovePi/README.md) * [HC-SR04 - Ultrasonic Ranging Module](Hcsr04/README.md) @@ -32,10 +39,13 @@ * [LSM9DS1 - 3D accelerometer, gyroscope and magnetometer](Lsm9Ds1/README.md) * [MAX44009 - Ambient Light Sensor](Max44009/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) * [Mcp25xxx device family - CAN bus](Mcp25xxx/README.md) * [Mcp3428 - Analog to Digital Converter (I2C)](Mcp3428/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) * [MotorHat](MotorHat/README.md) * [MPR121 - Proximity Capacitive Touch Sensor Controller](Mpr121/README.md) @@ -43,9 +53,12 @@ * [nRF24L01 - Single Chip 2.4 GHz Transceiver](Nrf24l01/README.md) * [NXP/TI PCx857x](Pcx857x/README.md) * [On-board LED driver](BoardLed/README.md) +* [OpenHardwareMonitor client library](HardwareMonitor/README.md) * [Pca95x4 - I2C GPIO Expander](Pca95x4/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) +* [Quadrature Rotary Encoder](RotaryEncoder/README.md) * [Radio Receiver](RadioReceiver/README.md) * [Radio Transmitter](RadioTransmitter/README.md) * [Realtime Clock](Rtc/README.md) @@ -55,7 +68,9 @@ * [Sense HAT](SenseHat/README.md) * [Servo Motor](ServoMotor/README.md) * [SHT3x - Temperature & Humidity Sensor](Sht3x/README.md) +* [SHTC3 - Temperature & Humidity Sensor](Shtc3/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) * [Software PWM](SoftPwm/README.md) * [Software SPI](SoftwareSpi/README.md) @@ -67,4 +82,5 @@ * [TM1637 - Segment Display](Tm1637/README.md) * [VL53L0X - distance sensor](Vl53L0X/README.md) * [Ws28xx LED drivers](Ws28xx/README.md) +* [μFire ISE Probe - pH, ORP and temperature sensor](UFireIse/README.md) diff --git a/src/devices/GoPiGo3/category.txt b/src/devices/GoPiGo3/category.txt index f92b2b66..1aff269d 100644 --- a/src/devices/GoPiGo3/category.txt +++ b/src/devices/GoPiGo3/category.txt @@ -1 +1,2 @@ gopigo3 +multi diff --git a/src/devices/GrovePi/category.txt b/src/devices/GrovePi/category.txt index f62a7148..c85c17a8 100644 --- a/src/devices/GrovePi/category.txt +++ b/src/devices/GrovePi/category.txt @@ -1 +1,2 @@ grovepi +multi diff --git a/src/devices/HardwareMonitor/README.md b/src/devices/HardwareMonitor/README.md index 17a53d88..69cc4ad8 100644 --- a/src/devices/HardwareMonitor/README.md +++ b/src/devices/HardwareMonitor/README.md @@ -1,4 +1,4 @@ -# OpenHardwareMonitor +# OpenHardwareMonitor client library Client binding for OpenHardwareMonitor. diff --git a/src/devices/LiquidLevel/category.txt b/src/devices/LiquidLevel/category.txt new file mode 100644 index 00000000..9d5a8515 --- /dev/null +++ b/src/devices/LiquidLevel/category.txt @@ -0,0 +1,2 @@ +liquid +gpio diff --git a/src/devices/Mbi5027/category.txt b/src/devices/Mbi5027/category.txt index acf23eb8..2370a076 100644 --- a/src/devices/Mbi5027/category.txt +++ b/src/devices/Mbi5027/category.txt @@ -1 +1,2 @@ -multiplexer \ No newline at end of file +multiplexer +gpio diff --git a/src/devices/Mhz19b/category.txt b/src/devices/Mhz19b/category.txt new file mode 100644 index 00000000..2e33a8ee --- /dev/null +++ b/src/devices/Mhz19b/category.txt @@ -0,0 +1 @@ +gas diff --git a/src/devices/README.md b/src/devices/README.md index 45830e1c..d202d2d0 100755 --- a/src/devices/README.md +++ b/src/devices/README.md @@ -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) * [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 @@ -52,6 +59,7 @@ Our vision: the majority of .NET bindings are written completely in .NET languag ### Thermometers +* [AHT10/15/20 - Temperature and humidity sensor modules](Ahtxx/README.md) * [BMP180 - barometer, altitude and temperature sensor](Bmp180/README.md) * [BMxx80 Device Family](Bmxx80/README.md) * [Cpu Temperature](CpuTemperature/README.md) @@ -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) * [LM75 - Digital Temperature Sensor](Lm75/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) * [MPU6500/MPU9250 - Gyroscope, Accelerometer, Temperature and Magnetometer (MPU9250 only)](Mpu9250/README.md) +* [OpenHardwareMonitor client library](HardwareMonitor/README.md) * [Sense HAT](SenseHat/README.md) * [SHT3x - Temperature & Humidity Sensor](Sht3x/README.md) +* [SHTC3 - Temperature & Humidity Sensor](Shtc3/README.md) * [Si7021 - Temperature & Humidity Sensor](Si7021/README.md) +* [μFire ISE Probe - pH, ORP and temperature sensor](UFireIse/README.md) ### Gyroscopes @@ -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) * [DC Motor Controller](DCMotor/README.md) +* [Explorer HAT Pro (Pimoroni)](ExplorerHat/README.md) * [MotorHat](MotorHat/README.md) * [Servo Motor](ServoMotor/README.md) @@ -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) * [Sense HAT](SenseHat/README.md) -### Liquid Crystal Displays - -* [Character LCD (Liquid Crystal Display)](CharacterLcd/README.md) - ### Hygrometers +* [AHT10/15/20 - Temperature and humidity sensor modules](Ahtxx/README.md) * [BMxx80 Device Family](Bmxx80/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) * [Sense HAT](SenseHat/README.md) * [SHT3x - Temperature & Humidity Sensor](Sht3x/README.md) +* [SHTC3 - Temperature & Humidity Sensor](Shtc3/README.md) * [Si7021 - Temperature & Humidity Sensor](Si7021/README.md) ### Clocks @@ -141,6 +152,8 @@ Our vision: the majority of .NET bindings are written completely in .NET languag ### Displays * [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) * [RGBLedMatrix - RGB LED Matrix](RGBLedMatrix/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 ### LED drivers * [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) * [Segment display driver (HT16K33)](Display/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 +* [PN5180 - RFID and NFC reader](Pn5180/README.md) * [PN532 - RFID and NFC reader](Pn532/README.md) * [RFID shared elements](Card/README.md) ### Media libraries +* [Buzzer - Piezo Buzzer Controller](Buzzer/README.md) * [Still image recording library](Media/README.md) ### USB devices * [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 * [1-wire](OneWire/README.md) diff --git a/src/devices/RotaryEncoder/README.md b/src/devices/RotaryEncoder/README.md index a5382fa6..d62a94b5 100644 --- a/src/devices/RotaryEncoder/README.md +++ b/src/devices/RotaryEncoder/README.md @@ -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. ```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 - 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 -} + Console.WriteLine($"Tuned to {e.Value}MHz"); +}; ``` This binding also features @@ -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. -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 +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. diff --git a/src/devices/RotaryEncoder/category.txt b/src/devices/RotaryEncoder/category.txt new file mode 100644 index 00000000..6b5f9104 --- /dev/null +++ b/src/devices/RotaryEncoder/category.txt @@ -0,0 +1 @@ +gpio diff --git a/src/devices/RotaryEncoder/samples/RotaryEncoder.Sample.cs b/src/devices/RotaryEncoder/samples/RotaryEncoder.Sample.cs index 01689600..04f489b0 100644 --- a/src/devices/RotaryEncoder/samples/RotaryEncoder.Sample.cs +++ b/src/devices/RotaryEncoder/samples/RotaryEncoder.Sample.cs @@ -6,20 +6,17 @@ using System.Device.Gpio; using Iot.Device.RotaryEncoder; 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 - 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"); - }; + Console.WriteLine($"Tuned to {e.Value}MHz"); +}; - while (!Console.KeyAvailable) - { - System.Threading.Tasks.Task.Delay(100).Wait(); - } +while (!Console.KeyAvailable) +{ + System.Threading.Tasks.Task.Delay(100).Wait(); } diff --git a/src/devices/RotaryEncoder/samples/category.txt b/src/devices/RotaryEncoder/samples/category.txt new file mode 100644 index 00000000..6b5f9104 --- /dev/null +++ b/src/devices/RotaryEncoder/samples/category.txt @@ -0,0 +1 @@ +gpio diff --git a/src/devices/SenseHat/category.txt b/src/devices/SenseHat/category.txt index 82797b9e..61469cfa 100644 --- a/src/devices/SenseHat/category.txt +++ b/src/devices/SenseHat/category.txt @@ -7,3 +7,4 @@ gyroscope accelerometer joystick display +multi diff --git a/src/devices/ShiftRegister/category.txt b/src/devices/ShiftRegister/category.txt index acf23eb8..2370a076 100644 --- a/src/devices/ShiftRegister/category.txt +++ b/src/devices/ShiftRegister/category.txt @@ -1 +1,2 @@ -multiplexer \ No newline at end of file +multiplexer +gpio diff --git a/src/devices/Sn74hc595/category.txt b/src/devices/Sn74hc595/category.txt index acf23eb8..2370a076 100644 --- a/src/devices/Sn74hc595/category.txt +++ b/src/devices/Sn74hc595/category.txt @@ -1 +1,2 @@ -multiplexer \ No newline at end of file +multiplexer +gpio diff --git a/src/devices/UFireIse/README.md b/src/devices/UFireIse/README.md index e8f8aa9c..fdd40f24 100644 --- a/src/devices/UFireIse/README.md +++ b/src/devices/UFireIse/README.md @@ -1,4 +1,4 @@ -# μFire ISE Probe Interface - I2C Driver +# μFire ISE Probe - pH, ORP and temperature sensor ## Summary diff --git a/src/devices/UFireIse/category.txt b/src/devices/UFireIse/category.txt new file mode 100644 index 00000000..fc380ee7 --- /dev/null +++ b/src/devices/UFireIse/category.txt @@ -0,0 +1,2 @@ +thermometer +liquid diff --git a/tools/device-listing/DeviceInfo.cs b/tools/device-listing/DeviceInfo.cs index 42050820..59c40e52 100644 --- a/tools/device-listing/DeviceInfo.cs +++ b/tools/device-listing/DeviceInfo.cs @@ -1,4 +1,4 @@ -// 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. using System; @@ -14,13 +14,17 @@ namespace Iot.Tools.DeviceListing public string Title { get; private set; } public string ReadmePath { get; private set; } public HashSet Categories { get; private set; } = new HashSet(); + public string CategoriesFilePath { get; private set; } + public bool CategoriesFileExists { get; private set; } public DeviceInfo(string readmePath, string categoriesFilePath) { ReadmePath = readmePath; Title = GetTitle(readmePath) ?? "Error"; + CategoriesFilePath = categoriesFilePath; + CategoriesFileExists = File.Exists(categoriesFilePath); - ImportCategories(categoriesFilePath); + ImportCategories(); } public int CompareTo(DeviceInfo? other) @@ -28,15 +32,15 @@ namespace Iot.Tools.DeviceListing 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; } - foreach (string line in File.ReadAllLines(categoriesFilePath)) + foreach (string line in File.ReadAllLines(CategoriesFilePath)) { if (line is not { Length: > 0 }) { @@ -45,7 +49,7 @@ namespace Iot.Tools.DeviceListing if (!Categories.Add(line)) { - Console.WriteLine($"Warning: Category `{line}` is duplicated in `{categoriesFilePath}`"); + Console.WriteLine($"Warning: Category `{line}` is duplicated in `{CategoriesFilePath}`"); } } } diff --git a/tools/device-listing/Program.cs b/tools/device-listing/Program.cs index 28d62d80..2f3b3102 100644 --- a/tools/device-listing/Program.cs +++ b/tools/device-listing/Program.cs @@ -14,6 +14,7 @@ string[] categoriesToDisplay = new string[] "adc", "accelerometer", "gas", + "liquid", "light", "barometer", "altimeter", @@ -24,7 +25,6 @@ string[] categoriesToDisplay = new string[] "motor", "imu", "magnetometer", - "lcd", "hygrometer", "clock", "sonar", @@ -43,7 +43,9 @@ string[] categoriesToDisplay = new string[] "nfc", "media", "usb", - "protocol" + "gpio", + "multi", + "protocol", }; Dictionary categoriesDescriptions = new() @@ -52,6 +54,7 @@ Dictionary categoriesDescriptions = new() { "accelerometer", "Accelerometers" }, { "voc", "Volatile Organic Compound sensors" }, { "gas", "Gas sensors" }, + { "liquid", "Liquid sensors" }, { "light", "Light sensor" }, { "barometer", "Barometers" }, { "altimeter", "Altimeters" }, @@ -86,6 +89,8 @@ Dictionary categoriesDescriptions = new() { "nfc", "RFID/NFC modules" }, { "media", "Media libraries" }, { "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 // In other words: anything allowing a way to create PWM channel, SPI/I2C/... device { "protocol", "Protocols providers/libraries" }, @@ -95,6 +100,7 @@ Dictionary categoriesDescriptions = new() { "gopigo3", null }, { "grovepi", null }, { "i2c", null }, + { "multiplexer", null }, }; HashSet ignoredDeviceDirectories = new() @@ -132,7 +138,7 @@ foreach (string directory in Directory.EnumerateDirectories(devicesPath)) 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; } @@ -140,7 +146,7 @@ foreach (string directory in Directory.EnumerateDirectories(devicesPath)) } 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(); foreach (DeviceInfo device in devices) { + bool beingDisplayed = false; foreach (string category in device.Categories) { if (allCategories.Add(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 d var deviceListing = new StringBuilder(); foreach (string categoryToDisplay in categoriesToDisplay) { - deviceListing.AppendLine($"### {categoriesDescriptions[categoryToDisplay]}"); - deviceListing.AppendLine(); + if (categoriesDescriptions.TryGetValue(categoryToDisplay, out string? categoryDescription)) + { + deviceListing.AppendLine($"### {categoryDescription}"); + deviceListing.AppendLine(); - string listingInCurrentCategory = GetDeviceListing(devicesPath, devices.Where((d) => d.Categories.Contains(categoryToDisplay))); - deviceListing.AppendLine(listingInCurrentCategory); + string listingInCurrentCategory = GetDeviceListing(devicesPath, devices.Where((d) => d.Categories.Contains(categoryToDisplay))); + deviceListing.AppendLine(listingInCurrentCategory); + } + else + { + Console.WriteLine($"Warning: Category `{categoryToDisplay}` should be displayed but is missing description."); + } } return deviceListing.ToString(); -- GitLab