The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE examples.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. The code included in this file is provided under the terms of the ISC license
  6. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  7. To use, copy, modify, and/or distribute this software for any purpose with or
  8. without fee is hereby granted provided that the above copyright notice and
  9. this permission notice appear in all copies.
  10. THE SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES,
  11. WHETHER EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR
  12. PURPOSE, ARE DISCLAIMED.
  13. ==============================================================================
  14. */
  15. #include "BlockFinder.h"
  16. using namespace juce;
  17. BlockFinder::BlockFinder()
  18. {
  19. // Register to receive topologyChanged() callbacks from pts.
  20. pts.addListener (this);
  21. }
  22. void BlockFinder::topologyChanged()
  23. {
  24. // We have a new topology, so find out what it isand store it in a local
  25. // variable.
  26. auto currentTopology = pts.getCurrentTopology();
  27. Logger::writeToLog ("\nNew BLOCKS topology.");
  28. // The blocks member of a BlockTopology contains an array of blocks. Here we
  29. // loop over them and print some information.
  30. Logger::writeToLog ("Detected " + String (currentTopology.blocks.size()) + " blocks:");
  31. for (auto& block : currentTopology.blocks)
  32. {
  33. Logger::writeToLog ("");
  34. Logger::writeToLog (" Description: " + block->getDeviceDescription());
  35. Logger::writeToLog (" Battery level: " + String (block->getBatteryLevel()));
  36. Logger::writeToLog (" UID: " + String (block->uid));
  37. Logger::writeToLog (" Serial number: " + block->serialNumber);
  38. }
  39. }