Skip to content

Commit

Permalink
Add doWorkUntil()
Browse files Browse the repository at this point in the history
  • Loading branch information
matsujirushi committed Oct 2, 2024
1 parent 4357e93 commit 79693cd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/module/at_client/AtClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,30 @@ namespace wiocellular
}
}

/**
* @~Japanese
* @brief URC処理を実行(タイムアウトまで)
*
* @param [in] timeout タイムアウト時間[ミリ秒]。
*
* レスポンスを確認して、URC(unsolicited result code)の処理を実行します。
* 永久にURC待ちしたいときはtimeoutに-1を指定します。
* URCを受信しても、タイムアウト時間まで関数から返りません。
*/
void doWorkUntil(int timeout)
{
const auto start = millis();
while (true)
{
const auto elapsed = millis() - start;
if (elapsed >= static_cast<uint32_t>(timeout))
{
break;
}
doWork(timeout - elapsed);
}
}

/**
* @~Japanese
* @brief コマンド書き込みと待機
Expand Down

0 comments on commit 79693cd

Please sign in to comment.