Fixed doxygen warnings

This commit is contained in:
T. van der Zwan 2013-09-09 20:35:28 +00:00
parent a6c0f06b44
commit ecdd7775c5
14 changed files with 205 additions and 35 deletions

View File

@ -47,6 +47,7 @@ public:
///
/// Determines the led colors of the image in the buffer.
///
/// @param[in] image The image to translate to led values
/// @param[out] ledColors The color value per led
///
void process(const RgbImage& image, std::vector<RgbColor>& ledColors);

View File

@ -13,18 +13,20 @@ class LedDevice
{
public:
/**
* Empty virtual destructor for pure virtual base class
*/
///
/// Empty virtual destructor for pure virtual base class
///
virtual ~LedDevice()
{
// empty
}
/**
* Writes the RGB-Color values to the leds.
*
* @param[in] ledValues The RGB-color per led
*/
///
/// Writes the RGB-Color values to the leds.
///
/// @param[in] ledValues The RGB-color per led
///
/// @return Zero on success else negative
///
virtual int write(const std::vector<RgbColor>& ledValues) = 0;
};

View File

@ -15,7 +15,7 @@ namespace Json { class Value; }
///
/// The Led structure contains the definition of the image portion used to determine a single led's
/// color.
/// <pre>
/// @verbatim
/// |--------------------image--|
/// | minX maxX |
/// | |-----|minY |
@ -25,7 +25,7 @@ namespace Json { class Value; }
/// | |
/// | |
/// |---------------------------|
/// <endpre>
/// @endverbatim
///
struct Led
{

View File

@ -43,7 +43,7 @@ private slots:
///
/// Slot which is called when a client closes a connection
/// @param The Connection object which is being closed
/// @param connection The Connection object which is being closed
///
void closedConnection(JsonClientConnection * connection);

View File

@ -67,11 +67,35 @@ public:
void transform(uint8_t & red, uint8_t & green, uint8_t & blue) const;
///
/// integer version of the conversion are faster, but a little less accurate
/// all values are unsigned 8 bit values and scaled between 0 and 255 except
/// for the hue which is a 16 bit number and scaled between 0 and 360
/// Translates an RGB (red, green, blue) color to an HSV (hue, saturation, value) color
///
/// @param[in] red The red RGB-component
/// @param[in] green The green RGB-component
/// @param[in] blue The blue RGB-component
/// @param[out] hue The hue HSV-component
/// @param[out] saturation The saturation HSV-component
/// @param[out] value The value HSV-component
///
/// @note Integer version of the conversion are faster, but a little less accurate all values
/// are unsigned 8 bit values and scaled between 0 and 255 except for the hue which is a 16 bit
/// number and scaled between 0 and 360
///
static void rgb2hsv(uint8_t red, uint8_t green, uint8_t blue, uint16_t & hue, uint8_t & saturation, uint8_t & value);
///
/// Translates an HSV (hue, saturation, value) color to an RGB (red, green, blue) color
///
/// @param[in] hue The hue HSV-component
/// @param[in] saturation The saturation HSV-component
/// @param[in] value The value HSV-component
/// @param[out] red The red RGB-component
/// @param[out] green The green RGB-component
/// @param[out] blue The blue RGB-component
///
/// @note Integer version of the conversion are faster, but a little less accurate all values
/// are unsigned 8 bit values and scaled between 0 and 255 except for the hue which is a 16 bit
/// number and scaled between 0 and 360
///
static void hsv2rgb(uint16_t hue, uint8_t saturation, uint8_t value, uint8_t & red, uint8_t & green, uint8_t & blue);
private:

View File

@ -33,14 +33,14 @@ public:
virtual ~JsonSchemaChecker();
///
/// @param The schema to use
/// @param schema The schema to use
/// @return true upon succes
///
bool setSchema(const Json::Value & schema);
///
/// @brief Validate a JSON structure
/// @param The JSON value to check
/// @param value The JSON value to check
/// @return true when the arguments is valid according to the schema
///
bool validate(const Json::Value & value);
@ -51,34 +51,142 @@ public:
const std::list<std::string> & getMessages() const;
private:
void collectReferences(const Json::Value & schema);
///
/// Validates a json-value against a given schema. Results are stored in the members of this
/// class (_error & _messages)
///
/// @param[in] value The value to validate
/// @param[in] schema The schema against which the value is validated
///
void validate(const Json::Value &value, const Json::Value & schema);
///
/// Adds the given message to the message-queue (with reference to current line-number)
///
/// @param[in] message The message to add to the queue
///
void setMessage(const std::string & message);
///
/// Retrieves all references from the json-value as specified by the schema
///
/// @param[in] value The json-value
/// @param[in] schema The schema
///
void collectDependencies(const Json::Value & value, const Json::Value &schema);
private:
// attribute check functions
///
/// Checks if the given value is of the specified type. If the type does not match _error is set
/// to true and an error-message is added to the message-queue
///
/// @param[in] value The given value
/// @param[in] schema The specified type (as json-value)
///
void checkType(const Json::Value & value, const Json::Value & schema);
///
/// Checks is required properties of an json-object exist and if all properties are of the
/// correct format. If this is not the case _error is set to true and an error-message is added
/// to the message-queue.
///
/// @param[in] value The given json-object
/// @param[in] schema The schema of the json-object
///
void checkProperties(const Json::Value & value, const Json::Value & schema);
///
/// Verifies the additional configured properties of an json-object. If this is not the case
/// _error is set to true and an error-message is added to the message-queue.
///
/// @param value The given json-object
/// @param schema The schema for the json-object
/// @param ignoredProperties The properties that were ignored
///
void checkAdditionalProperties(const Json::Value & value, const Json::Value & schema, const Json::Value::Members & ignoredProperties);
///
/// Checks if references are configued and used correctly. If this is not the case _error is set
/// to true and an error-message is added to the message-queue.
///
/// @param value The given json-object
/// @param schemaLink The schema of the json-object
///
void checkDependencies(const Json::Value & value, const Json::Value & schemaLink);
///
/// Checks if the given value is larger or equal to the specified value. If this is not the case
/// _error is set to true and an error-message is added to the message-queue.
///
/// @param[in] value The given value
/// @param[in] schema The minimum value (as json-value)
///
void checkMinimum(const Json::Value & value, const Json::Value & schema);
///
/// Checks if the given value is smaller or equal to the specified value. If this is not the
/// case _error is set to true and an error-message is added to the message-queue.
///
/// @param[in] value The given value
/// @param[in] schema The maximum value (as json-value)
///
void checkMaximum(const Json::Value & value, const Json::Value & schema);
///
/// Validates all the items of an array.
///
/// @param value The json-array
/// @param schema The schema for the items in the array
///
void checkItems(const Json::Value & value, const Json::Value & schema);
///
/// Checks if a given array has at least a minimum number of items. If this is not the case
/// _error is set to true and an error-message is added to the message-queue.
///
/// @param value The json-array
/// @param schema The minimum size specification (as json-value)
///
void checkMinItems(const Json::Value & value, const Json::Value & schema);
///
/// Checks if a given array has at most a maximum number of items. If this is not the case
/// _error is set to true and an error-message is added to the message-queue.
///
/// @param value The json-array
/// @param schema The maximum size specification (as json-value)
///
void checkMaxItems(const Json::Value & value, const Json::Value & schema);
///
/// Checks if a given array contains only unique items. If this is not the case
/// _error is set to true and an error-message is added to the message-queue.
///
/// @param value The json-array
/// @param schema Bool to enable the check (as json-value)
///
void checkUniqueItems(const Json::Value & value, const Json::Value & schema);
///
/// Checks if an enum value is actually a valid value for that enum. If this is not the case
/// _error is set to true and an error-message is added to the message-queue.
///
/// @param value The enum value
/// @param schema The enum schema definition
///
void checkEnum(const Json::Value & value, const Json::Value & schema);
private:
/// The schema of the entire json-configuration
Json::Value _schema;
/// The current location into a json-configuration structure being checked
std::list<std::string> _currentPath;
/// The result messages collected during the schema verification
std::list<std::string> _messages;
/// Flag indicating an error occured during validation
bool _error;
/// A list with references (string => json-value)
std::map<std::string, const Json::Value *> _references; // ref 2 value
};

