@@ -175,14 +175,13 @@ connect(commManager.get(), &CommunicationManager::commandCompleted,
175175
176176``` cpp
177177// Execute command synchronously (blocks until complete)
178- CommandResult executeCommandSync (std::unique_ptr<CardCommand > cmd,
179- int timeoutMs = -1);
178+ CommandResult executeCommandSync (std::unique_ptr<CardCommand > cmd);
180179```
181180
182181**Example:**
183182```cpp
184183auto cmd = std::make_unique<VerifyPINCommand>("123456");
185- CommandResult result = commManager->executeCommandSync(std::move(cmd), 5000 );
184+ CommandResult result = commManager->executeCommandSync(std::move(cmd));
186185
187186if (result.success) {
188187 qDebug() << "PIN verified!";
@@ -637,10 +636,9 @@ QByteArray getData(uint8_t type);
637636QByteArray identify (const QByteArray& challenge = QByteArray());
638637
639638// Wait for card presence
640- bool waitForCard(int timeoutMs = -1 );
639+ bool waitForCard();
641640
642641// Set default wait timeout
643- void setDefaultWaitTimeout(int timeoutMs);
644642
645643// Get last error message
646644QString lastError() const;
@@ -1324,15 +1322,15 @@ commManager->startDetection();
13241322``` cpp
13251323// Verify PIN (blocks until complete, but thread-safe!)
13261324auto verifyCmd = std::make_unique<VerifyPINCommand>(" 123456" );
1327- CommandResult result = commManager->executeCommandSync (std::move(verifyCmd), 5000 );
1325+ CommandResult result = commManager->executeCommandSync (std::move(verifyCmd));
13281326
13291327if (result.success) {
13301328 qDebug() << "PIN verified!";
13311329
13321330 // Sign a transaction
13331331 QByteArray hash = /* 32-byte hash * /;
13341332 auto signCmd = std::make_unique<SignCommand >(hash, "m/44'/60'/0'/0/0");
1335- CommandResult signResult = commManager->executeCommandSync(std::move(signCmd), 30000 );
1333+ CommandResult signResult = commManager->executeCommandSync(std::move(signCmd));
13361334
13371335 if (signResult.success) {
13381336 QByteArray signature = signResult.data.toMap()[ "signature"] .toByteArray();
@@ -1398,7 +1396,7 @@ connect(commManager.get(), &CommunicationManager::cardInitialized,
13981396 if (!result.appInfo.initialized) {
13991397 // Initialize new card
14001398 auto initCmd = std::make_unique<InitCommand>("123456", "123456789012", "KeycardDefaultPairing");
1401- CommandResult initResult = commManager->executeCommandSync(std::move(initCmd), 60000 );
1399+ CommandResult initResult = commManager->executeCommandSync(std::move(initCmd));
14021400
14031401 if (!initResult.success) {
14041402 qWarning() << "Init failed:" << initResult.error;
@@ -1681,14 +1679,8 @@ constexpr uint8_t P1StoreDataCash = 0x02; // Cash data
16811679 }
16821680 ```
16831681
1684- 2 . ** Handle platform-specific timeouts:**
1685- ``` cpp
1686- #ifdef Q_OS_IOS
1687- cmdSet->setDefaultWaitTimeout(30000); // 30s for iOS
1688- #else
1689- cmdSet->setDefaultWaitTimeout(60000); // 60s for desktop
1690- #endif
1691- ```
1682+ 2 . ** Use event-driven card waiting:**
1683+ ` waitForCard() ` now waits for channel events (detect/error/detection-stopped) instead of a timeout.
16921684
16931685---
16941686
0 commit comments