| 198 | } |
| 199 | |
| 200 | bool logitech_device::is_valid() |
| 201 | { |
| 202 | bool is_connected = connected(); |
| 203 | bool valid_test = false; |
| 204 | |
| 205 | if(is_connected) |
| 206 | { |
| 207 | LOG_DEBUG("[%s] valid_test - type %i led_count - %i RGB_index - %i", device_name.c_str(), logitech_device_type, leds.size(), RGB_feature_index); |
| 208 | |
| 209 | valid_test = !device_name.empty() // Check if device name exists |
| 210 | && logitech_device_type <= 8 // Check if device type has a valid index |
| 211 | && (device_name[0] >= 32 && device_name[0] < 122) // Check for non valid characters in device name |
| 212 | && device_name.length() > 3 // Check for valid device names lenght |
| 213 | && leds.size() > 0 // Check if a device has at least 1 led |
| 214 | && RGB_feature_index > 0; // Check if a feature index is "valid" |
| 215 | } |
| 216 | else |
| 217 | { |
| 218 | LOG_INFO("Unable add this Logitech device: Not Connected"); |
| 219 | } |
| 220 | |
| 221 | return valid_test; |
| 222 | } |
| 223 | |
| 224 | bool logitech_device::connected() |
| 225 | { |
no test coverage detected