Bläddra i källkod

Allow friendly names in DATAQ SDK device initialization

Neal Wilson 11 år sedan
förälder
incheckning
d941dda5fa
1 ändrade filer med 12 tillägg och 2 borttagningar
  1. 12
    2
      src/dataqsdk.w

+ 12
- 2
src/dataqsdk.w Visa fil

@@ -495,7 +495,17 @@ DataqSdkDevice::DataqSdkDevice(QString device) : imp(new DataqSdkDeviceImplement
495 495
 	}
496 496
 	int rstart = finalizedPort.indexOf("COM");
497 497
 	finalizedPort.remove(0, rstart + 3);
498
-	if(finalizedPort.toInt() < 10)
498
+	bool chopFinished = false;
499
+	int finalizedPortNumber;
500
+	while(finalizedPort.size() > 0 && !chopFinished)
501
+	{
502
+		finalizedPortNumber = finalizedPort.toInt(&chopFinished);
503
+		if(!chopFinished)
504
+		{
505
+			finalizedPort.chop(1);
506
+		}
507
+	}
508
+	if(finalizedPortNumber < 10)
499 509
 	{
500 510
 		imp->device = QString("DI10%1NT.DLL").arg(finalizedPort);
501 511
 	}
@@ -504,7 +514,7 @@ DataqSdkDevice::DataqSdkDevice(QString device) : imp(new DataqSdkDeviceImplement
504 514
 		imp->device = QString("DI1%1NT.DLL").arg(finalizedPort);
505 515
 	}
506 516
 	imp->deviceNumber = 0x12C02D00;
507
-	imp->deviceNumber += finalizedPort.toInt();
517
+	imp->deviceNumber += finalizedPortNumber;
508 518
 	imp->ready = true;
509 519
 }
510 520
 

Laddar…
Avbryt
Spara