Example #1
0
int Camera::RecallSpecificLocation(int locId)
{
	Location specificLoc;
	if(presetLocations.find(locId) == presetLocations.end())
	{
		return -1;
	}
	specificLoc = presetLocations[locId];
	unsigned char currentCommand[1024];
	int cmdLength = 0;
	if(m_nProtocol == Pelco_D)
	{
		memset(currentCommand, 0x00, 1024);
		if(specificLoc.GetCommand(currentCommand, cmdLength) < 0)
		{
			return -1;
		}

		return sendCommand(currentCommand, cmdLength);
	}
	else if(m_nProtocol == VISCA)
	{
		memset(currentCommand, 0x00, 1024);
		if(specificLoc.GetCommand(currentCommand, cmdLength) < 0)
		{
			return -1;
		}
		currentCommand[4] = (unsigned char)m_nVelocity;
		if(sendCommand(currentCommand, cmdLength) < 0)
		{
			return -1;
		}
		memset(currentCommand, 0x00, 1024);
		if(specificLoc.GetFocalCommand(currentCommand, cmdLength) < 0)
		{
			return -1;
		}
		if(sendCommand(currentCommand, cmdLength) < 0)
		{
			return -1;
		}
		return 0;
	}
	return 0;
}