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.
This commit is contained in:
Mark Liversedge
2013-01-21 21:36:37 +00:00
parent 82f8c7f3d3
commit ed40f0338b
2 changed files with 2 additions and 4 deletions

View File

@@ -178,11 +178,9 @@ Kickr::find()
int
Kickr::connectKickr()
{
qDebug()<<"connect";
// discover first...
if (scanned == false) find();
qDebug()<<"did we find?"<<devConf->portSpec;
// connect
bool found = false;
WFApi *w = WFApi::getInstance();
@@ -195,9 +193,7 @@ qDebug()<<"did we find?"<<devConf->portSpec;
}
if (found == false) return -1;
qDebug()<<"found, so call connect"<<i;
w->connectDevice(i);
return 0;
}

View File

@@ -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];