/**
 * Create a new image by loading a file.
 * @param fileName The path of the file to load.
 */
HSLImage::HSLImage(const char *fileName) : ColorImage(IMAQ_IMAGE_HSL)
{
	
	
	int success = imaqReadFile(m_imaqImage, fileName, NULL, NULL);
	//printf("HSLImage Success at Reading is %d\n",success);
	//wpi_setImaqErrorWithContext(success, "Imaq ReadFile error");
	if(success <= 0) {
		printf("!!!Error!!! | %s | %s\n",imaqGetErrorText(imaqGetLastError()), imaqGetLastErrorFunc());
	}
}
Ejemplo n.º 2
0
/**
 * @brief Set the current error information associated from the nivision Imaq API.
 * 
 * @param success The return from the function
 * @param contextMessage A custom message from the code that set the error.
 * @param filename Filename of the error source
 * @param function Function of the error source
 * @param lineNumber Line number of the error source
 */
void ErrorBase::SetImaqError(int success, const char *contextMessage, const char* filename, const char* function, uint32_t lineNumber) const
{
#if ENABLE_NIVISION
	//  If there was an error
	if (success <= 0) {
		char err[256];
		sprintf(err, "%s: %s", contextMessage, imaqGetErrorText(imaqGetLastError()));

		//  Set the current error information for this object.
		m_error.Set(imaqGetLastError(), err, filename, function, lineNumber, this);

		// Update the global error if there is not one already set.
		Synchronized mutex(_globalErrorMutex);
		if (_globalError.GetCode() == 0) {
			_globalError.Clone(m_error);
		}
	}
#endif
}