Pepper_47_C++_interfaces
removable_storage_dev.h
Go to the documentation of this file.
1 /** <!-- -*- c++ -*- ****************************************************** -->
2  *
3  * @file removable_storage_dev.h
4  * @author Michal Jurkiewicz <m.jurkiewicz@samsung.com>
5  * @date 11-10-2013
6  *
7  ******************************************************************************
8  *
9  * Copyright (c) 2013 Samsung Electronics, Visual Display Division.
10  * All Rights Reserved.
11  *
12  * This software is the confidential and proprietary information
13  * of Samsung Electronics, Inc. ("Confidential Information"). You
14  * shall not disclose such Confidential Information and shall use
15  * it only in accordance with the terms of the license agreement
16  * you entered into with Samsung.
17  *
18  *****************************************************************************/
19 
20 #ifndef PPAPI_CPP_REMOVABLE_STORAGE_DEV_H_
21 #define PPAPI_CPP_REMOVABLE_STORAGE_DEV_H_
22 
23 #include "ppapi/c/dev/ppb_removable_storage_dev.h"
26 #include "ppapi/cpp/file_system.h"
28 #include "ppapi/cpp/resource.h"
29 
30 
31 namespace pp {
32 
34 public:
35 
36  /**
37  * Creates a removable storage resource.
38  *
39  * @param[in] instance A <code>InstanceHandle</code> identifying one instance of
40  * a module.
41  *
42  * @return A <code>Resource</code> corresponding to a removable storage
43  * resource if successful, 0 if failed.
44  */
45 
46  explicit RemovableStorage_Dev(const InstanceHandle& instance);
47 
48  /**
49  * Determines if the given resource is a removable storage resource.
50  *
51  * @return A <code>bool</code> containing <code>true</code> if the given
52  * resource is a removable storage resource, otherwise <code>false</code>.
53  */
54 
55  bool IsRemovableStorage();
56 
57  /**
58  * Determines if the given resource is available.
59  *
60  * @return A <code>bool</code> containing <code>true</code> if the given
61  * resource is available, otherwise <code>false</code>.
62  */
63 
64  static bool IsAvailable();
65 
66  /**
67  * Enumerates removable storage devices.
68  *
69  * @param[in] callback A <code>CompletionCallbackWithOutput</code> to run on
70  * completion.
71  *
72  * @return An error code from <code>pp_errors.h</code>.
73  */
74 
75  int32_t EnumerateDevices(const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >& callback);
76 
77  /**
78  * Requests device change notifications.
79  *
80  * @param[in] callback The callback to receive notifications. If not NULL, it
81  * will be called once for the currently available devices, and then every
82  * time the list of available devices changes. All calls will happen on the
83  * same thread as the one on which MonitorDeviceChange() is called. It will
84  * receive notifications until it will be destroyed or
85  * <code>MonitorDeviceChange()</code> is called to set a new callback for
86  * <code>removable_storage</code>. You can pass NULL to cancel sending
87  * notifications.
88  * @param[inout] user_data An opaque pointer that will be passed to
89  * <code>callback</code>.
90  *
91  * @return An error code from <code>pp_errors.h</code>.
92  */
93 
94  int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
95  void* user_data);
96 
97  /**
98  * Opens removable file system.
99  *
100  * @param[in] file_system A <code>FileSystem</code> corresponding to a file
101  * system of PP_FILESYSTEMTYPE_REMOVABLESTORAGE type.
102  * @param[in] device_ref A <code>DeviceRef_Dev</code> corresponding to a device
103  * reference.
104  * @param[in] callback A <code>CompletionCallback</code> to run on
105  * completion.
106  *
107  * @return An error code from <code>pp_errors.h</code>.
108  */
109 
110  int32_t Open(const FileSystem& file_system,
111  const DeviceRef_Dev& device_ref,
112  const CompletionCallback& callback);
113 };
114 
115 } // namespace pp
116 
117 #endif // PPAPI_CPP_REMOVABLE_STORAGE_DEV_H_
int32_t Open(const FileSystem &file_system, const DeviceRef_Dev &device_ref, const CompletionCallback &callback)
int32_t EnumerateDevices(const CompletionCallbackWithOutput< std::vector< DeviceRef_Dev > > &callback)
int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback, void *user_data)
A reference counted module resource.
Definition: resource.h:20
RemovableStorage_Dev(const InstanceHandle &instance)