OEM.Collimator.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #include "stdafx.h"
  2. #include "OEM.Collimator.h"
  3. //#include "DIOS.Dev.FPD.Demo.h"
  4. #include "DIOS.Dev.Generator.Demo.hpp"
  5. OemCollimator::OemCollimator(std::shared_ptr <DIOS::Dev::IOEventCenter> EventCenter,
  6. int nXSize, int nYSize, int nFilter, int nSID, int nAngle, int nMode): super(EventCenter)
  7. {
  8. m_nXSize = nXSize;
  9. m_nYSize = nYSize;
  10. m_nFilter = nFilter;
  11. m_nSID = nSID;
  12. m_nAngle = nAngle;
  13. m_nMode = nMode;
  14. }
  15. OemCollimator::~OemCollimator()
  16. {
  17. }
  18. bool OemCollimator::Prepare()
  19. {
  20. printf("OemCollimator::Prepare\n");
  21. Register();
  22. return true;
  23. }
  24. void OemCollimator::Register()
  25. {
  26. printf("OemCollimator::Register\n");
  27. auto p = static_cast <CollimatorDevice*> (this);
  28. auto Disp = Dispatch.Lock().As();
  29. Disp->Action.Push("SetCollimatorSize", p, &CollimatorDevice::JSSetCollimatorSize);
  30. Disp->Action.Push("SetCollimatorFilter", p, &CollimatorDevice::JSSetCollimatorFilter);
  31. Disp->Action.Push("SetCollimatorSID", p, &CollimatorDevice::JSSetCollimatorSID);
  32. Disp->Action.Push("SetCollimatorAngle", p, &CollimatorDevice::JSSetCollimatorAngle);
  33. Disp->Action.Push("SetCollimatorLight", p, &CollimatorDevice::JSSetCollimatorLight);
  34. Disp->Get.Push("XSize", p, &CollimatorDevice::JSGetCollimatorXSize);
  35. Disp->Get.Push("YSize", p, &CollimatorDevice::JSGetCollimatorYSize);
  36. Disp->Get.Push("SID", p, &CollimatorDevice::JSGetCollimatorSID);
  37. Disp->Get.Push("Filter", p, &CollimatorDevice::JSGetCollimatorFilter);
  38. Disp->Get.Push("Angle", p, &CollimatorDevice::JSGetCollimatorAngle);
  39. }
  40. void OemCollimator::SetCtrlDev(DemoDevice* pCtrlDev)
  41. {
  42. m_pGEN = pCtrlDev;
  43. }
  44. nsDev::RET_STATUS OemCollimator::SetCollimatorFilter(WORD pParams)
  45. {
  46. nsDev::RET_STATUS ret = nsDev::RET_STATUS::RET_FAILED;
  47. ret = m_pGEN->SetFilter(pParams);
  48. return ret;
  49. }
  50. nsDev::RET_STATUS OemCollimator::SetCollimatorSize(WORD xsize, WORD ysize)
  51. {
  52. nsDev::RET_STATUS ret = nsDev::RET_STATUS::RET_FAILED;
  53. ret = m_pGEN->SetCollimatorSize(xsize, ysize);
  54. return ret;
  55. }
  56. nsDev::RET_STATUS OemCollimator::SetCollimatorLight(WORD pParams)
  57. {
  58. //nsDev::RET_STATUS ret = nsDev::RET_STATUS::RET_FAILED;
  59. nsDev::RET_STATUS ret = m_pGEN->SetCollimatorLight(pParams);
  60. return ret;
  61. }