diff --git a/src/devices/Ahtxx/README.md b/src/devices/Ahtxx/README.md index 680cfdba2d145ac942ee69b64aa23147cf0e52a0..0e600443af8bc71be53fabb514b7268c8a69e1c0 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 5f95b0d2d0e0ca773f7217ebb4f829ab451c76e1..f10336fe5fc3c78f26e1ca79b9d1b60bca0e790e 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 3cf230d5177f4666d8e74791ab257fece3c01d91..cce08f5b583625bc48bfe74e8e93e3985bf5fa9b 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 a6dab90ddd2e2f71d5d3e705435e2ef05f4f92a4..52ee17aada9ebfd3f3f1e151d94294a2b62f09eb 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 0000000000000000000000000000000000000000..5cf66800443b85c75645255e1503eb42a3dd7a91 --- /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 64b8ef72d67899132732546b1a4fefb58866e0d4..b58cf6bf236ec752f34a101734a4154b52ae3a3f 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 acf23eb8799d54eea89822217ee87b6ed900cee9..2370a076fda84c7d2bb70eed21ae9ddb807ca292 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 f5857d749f6390e4a4594bc2a685677f8370c38f..69312b0be38b46402912108997a5327f576e0d05 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 f92b2b66664acb081e74a8b0ac6c312f9ec037a3..1aff269de1b3883d2045e8514345cec5279efc54 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 f62a714883773a5e6cd4232e76ebf29ff13af8a4..c85c17a8e7067562f539085f7a4b62d9a3c3236e 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 17a53d88bb99056d5511a6a33c57e547d2a03622..69cc4ad8559dca409dcab66e3a171015a77b623f 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 0000000000000000000000000000000000000000..9d5a85150c41fb9e8eb4138d4c61e59c60aa12d5 --- /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 acf23eb8799d54eea89822217ee87b6ed900cee9..2370a076fda84c7d2bb70eed21ae9ddb807ca292 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 0000000000000000000000000000000000000000..2e33a8eecfafe8749af02cada2f7b6b4e4b6c423 --- /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 45830e1c31b2b1d4500399465681ead7a2b7f3c2..d202d2d04d45a646ce1886c480f5997ac1d68aed 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 a5382fa6cb2163059ee7c311197d0f237a346686..d62a94b539b4b7371e54ab7e09132f7b9ebff74b 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 0000000000000000000000000000000000000000..6b5f9104c9229303b1ff1784b3eebb7af93a9677 --- /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 01689600acaa4acd418905f00b5fca0f476acced..04f489b0e788320ade3ec8c80f201437fdda7f8e 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 0000000000000000000000000000000000000000..6b5f9104c9229303b1ff1784b3eebb7af93a9677 --- /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 82797b9e15122dc1e558b484330fce6794de1fc9..61469cfa7148c69f80a43fcab15f8ea1a9a0eb84 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 acf23eb8799d54eea89822217ee87b6ed900cee9..2370a076fda84c7d2bb70eed21ae9ddb807ca292 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 acf23eb8799d54eea89822217ee87b6ed900cee9..2370a076fda84c7d2bb70eed21ae9ddb807ca292 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 e8f8aa9c01e04eba277c264d0e9ea127da1dae4a..fdd40f2451674402f87b3bf5eb9da823464e6948 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 0000000000000000000000000000000000000000..fc380ee77edcc93ac3eb99d5ec054f9dd67a4629 --- /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 42050820f86573889e6558e17d1ea0d92a3d215c..59c40e52a5329aa10b9645379353337b0574ceab 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 28d62d804578ea117091eaa2866d85239694bfdd..2f3b310294c6b259e2a7506850a5b77e0af8e27b 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();