View File

@ -59,6 +59,8 @@ namespace hyperion
/// Determines the mean-color for each led using the mapping the image given
/// at construction.
///
/// @param[in] image The image from which to extract the led colors
///
/// @return ledColors The vector containing the output
///
std::vector<RgbColor> getMeanLedColor(const RgbImage & image) const;
@ -67,6 +69,7 @@ namespace hyperion
/// Determines the mean color for each led using the mapping the image given
/// at construction.
///
/// @param[in] image The image from which to extract the led colors
/// @param[out] ledColors The vector containing the output
///
void getMeanLedColor(const RgbImage & image, std::vector<RgbColor> & ledColors) const;
@ -83,6 +86,7 @@ namespace hyperion
/// Calculates the 'mean color' of the given list. This is the mean over each color-channel
/// (red, green, blue)
///
/// @param[in] image The image a section from which an average color must be computed
/// @param[in] colors The list with colors
///
/// @return The mean of the given list of colors (or black when empty)

View File

@ -109,8 +109,6 @@ private:
///
/// Handle an incoming JSON message of unknown type
///
/// @param message the incoming message
///
void handleNotImplemented();
///

View File

@ -413,7 +413,7 @@ void JsonSchemaChecker::checkUniqueItems(const Json::Value & value, const Json::
{
// only for arrays
_error = true;
setMessage("maxItems only valid for arrays");
setMessage("uniqueItems only valid for arrays");
return;
}

View File

@ -3,7 +3,10 @@
/// Simple structure to contain the values of a color transformation
struct ColorTransformValues
{
/// The value for the red color-channel
double valueRed;
/// The value for the green color-channel
double valueGreen;
/// The value for the blue color-channel
double valueBlue;
};

View File

@ -20,6 +20,15 @@ typedef vlofgren::PODParameter<QImage> ImageParameter;
typedef vlofgren::PODParameter<ColorTransformValues> TransformParameter;
namespace vlofgren {
///
/// Translates a string (as passed on the commandline) to a color
///
/// @param[in] s The string (as passed on the commandline)
///
/// @return The translated color
///
/// @throws Parameter::ParameterRejected If the string did not result in a color
///
template<>
QColor ColorParameter::validate(const std::string& s) throw (Parameter::ParameterRejected)
{

View File

@ -79,6 +79,7 @@ public:
/// @param saturation The HSV saturation gain
/// @param value The HSV value gain
/// @param threshold The threshold
/// @param gamma The gamma value
/// @param blacklevel The blacklevel
/// @param whitelevel The whitelevel
///

View File

@ -6,6 +6,7 @@ if(PNG_FOUND)
include_directories(${PNG_INCLUDE_DIR})
add_executable(viewpng
FbWriter.h
ViewPng.cpp)
target_link_libraries(viewpng

View File

@ -12,14 +12,27 @@
#include <utils/RgbImage.h>
///
/// FbWriter allows direct access tot the FrameBuffer. It writes and image to the framebuffer,
/// adjusting the resolution as required. When destructed the FrameBuffer is switch to original
/// configuration.
///
class FbWriter
{
public:
///
/// Constructs the FrameBuffer writer opening the FrameBuffer device and storing the current
/// configuration.
///
FbWriter()
{
initialise();
}
///
/// Destructor of the write. Switches the FrameBuffer to its origianl configuration and closes
/// the FrameBuffer
///
~FbWriter()
{
if (ioctl(fbfd, FBIOPUT_VSCREENINFO, &orig_vinfo))
@ -30,26 +43,33 @@ public:
close(fbfd);
}
///
/// Initialises the write, opening the FrameBuffer
///
/// @return Zero on succes else negative
///
int initialise()
{
// Open the file for reading and writing
fbfd = open("/dev/fb0", O_RDWR);
if (!fbfd)
{
printf("Error: cannot open framebuffer device.\n");
return(-1);
std::cerr << "Error: cannot open framebuffer device." << std::endl;
return -1;
}
printf("The framebuffer device was opened successfully.\n");
// Get fixed screen information
if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo))
{
printf("Error reading fixed information.\n");
std::cerr << "Error reading fixed information.\n" << std::endl;
return -1;
}
// Get variable screen information
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &orig_vinfo))
{
printf("Error reading variable information.\n");
std::cerr << "Error reading variable information.\n" << std::endl;
return -1;
}
printf("Original %dx%d, %dbpp\n", orig_vinfo.xres, orig_vinfo.yres, orig_vinfo.bits_per_pixel );
@ -57,6 +77,12 @@ public:
return 0;
}
///
/// Writes the given RGB Image to the FrameBuffer. When required the resolution of the
/// FrameBuffer is asjusted to match the given image
///
/// @param image The RGB Image
///
void writeImage(const RgbImage& image)
{
std::cout << "Writing image [" << image.width() << "x" << image.height() << "]" << std::endl;
@ -93,23 +119,16 @@ public:
for (unsigned iY=0; iY<image.height(); ++iY)
{
memcpy(fbp + iY*finfo.line_length, &(image(0, iY)), image.width()*3);
// for (unsigned iX=0; iX<image.width(); ++iX)
// {
// const unsigned pixOffset = iX*3 + iY*finfo.line_length;
// fbp[pixOffset ] = image(iX, iY).red;
// fbp[pixOffset+1] = image(iX, iY).green;
// fbp[pixOffset+2] = image(iX, iY).blue;
// }
}
std::cout << "FINISHED COPYING IMAGE TO FRAMEBUFFER" << std::endl;
// cleanup
munmap(fbp, screensize);
}
// The identifier of the FrameBuffer File-Device
/// The identifier of the FrameBuffer File-Device
int fbfd;
// The 'Fixed' screen information
/// The 'Fixed' screen information
fb_fix_screeninfo finfo;
// The original 'Variable' screen information
/// The original 'Variable' screen information
fb_var_screeninfo orig_vinfo;
};