CPropertyItem_AEMode::CPropertyItem_AEMode(EdsImageRef	imageRef)
{
	EdsUInt32 uValue;
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_AEMode, 0, sizeof(uValue),&uValue))
	{
		STR_ID_TABLE propCaptions[] = {
			"Program AE",					0, 
			"Shutter-Speed Priority AE",	1, 
			"Aperture Priority AE",			2, 
			"Manual Exposure",				3, 
			"Bulb",							4, 
			"Auto Depth-of-Field AE AE",	5, 
			"Depth-of-Field  AE",			6, 
			"Auto",							9, 
			 "Night Scene Portrait",		10,
			 "Sports",						11,
			 "Portrait",					12,
			 "Landscape",					13,
			 "Close-Up",					14,
			 "Flash Off",					15,
		};
		const char * tmpString = GetPropertyString(propCaptions, sizeof(propCaptions)/sizeof(STR_ID_TABLE), (int)uValue);
		m_value.push_back(tmpString);
		strcpy_s(m_title, EDS_MAX_NAME, "AE Mode");
	}
}
CPropertyItem_Copyright::CPropertyItem_Copyright (EdsImageRef	imageRef)
{
	char value[EDS_MAX_NAME] = {0};
	if(EDS_ERR_OK == EdsGetPropertyData(imageRef, kEdsPropID_Copyright , 0 , sizeof(value), value ))
	{
		m_value.push_back(value);
		strcpy_s(m_title, EDS_MAX_NAME, "Copyright");
	}
}
CPropertyItem_MakerName::CPropertyItem_MakerName(EdsImageRef	imageRef)
{
	char value[EDS_MAX_NAME] = {0};
	if(EDS_ERR_OK == EdsGetPropertyData(imageRef, kEdsPropID_MakerName , 0 , sizeof(value), value ))
	{
		m_value.push_back(value);
		strcpy_s(m_title, EDS_MAX_NAME, "MakerName");
	}
}
CPropertyItem_FirmwareVersion::CPropertyItem_FirmwareVersion (EdsImageRef	imageRef)
{
	char value[EDS_MAX_NAME] = {0};
	if(EDS_ERR_OK == EdsGetPropertyData(imageRef, kEdsPropID_FirmwareVersion , 0 , sizeof(value), value ))
	{
		m_value.push_back(value);
		strcpy_s(m_title, EDS_MAX_NAME, "FirmwareVersion");
	}
}
CPropertyItem_FlashCompensation::CPropertyItem_FlashCompensation(EdsImageRef	imageRef)
{
	EdsUInt32 uValue;
	char value[EDS_MAX_NAME] = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_FlashCompensation, 0, sizeof(uValue),&uValue))
	{
		sprintf_s( value , EDS_MAX_NAME , "%d" , uValue);
	}
}
CPropertyItem_GPSSatellites::CPropertyItem_GPSSatellites(EdsImageRef	imageRef)
{
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_GPSSatellites, 0, sizeof(value),&value))
	{
		strcpy_s(m_title, EDS_MAX_NAME, "GPS Satellites");
		m_value.push_back(value);
	}
}
CPropertyItem_ColorTone::CPropertyItem_ColorTone(EdsImageRef	imageRef)
{
	EdsInt32	sValue;
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_ColorTone|kEdsPropID_AtCapture_Flag, 0, sizeof(sValue),&sValue))
	{
		sprintf_s(value, EDS_MAX_NAME, "%d", sValue);
		strcpy_s(m_title, EDS_MAX_NAME, "Color Tone");
		m_value.push_back(value);
	}
}
CPropertyItem_GPSVersionID::CPropertyItem_GPSVersionID(EdsImageRef	imageRef)
{
	EdsUInt8 gpsVersion[4];
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_GPSVersionID, 0, sizeof(gpsVersion),&gpsVersion))
	{
		strcpy_s(m_title, EDS_MAX_NAME, "GPS Version ID");
		sprintf_s(value, EDS_MAX_NAME, "%d.%d.%d.%d", gpsVersion[0], gpsVersion[1], gpsVersion[2], gpsVersion[3]);
		m_value.push_back(value);
	}
}
CPropertyItem_Orientation::CPropertyItem_Orientation(EdsImageRef	imageRef)
{
	EdsUInt32 uValue;
	char value[EDS_MAX_NAME] = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_Orientation, 0, sizeof(uValue),&uValue))
	{
		sprintf_s( value , EDS_MAX_NAME , "%d"  , uValue );
		m_value.push_back(value);
		strcpy_s(m_title, EDS_MAX_NAME, "Orientation");
	}
}
CPropertyItem_WhiteBalanceShift::CPropertyItem_WhiteBalanceShift(EdsImageRef	imageRef)
{
	EdsInt32	wbShift[2];
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_WhiteBalanceShift|kEdsPropID_AtCapture_Flag, 0, sizeof(wbShift),&wbShift))
	{
		sprintf_s(value, EDS_MAX_NAME, "AB:%2d GM:%2d", wbShift[0], wbShift[1]);
		strcpy_s(m_title, EDS_MAX_NAME, "White Balance Shift");
		m_value.push_back(value);
	}
}
CPropertyItem_BodyID::CPropertyItem_BodyID(EdsImageRef	imageRef)
{
//	EdsUInt32 uValue;
	char value[EDS_MAX_NAME] = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_BodyIDEx, 0, sizeof(value),&value))
	{
//		sprintf_s( value , EDS_MAX_NAME , "%010d"  , uValue );
		m_value.push_back(value);
		strcpy_s(m_title, EDS_MAX_NAME, "Body ID");
	}
}
CPropertyItem_FocalLength::CPropertyItem_FocalLength(EdsImageRef	imageRef)
{
	EdsRational rational;
	char value[EDS_MAX_NAME] = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_FocalLength, 0, sizeof(rational),&rational))
	{
		sprintf_s( value , EDS_MAX_NAME , ":%.1fmm" , (double)rational.numerator/rational.denominator );
		m_value.push_back(value);
		strcpy_s(m_title, EDS_MAX_NAME, "FocalLength");
	}
}
CPropertyItem_Tv::CPropertyItem_Tv(EdsImageRef	imageRef)
{
	EdsRational rational;
	char value[EDS_MAX_NAME] = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_Tv, 0, sizeof(rational),&rational))
	{
		sprintf_s( value , EDS_MAX_NAME , "%d/%d" , rational.numerator , rational.denominator );
		m_value.push_back(value);
		strcpy_s(m_title, EDS_MAX_NAME, "Tv");
	}
}
CPropertyItem_DateTime::CPropertyItem_DateTime(EdsImageRef	imageRef)
{
	EdsTime time;
	char value[EDS_MAX_NAME] = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_DateTime, 0, sizeof(time),&time))
	{
		sprintf_s( value , EDS_MAX_NAME , "%d/%d/%d %d:%d" , time.month,time.day,time.year,time.hour,time.minute );
		m_value.push_back(value);
		strcpy_s(m_title, EDS_MAX_NAME, "DateTime");
	}
}
CPropertyItem_WhiteBalance::CPropertyItem_WhiteBalance(EdsImageRef	imageRef)
{
	EdsInt32	sValue;
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_WhiteBalance|kEdsPropID_AtCapture_Flag, 0, sizeof(sValue),&sValue))
	{
		STR_ID_TABLE propCaptions[] = {
			"Auto",							0,
			"Daylight",						1,
			"Cloudy",						2,
			"Tungsten",						3,
			"Fluorescent",					4,
			"Flash",						5,
			"Manual",						6,
			"Shade",						8,
			"Color temperature",			9,
			"Custom white balance: PC-1",	10,
			"Custom white balance: PC-2",	11,
			"Custom white balance: PC-3",	12,
			"Manual 2",						15,
			"Manual 3",						16,
			"Manual 4",						15,
			"Manual 5",						19,
			"Custom white balance: PC-4",	20,
			"Custom white balance: PC-5",	21,
		};

		const char * tmpString = GetPropertyString(propCaptions, sizeof(propCaptions)/sizeof(STR_ID_TABLE), (int)sValue);
		m_value.push_back(tmpString);
		strcpy_s(m_title, EDS_MAX_NAME, "White Balance");


		if(sValue == 9)
		{
			EdsUInt32	uValue;
			EdsGetPropertyData( imageRef, kEdsPropID_ColorTemperature|kEdsPropID_AtCapture_Flag, 0, sizeof(uValue),&uValue);
			sprintf_s(value, EDS_MAX_NAME, "%d K", uValue);
			m_value.push_back(value);
		}
	}
}
CPropertyItem_PhotoEffect::CPropertyItem_PhotoEffect(EdsImageRef	imageRef)
{
	EdsUInt32	uValue;
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_PhotoEffect|kEdsPropID_AtCapture_Flag, 0, sizeof(uValue),&uValue))
	{
		if(uValue==5)
		{
			strcpy_s(m_title, EDS_MAX_NAME, "Photo Effect");
			m_value.push_back("Black and White");
		}
	}
}
CPropertyItem_GPSTimeStamp::CPropertyItem_GPSTimeStamp(EdsImageRef	imageRef)
{
	EdsRational timeStamp[3];
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_GPSTimeStamp, 0, sizeof(timeStamp),&timeStamp))
	{
		if(timeStamp[0].denominator != 0 && timeStamp[1].denominator != 0 && timeStamp[2].denominator != 0)
			sprintf_s( value , EDS_MAX_NAME , "%02d:%02d:%02d" , timeStamp[0].numerator/ timeStamp[0].denominator , timeStamp[1].numerator/ timeStamp[1].denominator , timeStamp[2].numerator/ timeStamp[2].denominator );
		strcpy_s(m_title, EDS_MAX_NAME, "GPS Time Stamp");
		m_value.push_back(value);
	}
}
CPropertyItem_GPSAltitude::CPropertyItem_GPSAltitude(EdsImageRef	imageRef)
{
	EdsUInt8	alitudeRef;
	EdsRational	rational;
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_GPSAltitudeRef, 0, sizeof(alitudeRef),&alitudeRef))
	{
		EdsGetPropertyData( imageRef,kEdsPropID_GPSAltitude , 0, sizeof(rational), &rational);	
		// negative value
		if( alitudeRef == 1)
		{	
			sprintf_s( value , EDS_MAX_NAME , "-%.2fm" , (EdsFloat)rational.numerator/rational.denominator );
		}
		// 
		else
		{
			sprintf_s( value , EDS_MAX_NAME , "%.2fm" ,(EdsFloat)rational.numerator/rational.denominator  );
		}
		strcpy_s(m_title, EDS_MAX_NAME, "GPS Altitude");
		m_value.push_back(value);
	}
}
CPropertyItem_Sharpness::CPropertyItem_Sharpness(EdsImageRef	imageRef)
{
	char value[EDS_MAX_NAME]  = {0};
	char productName[EDS_MAX_NAME]  = {0};
	if(EDS_ERR_OK != EdsGetPropertyData(imageRef, kEdsPropID_ProductName|kEdsPropID_AtCapture_Flag, 0 , sizeof(productName), productName ))	return;

	if(!strcmp("EOS-1D", productName) ||
		!strcmp("EOS-1Ds", productName))
	{
		EdsUInt32	sharpness[2];
		if(EDS_ERR_OK != EdsGetPropertyData( imageRef, kEdsPropID_Sharpness , 0, sizeof(sharpness),&sharpness))
		{
			STR_ID_TABLE propCaptions[] = {
				"Off",			0,
				"Rough",		1,
				"Mid. rough",	2,
				"Standard",		3,
				"Mid. fine",	4,
				"Fine",			5,
			};
			strcpy_s(m_title, EDS_MAX_NAME, "Sharpness");
			const char * tmpString = GetPropertyString(propCaptions, sizeof(propCaptions)/sizeof(STR_ID_TABLE), (int)sharpness[1]);
			if(tmpString != NULL)	sprintf_s(value, EDS_MAX_NAME, "level:%d target:%s", sharpness[0], tmpString);
			m_value.push_back(value);
		}
	}
	else
	{
		EdsUInt32 uValue;
		if( EDS_ERR_OK == EdsGetPropertyData( imageRef ,kEdsPropID_Sharpness , 0, sizeof(uValue),&uValue))
		{
			strcpy_s(m_title, EDS_MAX_NAME, "Sharpness");
			sprintf_s(value, EDS_MAX_NAME, "%d", uValue);
			m_value.push_back(value);
		}
	}
}
// Shutter speed accessors / modifiers
int getTv() {
	EdsError err = EDS_ERR_OK;
	EdsDataType dataType;
	EdsUInt32 dataSize;
	EdsInt32 Tv;
	err = EdsGetPropertySize(camera, kEdsPropID_Tv, 0, &dataType, &dataSize);
	if (!err) {
		err = EdsGetPropertyData(camera, kEdsPropID_Tv, 0, dataSize, &Tv);
		if (!err) {
			return Tv;
		}
	}

	return 0;
}
CPropertyItem_RedEye::CPropertyItem_RedEye(EdsImageRef	imageRef)
{
	EdsUInt32	uValue;
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_RedEye, 0, sizeof(uValue),&uValue))
	{
		STR_ID_TABLE propCaptions[] = {
			"Off",	0,
			"On",	1,
		};
		const char * tmpString = GetPropertyString(propCaptions, sizeof(propCaptions)/sizeof(STR_ID_TABLE), (int)uValue);
		m_value.push_back(tmpString);
		strcpy_s(m_title, EDS_MAX_NAME, "Red-eye Reduction");
	}
}
CPropertyItem_ColorSpace::CPropertyItem_ColorSpace(EdsImageRef	imageRef)
{
	EdsUInt32	uValue;
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_ColorSpace|kEdsPropID_AtCapture_Flag, 0, sizeof(uValue),&uValue))
	{
		STR_ID_TABLE propCaptions[] = {
			"sRGB",			1,
			"Adobe RGB",	2,
		};
		const char * tmpString = GetPropertyString(propCaptions, sizeof(propCaptions)/sizeof(STR_ID_TABLE), (int)uValue);
		m_value.push_back(tmpString);
		strcpy_s(m_title, EDS_MAX_NAME, "Color Space");
	}
}
CPropertyItem_ExposureCompensation::CPropertyItem_ExposureCompensation(EdsImageRef	imageRef)
{
	EdsRational rational;
	char value[EDS_MAX_NAME] = {0};
	if(EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_ExposureCompensation, 0, sizeof(rational),&rational))
	{
		if(rational.numerator==0)
			sprintf_s( value , EDS_MAX_NAME , "%d" , rational.numerator);
		else
		{
			sprintf_s( value , EDS_MAX_NAME , "%d/%d" , rational.numerator, rational.denominator );
		}
		m_value.push_back(value);
		strcpy_s(m_title, EDS_MAX_NAME, "Exposure Compensation");
	}
}
CPropertyItem_DigitalExposure::CPropertyItem_DigitalExposure(EdsImageRef	imageRef)
{
	EdsRational rational;
	char value[EDS_MAX_NAME] = {0};
	if(EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_DigitalExposure|kEdsPropID_AtCapture_Flag, 0, sizeof(rational),&rational))
	{
		if(rational.numerator==0)
			sprintf_s( value , EDS_MAX_NAME , "%d" , rational.numerator);
		else
		{
			sprintf_s( value , EDS_MAX_NAME , "%d/%d" , rational.numerator, rational.denominator );
		}
		m_value.push_back(value);
		strcpy_s(m_title, EDS_MAX_NAME, "Digital Exposure ");
	}
}
CPropertyItem_Contrast::CPropertyItem_Contrast(EdsImageRef	imageRef)
{
	EdsInt32	sValue;
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_Contrast|kEdsPropID_AtCapture_Flag, 0, sizeof(sValue),&sValue))
	{
		STR_ID_TABLE propCaptions[] = {
			"Low",			-2,
			"Mid. low",		-1,
			"Standard",		0,
			"Mid. High",	1,
			"High",			2,
		};
		const char * tmpString = GetPropertyString(propCaptions, sizeof(propCaptions)/sizeof(STR_ID_TABLE), (int)sValue);
		m_value.push_back(tmpString);
		strcpy_s(m_title, EDS_MAX_NAME, "Contrast");
	}
}
CPropertyItem_MeteringMode::CPropertyItem_MeteringMode(EdsImageRef	imageRef)
{
	EdsUInt32 uValue;
	char value[EDS_MAX_NAME] = {0};
	if(EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_MeteringMode, 0, sizeof(uValue),&uValue))
	{
		STR_ID_TABLE propCaptions[] = {
			"Spot metering",						1,
			"Evaluative metering",					3,
			"Partial metering",						4,
			"Center-weighted averaging metering",	5,
		};

		const char * tmpString = GetPropertyString(propCaptions, sizeof(propCaptions)/sizeof(STR_ID_TABLE), (int)uValue);
		m_value.push_back(tmpString);
		strcpy_s(m_title, EDS_MAX_NAME, "Metering Mode");
	}
}
CPropertyItem_ToningEffect::CPropertyItem_ToningEffect(EdsImageRef	imageRef)
{
	EdsUInt32	uValue;
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_ToningEffect|kEdsPropID_AtCapture_Flag, 0, sizeof(uValue),&uValue))
	{
		STR_ID_TABLE propCaptions[] = {
			"None",		0,
			"Sepia",	1,
			"Blue",		2,
			"Violet",	3,
			"Green",	4,
		};
		const char * tmpString = GetPropertyString(propCaptions, sizeof(propCaptions)/sizeof(STR_ID_TABLE), (int)uValue);
		m_value.push_back(tmpString);
		strcpy_s(m_title, EDS_MAX_NAME, "Toning Effect");
	}
}
CPropertyItem_AFMode::CPropertyItem_AFMode(EdsImageRef	imageRef)
{
	EdsUInt32 uValue;
	char value[EDS_MAX_NAME] = {0};
	if(EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_AFMode, 0, sizeof(uValue),&uValue))
	{
		STR_ID_TABLE propCaptions[] = {
			"One-Shot AF",		0,
			"AI Servo AF",		1,
			"AI Focus AF",		2,
			"Manual Focus",		3,
		};

		const char * tmpString = GetPropertyString(propCaptions, sizeof(propCaptions)/sizeof(STR_ID_TABLE), (int)uValue);
		m_value.push_back(tmpString);
		strcpy_s(m_title, EDS_MAX_NAME, "AF Mode");
	}
}
 void Camera::endLiveView()
 {
     std::cout << "end live view" << std::endl;
     EdsError err = EDS_ERR_OK;
     
     // Get the output device for the live view image
     EdsUInt32 device;
     err = EdsGetPropertyData(mCamera, kEdsPropID_Evf_OutputDevice, 0, sizeof(device), &device );
     
     // PC live view ends if the PC is disconnected from the live view image output device.
     if(err == EDS_ERR_OK)
     {
         device &= ~kEdsEvfOutputDevice_PC;
         err = EdsSetPropertyData(mCamera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device);
     }
     
     mIsLiveView = false;
 }
CPropertyItem_ToneCurve::CPropertyItem_ToneCurve(EdsImageRef	imageRef)
{
	EdsUInt32	uValue;
	char value[EDS_MAX_NAME]  = {0};
	if( EDS_ERR_OK == EdsGetPropertyData( imageRef, kEdsPropID_ToneCurve, 0, sizeof(uValue),&uValue))
	{
		STR_ID_TABLE propCaptions[] = {
			"Standard",			0x00,
			"User setting",		0x11,
			"Custom setting",	0x80,
			"TCD1",				0x01,
			"TCD2",				0x02,
			"TCD3",				0x03,
		};
		const char * tmpString = GetPropertyString(propCaptions, sizeof(propCaptions)/sizeof(STR_ID_TABLE), (int)uValue);
		m_value.push_back(tmpString);
		strcpy_s(m_title, EDS_MAX_NAME, "Tone Curve");
	}
}