From 8a7ad949c6bbe6c45532096adc13f4dfc6b61597 Mon Sep 17 00:00:00 2001 From: JuWan Kim Date: Fri, 30 Jan 2015 15:57:21 +0900 Subject: [PATCH] Remove ManagerUsb files Change-Id: I0c23a1b7a493ce892ba16790c4a6becf4cfc7ac4 Signed-off-by: JuWan Kim --- CMakeLists.txt | 1 - include/ManagerUsb.h | 54 ---------- src/device/ManagerUsb.cpp | 258 ---------------------------------------------- 3 files changed, 313 deletions(-) delete mode 100644 include/ManagerUsb.h delete mode 100644 src/device/ManagerUsb.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 4062186..c9d6082 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,6 @@ SET(SRCS src/main.cpp src/data/FileInfo.cpp src/data/DirectoryInfo.cpp src/data/FileList.cpp - src/device/ManagerUsb.cpp ) SET(TARGET_EDJ "${PROJECT_NAME}.edj") diff --git a/include/ManagerUsb.h b/include/ManagerUsb.h deleted file mode 100644 index c664603..0000000 --- a/include/ManagerUsb.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __MANAGER_USB_H__ -#define __MANAGER_USB_H__ - - -class CUsbConnectionListener { -private: - void *m; - -public: - CUsbConnectionListener() : m(NULL) {} - virtual ~CUsbConnectionListener() {} - bool FlagCreate(void) { return !!m; } - - bool Create(void); - virtual void Destroy(void); - - bool FlagConnected(void); - - virtual void OnConnect(void) {} -}; - - -#include - - -class CDbUpdateListener { -public: - struct SEntity { - media_content_error_e err; - int pid; - media_content_db_update_item_type_e update_item; - media_content_db_update_type_e update_type; - media_content_type_e media_type; - char *uuid; - char *path; - char *mime_type; - }; - -private: - void *m; - -public: - CDbUpdateListener() : m(NULL) {} - virtual ~CDbUpdateListener() {} - bool FlagCreate(void) { return !!m; } - - bool Create(void); - virtual void Destroy(void); - - virtual void OnUpdated(const SEntity *entity) = 0; -}; - - -#endif /* __MANAGER_USB_H__ */ \ No newline at end of file diff --git a/src/device/ManagerUsb.cpp b/src/device/ManagerUsb.cpp deleted file mode 100644 index 8bfabc9..0000000 --- a/src/device/ManagerUsb.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/* -* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include "dbg.h" -#include -#include -#include "common.h" -#include "i18n.h" - -#include "ManagerUsb.h" - - -class CUsbConnectionListenerImpl { -private: - Eina_List *m_elListener; - bool m_created; - -#if 0 -private: - static void sm_CbConnected(usb_device_h usb_device, char *action, void *dt) - { - CUsbConnectionListenerImpl* root = (CUsbConnectionListenerImpl*)dt; - if (root) - root->t_OnConnected(usb_device, action); - } - -protected: - virtual void t_OnConnected(usb_device_h usb_device, char *action) { - Eina_List *l; - void *obj; - - EINA_LIST_FOREACH(m_elListener, l, obj) { - CUsbConnectionListener* listener = (CUsbConnectionListener*)obj; - listener->OnConnect(); - } - } -#endif - -public: - CUsbConnectionListenerImpl() { - m_created = false; - } - ~CUsbConnectionListenerImpl() { - } - bool FlagCreate(void) { return !!m_created; } - - bool Create(void) { - ASSERT(!FlagCreate()); - ASSERT(!"Not Yet"); -#if 0 - m_elListener = NULL; - if (!usb_device_init()) { - return false; - } - usb_set_connected_cb(sm_CbConnected, this); - - m_created = true; -#endif - return true; - } - virtual void Destroy(void) { - ASSERT(FlagCreate()); -#if 0 - usb_unset_connected_cb(); - usb_device_fini(); - m_created = false; -#endif - } - void Add(CUsbConnectionListener *listener) { - ASSERT(FlagCreate()); - - m_elListener = eina_list_append(m_elListener, listener); - } - void Remove(CUsbConnectionListener *listener) { - ASSERT(FlagCreate()); - - m_elListener = eina_list_remove(m_elListener, listener); - } - bool FlagConnected(void) { - ASSERT(FlagCreate()); -#if 0 - if (usb_get_connected_device_number(USB_MASS_STORAGE) <= 0) - return false; -#endif - return true; - } -}; - - -static CUsbConnectionListenerImpl refUCS; -static int refUCSCnt = 0; - - -bool CUsbConnectionListener::Create(void) -{ - ASSERT(!FlagCreate()); - - if (refUCSCnt == 0) { - if (!refUCS.Create()) { - return false; - } - } - refUCSCnt++; - - refUCS.Add(this); - - m = (void*)1; - - return true; -} - - -void CUsbConnectionListener::Destroy(void) -{ - ASSERT(FlagCreate()); - - refUCS.Remove(this); - refUCSCnt--; - if (refUCSCnt == 0) { - refUCS.Destroy(); - } - m = NULL; -} - - -bool CUsbConnectionListener::FlagConnected(void) -{ - ASSERT(FlagCreate()); - - return refUCS.FlagConnected(); -} - - -class CDbUpdateListenerImpl { -private: - Eina_List *m_elListener; - bool m_created; - -private: - static void sm_CbDbUpdated(media_content_error_e err, int pid, - media_content_db_update_item_type_e update_item, - media_content_db_update_type_e update_type, - media_content_type_e media_type, - char *uuid, char *path, char *mime_type, - void *dt) - { - CDbUpdateListenerImpl* root = (CDbUpdateListenerImpl*)dt; - if (root) { - CDbUpdateListener::SEntity entity; - entity.err = err; - entity.pid = pid; - entity.update_item = update_item; - entity.update_type = update_type; - entity.media_type = media_type; - entity.uuid = uuid; - entity.path = path; - entity.mime_type = mime_type; - root->t_OnDbUpdated(&entity); - } - } - -protected: - virtual void t_OnDbUpdated(CDbUpdateListener::SEntity *entity) { - Eina_List *l; - void *obj; - - EINA_LIST_FOREACH(m_elListener, l, obj) { - CDbUpdateListener* listener = (CDbUpdateListener*)obj; - listener->OnUpdated(entity); - } - } - -public: - CDbUpdateListenerImpl() { - m_created = false; - } - ~CDbUpdateListenerImpl() { - } - bool FlagCreate(void) { return !!m_created; } - - bool Create(void) { - ASSERT(!FlagCreate()); - - m_elListener = NULL; - - if (media_content_set_db_updated_cb(sm_CbDbUpdated, this) != MEDIA_CONTENT_ERROR_NONE) - return false; - - m_created = true; - return true; - } - virtual void Destroy(void) { - ASSERT(FlagCreate()); - media_content_unset_db_updated_cb(); - m_created = false; - } - void Add(CDbUpdateListener *listener) { - ASSERT(FlagCreate() == true); - m_elListener = eina_list_append(m_elListener, listener); - } - void Remove(CDbUpdateListener *listener) { - ASSERT(FlagCreate() == true); - m_elListener = eina_list_remove(m_elListener, listener); - } -}; - - -static CDbUpdateListenerImpl refDUS; -static int refDUSCnt = 0; - - -bool CDbUpdateListener::Create(void) -{ - ASSERT(!FlagCreate()); - - if (refDUSCnt == 0) { - if (!refDUS.Create()) { - return false; - } - } - refDUSCnt++; - refDUS.Add(this); - - m = (void*)1; - - return true; -} - - -void CDbUpdateListener::Destroy(void) -{ - ASSERT(FlagCreate()); - - refDUS.Remove(this); - - refDUSCnt--; - if (refDUSCnt == 0) { - refDUS.Destroy(); - } - - m = NULL; -} -- 2.7.4