2 // Tizen Web Device API
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef __TIZEN_SYSTEMINFO_SYSTEMINFO_PROPERTY_SUCCESSCALLBACK_H__
19 #define __TIZEN_SYSTEMINFO_SYSTEMINFO_PROPERTY_SUCCESSCALLBACK_H__
21 #include <CallbackUserData.h>
26 #include "SystemInfoProperty.h"
29 namespace SystemInfo {
31 class SystemInfoPropertySuccessCallbackData;
32 typedef SystemInfoPropertySuccessCallbackData PropertyCallbackData;
33 typedef std::shared_ptr<PropertyCallbackData> PropertyCallbackDataPtr;
35 struct PropertyCallbackDataHolder {
36 PropertyCallbackDataPtr ptr;
39 class SystemInfoPropertySuccessCallbackData: public Common::CallbackUserData {
41 SystemInfoPropertySuccessCallbackData(JSContextRef globalCtx);
42 virtual ~SystemInfoPropertySuccessCallbackData();
44 void setError(const std::string &err_name, const std::string &err_message);
46 std::string getErrorName() const;
47 std::string getErrorMessage() const;
49 void setPropertyId(SystemInfoPropertyId property_id);
50 SystemInfoPropertyId getPropertyId() const;
52 void setNativeProperty(SystemInfoPropertyPtr property);
53 SystemInfoPropertyPtr getNativeProperty() const;
54 bool isPropertyReady() const;
56 void setOptions(SystemInfoOptions& options);
57 SystemInfoOptions getOptions() const;
59 void setListenerId(unsigned long id);
60 unsigned long getListenerId();
62 void setArrayCallback(bool isArray);
63 bool isArrayCallback();
65 void addNativeProperty(SystemInfoPropertyHolder* property);
66 std::vector<SystemInfoPropertyHolder*> getPropertyArray();
73 bool m_is_array_callback;
74 std::string m_err_name;
75 std::string m_err_message;
76 unsigned long m_listener_id;
78 SystemInfoPropertyId m_property_id;
79 SystemInfoPropertyPtr m_native_property;
80 std::vector<SystemInfoPropertyHolder*> m_native_property_array;
81 SystemInfoOptions m_options;
86 #endif //__TIZEN_SYSTEMINFO_SYSTEMINFO_PROPERTY_SUCCESSCALLBACK_H__