KanoComputing / community-sdk

Scripts, tools and libraries to help you to interact with your Kano Devices in your favourite programming language.
MIT License
31 stars 11 forks source link

Filter connected devices by its type #5

Open murilopolese opened 5 years ago

murilopolese commented 5 years ago

Instead of filtering out all the available/connected devices every time it would be good to have a method that returns all the devices of a specific type and get the first available device from a type.

Something like:

// List all available motion sensors
DeviceManager.listMotionSensors()
.then((devices) => {
  console.log(devices.lenght, 'motion sensors were found')
});
// Get first available motion sensor
DeviceManager.getMotionSensor()
.then((msk) => {
  console.log('motion sensor found');
});
# List all available motion sensors
devices = list_motion_sensors()
#  Get first available motion sensor
msk = get_motion_sensor()