namespace gallery {
+ /**
+ * @brief Base job class
+ */
class BaseJob : public IJob {
public:
// IJob //
+ /**
+ * @brief Gets result
+ * @return Result. @see ucl::Result
+ */
virtual ucl::Result getResult() const final override;
+
+ /**
+ * @brief Check if job can be canceled
+ * @return true if cancelable
+ */
virtual bool isCancelable() const final override;
+
+ /**
+ * @brief Cancels job
+ * @return Result. @see ucl::Result
+ */
virtual ucl::Result cancel() final override;
protected:
+ /**
+ * @brief Constructor
+ * @param[in] onComplete Completion handler
+ * @param[in] isCancelable Cancelable flag
+ */
BaseJob(const NotiHandler &onComplete,
bool isCancelable);
+
+ /**
+ * @brief Destructor
+ */
virtual ~BaseJob();
+ /**
+ * @brief Prepares job data
+ * @return RES_OK on success, otherwise an error code on failure
+ */
ucl::Result prepare();
+ /**
+ * @brief Checks if job is canceled
+ * @return true if canceled, false if not
+ */
bool isCancelled() const;
+ /**
+* * @brief Sends execute signal
+ * @return RES_OK on success, otherwise an error code on failure
+ */
virtual ucl::Result execute() = 0;
private:
UCL_DECLARE_REF_ALIASES(GalleryAlbum);
+ /**
+ * @brief Gallery album
+ */
class GalleryAlbum final : public IMediaAlbum {
public:
+ /**
+ * @brief Creates new GalleryAlbum instance
+ * @return Shared reference to GalleryAlbum object
+ */
static GalleryAlbumSRef newInstance();
public:
// IMediaAlbum //
+ /**
+ * @brief Adds change handler
+ * @param[in] handler Change handler
+ */
virtual void addChangeHandler(NotiHandler handler) final override;
+
+ /**
+ * @brief Removes change handler
+ * @param[in] handler Change handler
+ */
virtual void delChangeHandler(
NotiHandler::CDRef handler) final override;
+ /**
+ * @brief Runs function for each MediaAlbum entry
+ * @param[in] cb Callback function
+ * @return RES_OK on success, otherwise an error code on failure
+ */
virtual ucl::Result forEachMedia(EachCb cb) const final override;
+
+ /**
+ * @brief Gets number of items in album
+ * @param[out] count Media count
+ * @return RES_OK on success, otherwise an error code on failure
+ */
virtual ucl::Result getMediaCount(int &count) const final override;
+ /**
+ * @brief Defragments media album contents
+ */
virtual void defragment() final override;
private:
namespace gallery {
+ /**
+ * @brief Converts platform media content type to MediaType
+ * @param[in] contentType Content type
+ * @return Media type
+ */
MediaType toMediaType(media_content_type_e contentType);
+ /**
+ * @breif Gets mutex
+ * @return Mutex. @see ucl::Mutex
+ */
ucl::Mutex &getMediaMutex();
+ /**
+ * @brief Gets internal storage ID
+ * @param[out] result Storage ID
+ * @return RES_OK on success, otherwise an error code on failure
+ */
ucl::Result getInternalStorageId(int &result);
+ /**
+ * @brief Connects to database
+ * @details Creates connection to media database. In case of existing
+ * connection registers additional virtual connection(increases
+ * connection count by one)
+ * @return RES_OK on success, otherwise an error code on failure
+ */
ucl::Result acquireMediaDbConnection();
+
+ /**
+ * @brief Disconnects from database
+ * @details Destroys connection to media database. While there is more
+ * than one connection, erase one virtual connection(decrease
+ * connection count by one)
+ * @return RES_OK on success, otherwise an error code on failure
+ */
void releaseMediaDbConnection();
}