//## begin module%1.4%.codegen_version preserve=yes
//   Read the documentation to learn more about C++ code generator

//   versioning.

//## end module%1.4%.codegen_version



//## begin module%3D86D3FC0244.cm preserve=no

//	  %X% %Q% %Z% %W%

//## end module%3D86D3FC0244.cm



//## begin module%3D86D3FC0244.cp preserve=no

//## end module%3D86D3FC0244.cp


//## Module: Camera%3D86D3FC0244; Pseudo Package body

//## Source file: C:\Program Files\Rational\Rose\C++\source\Camera.cpp



//## begin module%3D86D3FC0244.additionalIncludes preserve=no

//## end module%3D86D3FC0244.additionalIncludes



//## begin module%3D86D3FC0244.includes preserve=yes

//## end module%3D86D3FC0244.includes



// Camera

#include "Camera.h"

//## begin module%3D86D3FC0244.additionalDeclarations preserve=yes
//## end module%3D86D3FC0244.additionalDeclarations


// Class Camera

//## begin Camera::aCamera%3D9AA26D032A.attr preserve=no  private: static Camera {U}
Camera Camera::aCamera;
//## end Camera::aCamera%3D9AA26D032A.attr

Camera::Camera()
  //## begin Camera::Camera%3D86D3FC0244_const.hasinit preserve=no
  //## end Camera::Camera%3D86D3FC0244_const.hasinit
  //## begin Camera::Camera%3D86D3FC0244_const.initialization preserve=yes
  //## end Camera::Camera%3D86D3FC0244_const.initialization
{
  //## begin Camera::Camera%3D86D3FC0244_const.body preserve=yes
  LCDPrintf("Camera constr.\n");
	initialize();
  LCDPrintf("done\n");
  //## end Camera::Camera%3D86D3FC0244_const.body
}


Camera::~Camera()
{
  //## begin Camera::~Camera%3D86D3FC0244_dest.body preserve=yes
	release();
  //## end Camera::~Camera%3D86D3FC0244_dest.body
}



//## Other Operations (implementation)
Camera* Camera::getCamera ()
{
  //## begin Camera::getCamera%3D9AA24401FE.body preserve=yes
  return &aCamera;
  //## end Camera::getCamera%3D9AA24401FE.body
}

void Camera::getFrame (image& aImage)
{
  //## begin Camera::getFrame%3D9292500154.body preserve=yes
  CAMGetFrame(&aImage);
  //## end Camera::getFrame%3D9292500154.body
}

void Camera::getColorFrame (colimage& aColorImage)
{
  //## begin Camera::getColorFrame%3D92926000DC.body preserve=yes
  CAMGetColFrame(&aColorImage, 0); //0 means no automatic conversion to grayscale
  //## end Camera::getColorFrame%3D92926000DC.body
}

bool Camera::initialize ()
{
  //## begin Camera::initialize%3D92923E00DC.body preserve=yes
	LCDPutString("Camera init...\n"); //should use LCD class

  int camera = CAMInit(NORMAL);
  //CAMMode(AUTOBRIGHTNESS);???

  switch(camera)
  {
    case 255:
			LCDPutString("No camera!\n"); //should use LCD class
			OSPanic(""); //or return false??
			break;
    case 254:
			LCDPutString("error!\n"); //should use LCD class
			OSPanic(""); //or return false??
      break;
    case 0:
			LCDPutString("No color camera!\n"); //should use LCD class
			OSPanic(""); //or return false??
      break;
    case 16:
      //QuickCam V2 color
			//ok???
      break;
    case 17:
      //EyeCam-1 (6300)
			//ok???
      break;
    case 18:
      //EyeCam-2 (7620)
			//ok???
      break;
    case 19:
      //EyeCam-3 (6620)
			//ok???
      break;
    default:
			LCDPutString("Unknown camera\ntype!\n"); //should use LCD class
			OSPanic("");  //or return false??
      break;
  }

	LCDPutString("done\n"); //should use LCD class
  return true;
  //## end Camera::initialize%3D92923E00DC.body
}

bool Camera::release ()
{
  //## begin Camera::release%3D92923E010E.body preserve=yes
  CAMRelease();
  return true;
  //## end Camera::release%3D92923E010E.body
}

// Additional Declarations
  //## begin Camera%3D86D3FC0244.declarations preserve=yes
  //## end Camera%3D86D3FC0244.declarations

//## begin module%3D86D3FC0244.epilog preserve=yes
//## end module%3D86D3FC0244.epilog
