当前位置: 首页>>代码示例>>C++>>正文


C++ Core::GetCurrentMMTime方法代码示例

本文整理汇总了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;
}
开发者ID:jefferis,项目名称:micromanager12extras,代码行数:27,代码来源:ASIFW1000Hub.cpp

示例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;
}
开发者ID:ckc7,项目名称:micromanager2,代码行数:40,代码来源:ASIFW1000Hub.cpp


注:本文中的mm::Core::GetCurrentMMTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。