예제 #1
0
// ON for deltaT milliseconds
// other implementations of Shutter don't implement this
// is this perhaps because this blocking call is not appropriate
int Cobolt::Fire(double deltaT)
{
	SetOpen(true);
	CDeviceUtils::SleepMs((long)(deltaT+.5));
	SetOpen(false);
    return DEVICE_OK;
}
예제 #2
0
// ON for deltaT milliseconds
// other implementations of Shutter don't implement this
// is this perhaps because this blocking call is not appropriate
int Sapphire::Fire(double deltaT)
{
	SetOpen(true);
	CDeviceUtils::SleepMs((long)(deltaT+.5));
	SetOpen(false);
   return HandleErrors();
}
예제 #3
0
파일: GiSTfile.cpp 프로젝트: hkaiser/TRiAS
void 
GiSTfile::CreateNew(const char *filename, bool fTruncateExisting)
{
  if (IsOpen())
    return;

  if (!fTruncateExisting) {
	fileHandle = open(filename, O_RDWR | O_BINARY);
	if (fileHandle >= 0) {
	  close(fileHandle);
	  return;
	}
  }
  fileHandle = open(filename,
					O_BINARY | O_RDWR | O_CREAT | O_TRUNC,
					S_IREAD | S_IWRITE);

  if (fileHandle < 0)
    return;

  SetOpen(1);

  /* Reserve page 0 */
  char *page = new char[PageSize()];
  memset(page, 0, PageSize());
  memcpy(page, magic, sizeof magic);
  write(fileHandle, page, PageSize());
  delete page;
}
예제 #4
0
파일: SSwitch.cpp 프로젝트: ming-hai/soui
void SSwitch::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags )
{
	if(nChar==VK_SPACE)
	{
		SetOpen(!m_BOpen);
	}
}
예제 #5
0
void
MTfile::Close()
{
	if(!IsOpen()) return;
	close(fileHandle);
	SetOpen(0);
}
예제 #6
0
int LCSafetyShutter::OnState(MM::PropertyBase* pProp, MM::ActionType eAct)
{
   if (eAct == MM::BeforeGet)
   {
      bool open;
      int ret = GetOpen(open);
      if (ret != DEVICE_OK)
         return ret;
      std::string state = "0";
      if (open)
         state = "1";
      pProp->Set(state.c_str());
   }
   else if (eAct == MM::AfterSet)
   {
      std::string state;
      pProp->Get(state);
      bool open = false;
      if (state == "1")
         open = true;
      return SetOpen(open);
   }

   return DEVICE_OK;
}
예제 #7
0
LRESULT CClientReceiver::InitThreadData(WPARAM wparam, LPARAM lparam)
{
	m_pCriticalSection = (CCriticalSection *)wparam;
	m_pThreadData = (ClientReceiverThreadData *)lparam;

	SetOpen();

	return 0;
}
예제 #8
0
void RotatingDoor::Opening()
{
    LTBOOL bDoneInX = LTFALSE;
    LTBOOL bDoneInY = LTFALSE;
    LTBOOL bDoneInZ = LTFALSE;

    LTVector vOldAngles(m_fPitch, m_fYaw, m_fRoll);

	// Calculate new pitch, yaw, and roll...

	bDoneInX = CalcAngle(m_fPitch, m_vClosedAngles.x, m_vOpenAngles.x, m_vOpenDir.x, m_fSpeed);
	bDoneInY = CalcAngle(m_fYaw,   m_vClosedAngles.y, m_vOpenAngles.y, m_vOpenDir.y, m_fSpeed);
	bDoneInZ = CalcAngle(m_fRoll,  m_vClosedAngles.z, m_vOpenAngles.z, m_vOpenDir.z, m_fSpeed);


    LTVector vPos;
    LTRotation rRot;

	// Calcuate the new pos/rot for the door (testing object collisions)...
	// If we collide with an object in the new position, don't move
	// the door (if force move isn't set)...

    if (!CalcPosAndRot(vPos, rRot, LTTRUE) && !(m_dwStateFlags & DF_FORCEMOVE))
	{
		// Restore our angles...

		m_fPitch = vOldAngles.x;
		m_fYaw	 = vOldAngles.y;
		m_fRoll	 = vOldAngles.z;

		// Since we hit something, try to close...
		//SetClosing(); // Doesn't work...

		m_bStuck = LTTRUE;

		return;
	}

	// Set the object's new rotation and position...

    g_pLTServer->RotateObject(m_hObject, &rRot);
    g_pLTServer->MoveObject(m_hObject, &vPos);

	// Update the light animation.

	float fPercent = GetRotatingLightAnimPercent();
	ReallySetLightAnimPos(fPercent);

	if (bDoneInX && bDoneInY && bDoneInZ)
	{
		SetOpen();
	}
}
예제 #9
0
int VTiSIMLaserShutter::OnState(MM::PropertyBase* pProp, MM::ActionType eAct)
{
   if (eAct == MM::BeforeGet)
   {
      pProp->Set(isOpen_ ? 1L : 0L);
   }
   else if (eAct == MM::AfterSet)
   {
      long v;
      pProp->Get(v);
      return SetOpen(v != 0);
   }
   return DEVICE_OK;
}
예제 #10
0
BOOL CGate::InitSetProperty(CServerRegion::tagGateProperty *p)
{
	SetIndex(p->lIndex);//编号
	CShape::SetPosXY( (float)(p->lxPos + 0.5),(float)(p->lyPos + 0.5) );
	SetDir(p->lDir);//方向
	CShape::SetState(p->wOpenState);//打开状态
	CShape::SetAction(p->wOpenState);//动作
	SetAttackScp(p->strAttack);//受攻击脚本
	
	SetOpen(p->strOpen);//打开脚本
	SetClose(p->strClose);//关闭脚本
	SetDestoryScp(p->strDestory);//损毁脚本	
	SetRefreshScp(p->strRefresh);//重刷脚本
	return TRUE;
}
예제 #11
0
int LMM5Shutter::OnState(MM::PropertyBase* pProp, MM::ActionType pAct)
{
   if (pAct == MM::BeforeGet)
   {
      pProp->Set((long) state_);
   }
   else if (pAct == MM::AfterSet)
   {
      long state;
      pProp->Get(state);
      state_ = (int) state;
      SetOpen(open_);
   }

   return DEVICE_OK;
}
예제 #12
0
int LMM5Shutter::OnLabel(MM::PropertyBase* pProp, MM::ActionType pAct)
{
   if (pAct == MM::BeforeGet)
   {
      pProp->Set(StateToLabel(state_).c_str());
   }
   else if (pAct == MM::AfterSet)
   {
      std::string label;
      pProp->Get(label);
      state_ = LabelToState(label);
      SetOpen(open_);
   }

   return DEVICE_OK;
}
예제 #13
0
int Xcite120PC::OnShutterState(MM::PropertyBase* pProp, MM::ActionType eAct)
{
  if (eAct==MM::BeforeGet)
  {
    if (is_open_)
      pProp->Set("Open");
    else
      pProp->Set("Closed");
  }
  else if (eAct==MM::AfterSet)
  {
    std::string buff;
    pProp->Get(buff);
    bool open = (buff=="Open");
    SetOpen(open);   
  }
  return DEVICE_OK;
}
예제 #14
0
void
MTfile::Open(const char *filename)
{
	char *page;

	if(IsOpen()) return;
	fileHandle=open(filename, O_RDWR|O_BINARY);
	if(fileHandle<0) return;
	// Verify that the magic words are there
	page=new char[PageSize()];
	read(fileHandle, page, PageSize());
	if(memcmp(page, magic, sizeof(magic))) {
		close(fileHandle);
		delete page;
		return;
	}
	delete page;
	SetOpen(1);
}
예제 #15
0
int LCShutter::OnState(MM::PropertyBase *pProp, MM::ActionType eAct)
{
   if (eAct == MM::BeforeGet) 
   {
      std::string name = laserNameByState_[state_];
      pProp->Set(name.c_str());
   }
   else if (eAct == MM::AfterSet)
   {
      std::string name;
      pProp->Get(name);
      state_ = laserStateByName_[name];
      bool open;
      GetOpen(open);
      if (open)
         SetOpen(open);
   }
   return DEVICE_OK;
}
예제 #16
0
파일: MTfile.cpp 프로젝트: jsc0218/MxTree
void 
MTfile::Create (const char *filename)
{
	if (IsOpen()) {
		return;
	}
	fileHandle = open (filename, O_RDWR|O_BINARY);
	if (fileHandle >= 0) {
		close (fileHandle);
		return;
	}
	fileHandle = open (filename, O_BINARY|O_RDWR|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE);
	if (fileHandle < 0) {
		return;
	}
	SetOpen (1);

	/* Reserve page 0 */
	char *page = new char[PageSize()];
	memset (page, 0, PageSize());
	memcpy (page, magic, sizeof(magic));
	write (fileHandle, page, PageSize());
	delete []page;
}
예제 #17
0
int VTiSIMLaserShutter::Shutdown()
{
   // Always turn off on shutdown
   return SetOpen(false);
}
예제 #18
0
int Xcite120PC::Initialize()
{
  /* Create the properties */
  CPropertyAction *pAct = new CPropertyAction (this, &Xcite120PC::OnIntensity);
  CreateProperty("LampIntensity", "100", MM::Integer, false, pAct);
  std::vector<std::string> allowed_intensities;
  allowed_intensities.push_back("0");
  allowed_intensities.push_back("12");
  allowed_intensities.push_back("25");
  allowed_intensities.push_back("50");
  allowed_intensities.push_back("100");
  SetAllowedValues("LampIntensity", allowed_intensities);
  
  pAct = new CPropertyAction (this, &Xcite120PC::OnPanelLock);
  CreateProperty("LockFrontPanel", "False", MM::String, false, pAct);
  std::vector<std::string> allowed_boolean;
  allowed_boolean.push_back("True");
  allowed_boolean.push_back("False");
  SetAllowedValues("LockFrontPanel", allowed_boolean);

  pAct = new CPropertyAction(this, &Xcite120PC::OnShutterState );
  CreateProperty( "Shutter-State", "Closed", MM::String, false, pAct);
  std::vector<std::string> allowed_state;
  allowed_state.push_back("Closed");
  allowed_state.push_back("Open");
  SetAllowedValues("Shutter-State", allowed_state);

  pAct = new CPropertyAction(this, &Xcite120PC::OnExposureTime );
  CreateProperty( "Exposure-Time [s]", "A", MM::Float, false, pAct);
  SetPropertyLimits( "Exposure-Time [s]", 0.2, 999.9 );

  pAct = new CPropertyAction(this, &Xcite120PC::OnTrigger );
  CreateProperty( "Trigger", "Off", MM::String, false, pAct);
  std::vector<std::string> trigger_state;
  trigger_state.push_back("On");
  trigger_state.push_back("Off");
  SetAllowedValues("Trigger", trigger_state);
 
  // This seems to cause problems
  //pAct = new CPropertyAction (this, &Xcite120PC::OnLampState);
  //CreateProperty("LampState", "On", MM::String, false, pAct);
  //std::vector<std::string> lamp_state;
  //lamp_state.push_back("On");
  //lamp_state.push_back("Off");
  //SetAllowedValues("LampState", lamp_state);

  
  /* Connect */
  int s = ExecuteCommand( g_XciteCmdConnect );
  if (s!=DEVICE_OK)
    return s;
  s = ExecuteCommand( g_XciteCmdClearAlarm );
  if (s!=DEVICE_OK)
    return s;


  /* initialize machine to default values */
  SetOpen(is_open_);
  SetProperty("LampIntensity", lamp_intensity_.c_str());
  SetProperty("LockFrontPanel", is_locked_.c_str());
  //SetProperty( "Exposure-Time [s]", "30");


  /* Create properties which are not modifiable */
  std::string answer;
  s = ExecuteCommand( g_XciteCmdGetSoftwareVersion, NULL, 0, &answer );
  if (s!=DEVICE_OK)
    return s;
  CreateProperty("ShutterSoftwareVersion", answer.c_str(), MM::String, true);

  s = ExecuteCommand( g_XciteCmdGetLampHours, NULL, 0, &answer );
  if (s!=DEVICE_OK)
    return s;
  CreateProperty("LampHours", answer.c_str(), MM::String, true);

  initialized_ = true;
  return DEVICE_OK;
}
예제 #19
0
파일: SSwitch.cpp 프로젝트: ming-hai/soui
void SSwitch::OnLButtonUp( UINT nFlags, CPoint point )
{
	SetOpen(!m_BOpen);
	__super::OnLButtonUp(nFlags,point);
}