My program is successfully recognizing the connected block (block finder is printing out its info), but when I touch the LightPad Block (and touchChanged is called), I get a bad access code on the last line of:
/** Calls a member function on each listener in the list, with 2 parameters. */
template <LL_TEMPLATE(1), LL_TEMPLATE(2)>
void call (void (ListenerClass::*callbackFunction) (P1, P2),
LL_PARAM(1), LL_PARAM(2)) {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next()
(iter.getListener()->*callbackFunction) (param1, param2); } // ERROR ON THIS LINE
The related code in my program is a new class, roliBlockHelper, (which is just a copy of what’s given here: http://developer.roli.com/documentation/getting_touch_events.html), BlockFinder.h and BlockFinder.cpp, and a couple lines in main. Here’s roliBlockHelper:
class roliBlockHelper : public TouchSurface::Listener {
public:
roliBlockHelper (Block* block){
if (auto touchSurface = block->getTouchSurface())
touchSurface->addListener (this); }
virtual void touchChanged (TouchSurface& sourceTouchSurface, const TouchSurface::Touch& touchEvent) override {
} };
I’ve also added a line to the last for loop in BlockFinder.cpp:
for (auto& block : currentTopology.blocks) {
roliBlockHelper rbh(block); // LINE I ADDED
Logger::writeToLog ("");
Logger::writeToLog (String(" Description: ") + block->getDeviceDescription());
Logger::writeToLog (String(" Battery level: ") + String (block->getBatteryLevel()));
Logger::writeToLog (String(" UID: ") + String (block->uid));
Logger::writeToLog (String(" Serial number: ") + block->serialNumber); }
And in main, before my main loop, I just have:
ScopedJuceInitialiser_GUI platform;
BlockFinder bf;
By the way, BlockFinder is printing out the following info about my block:
New BLOCKS topology.
Detected 1 blocks:
Description: Pad BLOCK (2x2)
Battery level: 0.548387
UID: ..
Serial number: ..