* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
*
* @pre context_history_list_get_current()
+ * @see context_history_record_get_double()
* @see context_history_record_get_string()
*/
int context_history_record_get_int(context_history_record_h record, const char* key, int* value);
*
* @pre context_history_list_get_current()
* @see context_history_record_get_int()
+ * @see context_history_record_get_double()
*/
int context_history_record_get_string(context_history_record_h record, const char* key, char** value);
/**
+ * @brief Gets a double-precision value from a record.
+ * @since_tizen 3.0
+ *
+ * @param[in] record The record handle
+ * @param[in] key The key of attribute to get
+ * @param[out] value The result value
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #CONTEXT_HISTORY_ERROR_NONE Successful
+ * @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre context_history_list_get_current()
+ * @see context_history_record_get_int()
+ * @see context_history_record_get_string()
+ */
+int context_history_record_get_double(context_history_record_h record, const char* key, double* value);
+
+/**
* @brief Destroys a record handle and releases all its resources.
* @since_tizen 2.4
*
#include <ProviderTypes.h>
#include <context_history.h>
-#define TYPE_INT 0
+#define TYPE_NUMERIC 0
#define TYPE_STRING 1
#define FILTER_KEY_LIMIT 10
ASSERT_NOT_NULL(record && val && key);
// Check key and data type
- IF_FAIL_RETURN_TAG(check_record_key_data_type(TYPE_INT, key), CONTEXT_HISTORY_ERROR_INVALID_PARAMETER, _E, "Data type mismatched");
+ IF_FAIL_RETURN_TAG(check_record_key_data_type(TYPE_NUMERIC, key), CONTEXT_HISTORY_ERROR_INVALID_PARAMETER, _E, "Data type mismatched");
+
+ std::list<std::string> key_list;
+ record->jrecord.getKeys(&key_list);
+ IF_FAIL_RETURN_TAG(key_list.size() > 0, CONTEXT_HISTORY_ERROR_NO_DATA, _E, "No data");
+
+ // Check invalid record key
+ IF_FAIL_RETURN_TAG(record->jrecord.get(NULL, key, val), CONTEXT_HISTORY_ERROR_INVALID_PARAMETER, _E, "Invalid record key");
+
+ return CONTEXT_HISTORY_ERROR_NONE;
+}
+
+SO_EXPORT int context_history_record_get_double(context_history_record_h record, const char* key, double* val)
+{
+ ASSERT_NOT_NULL(record && val && key);
+
+ // Check key and data type
+ IF_FAIL_RETURN_TAG(check_record_key_data_type(TYPE_NUMERIC, key), CONTEXT_HISTORY_ERROR_INVALID_PARAMETER, _E, "Data type mismatched");
std::list<std::string> key_list;
record->jrecord.getKeys(&key_list);
key.compare(CONTEXT_HISTORY_AUDIO_JACK) == 0 ||
key.compare(CONTEXT_HISTORY_SYSTEM_VOLUME) == 0 ||
key.compare(CONTEXT_HISTORY_MEDIA_VOLUME) == 0) {
- return (type == TYPE_INT);
+ return (type == TYPE_NUMERIC);
}
return false;