From ed40f0338bf3fc4eb34be65b560ec2846e809d74 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Mon, 21 Jan 2013 21:36:37 +0000 Subject: [PATCH] Fixed initial Kickr connection issues It was because the connector was still searching when asked it to connect to a sensor. We now cancel any search before attempting to connect. But sadly, the connection is dropped and a bunch of error messages popup about firmware. --- src/Kickr.cpp | 4 ---- src/WFApi.mm | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Kickr.cpp b/src/Kickr.cpp index d5a006ec7..16519563d 100644 --- a/src/Kickr.cpp +++ b/src/Kickr.cpp @@ -178,11 +178,9 @@ Kickr::find() int Kickr::connectKickr() { -qDebug()<<"connect"; // discover first... if (scanned == false) find(); -qDebug()<<"did we find?"<portSpec; // connect bool found = false; WFApi *w = WFApi::getInstance(); @@ -195,9 +193,7 @@ qDebug()<<"did we find?"<portSpec; } if (found == false) return -1; -qDebug()<<"found, so call connect"<connectDevice(i); - return 0; } diff --git a/src/WFApi.mm b/src/WFApi.mm index 88c5fff99..750838178 100644 --- a/src/WFApi.mm +++ b/src/WFApi.mm @@ -119,6 +119,8 @@ static QString toQString(const NSString *nsstr) -(BOOL)connectDevice: (int)n { //NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; + // just in case there is a discovery in action, lets cancel it... + [[WFHardwareConnector sharedConnector] cancelDiscoveryOnNetwork:WF_NETWORKTYPE_BTLE]; WFDeviceParams* dev = (WFDeviceParams*)[discoveredSensors objectAtIndex:n]; WFConnectionParams* params = [[WFConnectionParams alloc] init];