本文整理汇总了C++中mm::Core::GetCurrentMMTime方法的典型用法代码示例。如果您正苦于以下问题:C++ Core::GetCurrentMMTime方法的具体用法?C++ Core::GetCurrentMMTime怎么用?C++ Core::GetCurrentMMTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mm::Core
的用法示例。
在下文中一共展示了Core::GetCurrentMMTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClearAllRcvBuf
int ASIFW1000Hub::FilterWheelBusy(MM::Device& device, MM::Core& core, bool& busy)
{
ClearAllRcvBuf(device, core);
int ret = core.SetSerialCommand(&device, port_.c_str(), "?", "");
if (ret != DEVICE_OK)
return ret;
unsigned long read = 0;
MM::MMTime startTime = core.GetCurrentMMTime();
while (read == 0 && ( (core.GetCurrentMMTime() - startTime) < 10000))
ret = core.ReadFromSerial(&device, port_.c_str(), (unsigned char*)rcvBuf_, 1, read);
if (ret != DEVICE_OK)
return ret;
if (read != 1) {
printf (" FilterWheel received no answer!\n");
return ERR_NO_ANSWER;
}
if (rcvBuf_[0] == '0' || rcvBuf_[0] == '1' || rcvBuf_[0] =='2')
busy = false;
else
if (rcvBuf_[0] == '3')
busy = true;
return DEVICE_OK;
}
示例2: timerOut
int ASIFW1000Hub::FilterWheelBusy(MM::Device& device, MM::Core& core, bool& busy)
{
busy = false;
ClearAllRcvBuf(device, core);
int ret = core.SetSerialCommand(&device, port_.c_str(), "?", "");
if (ret != DEVICE_OK) {
std::ostringstream os;
os << "ERROR: SetSerialCommand returned error code: " << ret;
core.LogMessage(&device, os.str().c_str(), false);
return ret;
}
unsigned long read = 0;
MM::TimeoutMs timerOut(core.GetCurrentMMTime(), 200 );
while (read == 0 && ( !timerOut.expired(core.GetCurrentMMTime()) ) )
{
ret = core.ReadFromSerial(&device, port_.c_str(), (unsigned char*)rcvBuf_, 1, read);
}
if (ret != DEVICE_OK) {
std::ostringstream os;
os << "ERROR: ReadFromSerial returned error code: " << ret;
core.LogMessage(&device, os.str().c_str(), false);
return ret;
}
if (read != 1) {
std::ostringstream os;
os << "ERROR: Read " << read << " characters instead of 1";
core.LogMessage(&device, os.str().c_str(), false);
return ERR_NO_ANSWER;
}
if (rcvBuf_[0] == '0' || rcvBuf_[0] == '1' || rcvBuf_[0] =='2')
busy = false;
else if (rcvBuf_[0] == '3')
busy = true;
return DEVICE_OK;
}