tizen 2.3.1 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / Systeminfo / SystemInfoStorageUnit.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #ifndef __TIZEN_SYSTEMINFO_SYSTEMINFO_STORAGE_UNIT_H__
19 #define __TIZEN_SYSTEMINFO_SYSTEMINFO_STORAGE_UNIT_H__
20
21 #include <memory>
22 #include <vector>
23
24 #include "SystemInfoProperty.h"
25
26 namespace DeviceAPI {
27 namespace SystemInfo {
28
29 namespace {
30 const std::string TYPE_UNKNOWN = "UNKNOWN";
31 const std::string TYPE_INTERNAL = "INTERNAL";
32 const std::string TYPE_USB_HOST = "USB_HOST";
33 const std::string TYPE_MMC = "MMC";
34 }
35 enum StorageType {
36     UNKNOWN,
37     INTERNAL,
38     USB_HOST,
39     MMC
40 };
41
42 class SystemInfoStorageUnit;
43 typedef std::shared_ptr<SystemInfoStorageUnit> SystemInfoStorageUnitPtr;
44 typedef std::vector<SystemInfoStorageUnitPtr> UnitsPtrVector;
45
46 class SystemInfoStorageUnit: public SystemInfoProperty {
47 public:
48     SystemInfoStorageUnit();
49     virtual ~SystemInfoStorageUnit();
50
51     StorageType getType() const;
52     unsigned long long getCapacity() const;
53     unsigned long long getAvailableCapacity() const;
54     bool isRemovable() const;
55
56     void setType(StorageType type);
57     void setCapacity(unsigned long long capacity);
58     void setAvailableCapacity(unsigned long long av_capacity);
59     void setIsRemovable(bool is_removable);
60
61     static std::string typeToString(StorageType type);
62
63     bool operator==(const SystemInfoStorageUnit& other);
64     bool operator!=(const SystemInfoStorageUnit& other);
65
66 private:
67     StorageType m_type;
68     unsigned long long m_capacity;
69     unsigned long long m_available_capacity;
70     bool m_is_removable;
71
72 };
73
74 } // SystemInfo
75 } // DeviceAPI
76
77 #endif //__TIZEN_SYSTEMINFO_SYSTEMINFO_STORAGE_UNIT_H__