summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunbin Lee <hyunbin.lee@samsung.com>2013-04-17 09:53:02 +0900
committerHyunbin Lee <hyunbin.lee@samsung.com>2013-04-17 09:53:02 +0900
commit56f29f92315331ff556f02c697009293626a9a63 (patch)
tree55b5b458d700683579927a00935bfad1a0794a07
parentf827f9e0d51ad39bede2cf385ac73a6dac3fb6af (diff)
downloadapplication-56f29f92315331ff556f02c697009293626a9a63.tar.gz
application-56f29f92315331ff556f02c697009293626a9a63.tar.bz2
application-56f29f92315331ff556f02c697009293626a9a63.zip
storage_foreach_device_supported() gets run-time device statesubmit/tizen_2.1/20130424.230218accepted/tizen_2.1/20130425.0405322.1b_release
Signed-off-by: Hyunbin Lee <hyunbin.lee@samsung.com>
-rwxr-xr-xpackaging/capi-appfw-application.spec2
-rwxr-xr-xsrc/storage.c29
-rwxr-xr-xsrc/storage_internal.c2
-rwxr-xr-xsrc/storage_sdcard.c4
-rwxr-xr-xsrc/storage_usbhost.c4
5 files changed, 30 insertions, 11 deletions
diff --git a/packaging/capi-appfw-application.spec b/packaging/capi-appfw-application.spec
index 38d65de..5eb43e0 100755
--- a/packaging/capi-appfw-application.spec
+++ b/packaging/capi-appfw-application.spec
@@ -1,7 +1,7 @@
Name: capi-appfw-application
Summary: An Application library in SLP C API
Version: 0.1.0
-Release: 51
+Release: 52
Group: API
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
diff --git a/src/storage.c b/src/storage.c
index 1a42a1e..81894cb 100755
--- a/src/storage.c
+++ b/src/storage.c
@@ -41,6 +41,9 @@ extern storage_device_h storage_internal_device();
extern storage_device_h storage_sdcard_device();
extern storage_device_h storage_usbhost_device();
+extern int storage_internal_get_state();
+extern int storage_sdcard_get_state();
+extern int storage_usbhost_get_state();
#define STORAGE_MAX 3
static struct storage_info_s storage_info_table[STORAGE_MAX];
@@ -79,8 +82,8 @@ static int storage_initialize()
dev_internal = storage_internal_device();
storage_register_device(dev_internal);
- dev_sdcard = storage_sdcard_device();
- storage_register_device( dev_sdcard);
+ dev_sdcard = storage_sdcard_device();
+ storage_register_device(dev_sdcard);
dev_usbhost = storage_usbhost_device();
storage_register_device(dev_usbhost);
@@ -88,9 +91,10 @@ static int storage_initialize()
return 0;
}
-
static int storage_get_storage(int id, storage_info_h* storage_info)
{
+ int device_state = -1;
+
if (storage_num < 1)
{
if (storage_initialize() != 0)
@@ -99,17 +103,32 @@ static int storage_get_storage(int id, storage_info_h* storage_info)
}
}
- if (id <0 || id >= storage_num)
+ if (id < 0 || id >= storage_num)
{
return STORAGE_ERROR_NOT_SUPPORTED;
}
+ switch (id)
+ {
+ case 0:
+ device_state = storage_internal_get_state();
+ break;
+ case 1:
+ device_state = storage_sdcard_get_state();
+ break;
+ case 2:
+ device_state = storage_usbhost_get_state();
+ break;
+ default:
+ LOGE("Device statei is invalid");
+ break;
+ }
+ storage_info_table[id].state = device_state;
*storage_info = &(storage_info_table[id]);
return STORAGE_ERROR_NONE;
}
-
int storage_foreach_device_supported(storage_device_supported_cb callback, void *user_data)
{
int storage_id = 0;
diff --git a/src/storage_internal.c b/src/storage_internal.c
index 973fd54..9698630 100755
--- a/src/storage_internal.c
+++ b/src/storage_internal.c
@@ -35,7 +35,7 @@
#define INTERNAL_MEMORY_PATH "/opt/usr/media"
-static int storage_internal_get_state()
+int storage_internal_get_state()
{
return STORAGE_STATE_MOUNTED;
}
diff --git a/src/storage_sdcard.c b/src/storage_sdcard.c
index 9dd9cb0..3fa1f43 100755
--- a/src/storage_sdcard.c
+++ b/src/storage_sdcard.c
@@ -11,7 +11,7 @@
* 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.
+ * limitations under the License.
*/
@@ -35,7 +35,7 @@
#define SDCARD_PATH "/opt/storage/sdcard"
-static int storage_sdcard_get_state()
+int storage_sdcard_get_state()
{
int sdcard_state = 0;
diff --git a/src/storage_usbhost.c b/src/storage_usbhost.c
index aba65c0..88394e4 100755
--- a/src/storage_usbhost.c
+++ b/src/storage_usbhost.c
@@ -11,7 +11,7 @@
* 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.
+ * limitations under the License.
*/
@@ -35,7 +35,7 @@
#define USBHOST_PATH "/opt/storage/usb"
-static int storage_usbhost_get_state()
+int storage_usbhost_get_state()
{
int usbhost_state = 0;