if (!platform_result) {
return LogAndCreateResult(
platform_result.error_code(), platform_result.message().c_str(),
- ("Failed to get AppControl: %d (%s)", platform_result.error_code(),
+ ("Failed to get AppControl: %d (%s)", static_cast<int>(platform_result.error_code()),
platform_result.message().c_str()));
}
}
alarm_ids->push_back(alarm_id);
return true;
}
+#include <stdio.h>
void AlarmManager::GetAll(const picojson::value& args, picojson::object& out) {
ScopeLogger();
-
std::vector<int> alarm_ids;
int ret = alarm_foreach_registered_alarm(AlarmIterateCB, &alarm_ids);
void AlarmManager::GetNextScheduledDate(const picojson::value& args, picojson::object& out) {
ScopeLogger();
-
int id = 0;
if (args.contains("id") && args.get("id").is<double>()) {
}
void OperationCallbackData::setError(const ErrorCode& err_code, const std::string& err_message) {
- ScopeLogger("Setting error, code is: [%d]", err_code);
+ ScopeLogger("Setting error, code is: [%d]", static_cast<int>(err_code));
// store only first error
if (!m_is_error) {
m_err_code = err_code;
if ((status = ErrorChecker(error_code)).IsError()) return status;
} else {
return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR, "Invalid union type!",
- ("Invalid union type: %d", calType));
+ ("Invalid union type: %d", static_cast<int>(calType)));
}
}
intermediate_filters.pop_back();
PlatformResult CalendarItem::SetInt(int type, calendar_record_h rec, const std::string& property,
int value) {
- ScopeLogger("set: %s" + property);
+ ScopeLogger("set: %s", property.c_str());
unsigned int prop;
PlatformResult status = GetPlatformProperty(type, property, &prop);
PlatformResult CalendarItem::GetInt(int type, calendar_record_h rec, const std::string& property,
int* value) {
- ScopeLogger("set: %s" + property);
+ ScopeLogger("set: %s", property.c_str());
unsigned int prop;
PlatformResult status = GetPlatformProperty(type, property, &prop);
PlatformResult CalendarItem::GetCaltime(int type, calendar_record_h rec,
const std::string& property, calendar_time_s* cal_time,
bool throw_on_error) {
- ScopeLogger("set: %s" + property);
+ ScopeLogger("set: %s", property.c_str());
unsigned int prop;
PlatformResult status = GetPlatformProperty(type, property, &prop);
PlatformResult CalendarItem::GetLli(int type, calendar_record_h rec, const std::string& property,
long long int* lli) {
- ScopeLogger("set: %s" + property);
+ ScopeLogger("set: %s", property.c_str());
unsigned int prop;
PlatformResult status = GetPlatformProperty(type, property, &prop);
}
Date CalendarItem::DateFromJson(const picojson::object& in) {
- ScopeLogger("json date " + picojson::value(in).serialize());
+ ScopeLogger("json date %s", picojson::value(in).serialize().c_str());
Date date = {(long long int)common::FromJson<double>(in, "UTCTimestamp"),
(int)common::FromJson<double>(in, "year"),
if (type != calendar_type) {
return LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Calendar not found",
- ("Calendar type doesn't match requested type %s", type));
+ ("Calendar type doesn't match requested type %d", type));
}
status = CalendarRecord::CalendarToJson(record_ptr.get(), &out);
public:
ScopeLogger(const std::string& f, const std::string& m, int l, const std::string& ex = "")
: file_(f), method_(m), extra_(ex) {
- LoggerD("%s: %s(%d) > Enter %s", file_.c_str(), method_.c_str(), l, extra_.c_str());
- }
-
- template <typename... Args>
- ScopeLogger(const std::string& f, const std::string& m, int l, const std::string& ex,
- Args... args)
- : file_(f), method_(m), extra_(ex) {
-#ifdef TIZEN_DEBUG_ENABLE
- __dlog_print(LOG_ID_MAIN, DLOG_DEBUG, LOGGER_TAG,
- ("%s: %s(%d) > %s: %s(%d) > Enter " + extra_).c_str(), __MODULE__, __func__,
- __LINE__, file_.c_str(), method_.c_str(), l, args...);
-#endif
}
~ScopeLogger() {
} // common
-#define ScopeLogger(EX, args...) \
- const common::ScopeLogger __sl__ { \
- __MODULE__, __func__, __LINE__, EX, ##args \
- }
+#ifdef TIZEN_DEBUG_ENABLE
+#define ScopeLogger(EX, args...) \
+ __dlog_print(LOG_ID_MAIN, DLOG_DEBUG, LOGGER_TAG, \
+ "logger.h: ScopeLogger > %s: %s(%d) > Enter " EX, __MODULE__, __func__, __LINE__, \
+ ##args); \
+ const common::ScopeLogger __sl__{__MODULE__, __func__, __LINE__, EX};
+
+#else
+#define ScopeLogger(EX, args...)
+#endif
#endif // COMMON_LOGGER_H_
long address_book_id = common::stol(FromJson<std::string>(args, "addressBookId"));
- LoggerD("Searching in address book: %d", address_book_id);
+ LoggerD("Searching in address book: %ld", address_book_id);
ContactSearchEngine engine;
if (!IsUnified(address_book_id)) {
contacts_record_h record = nullptr;
int error_code = contacts_db_get_record(_contacts_contact._uri, id, &record);
if (CONTACTS_ERROR_NONE != error_code) {
- LoggerE("Failed to get contact with ID: %d", id);
+ LoggerE("Failed to get contact with ID: %ld", static_cast<long>(id));
continue;
}
error_code =
contacts_record_get_int(record, _contacts_contact.address_book_id, &address_book_id);
if (CONTACTS_ERROR_NONE != error_code) {
- LoggerE("Failed to get address book ID of contact with ID: %d", id);
+ LoggerE("Failed to get address book ID of contact with ID: %ld", static_cast<long>(id));
continue;
}
}
void ExifInformation::set(std::string attributeName, const picojson::value& v) {
- ScopeLogger(attributeName);
+ ScopeLogger("%s", attributeName.c_str());
switch (str2int(attributeName.c_str())) {
case str2int(EI_URI): {
namespace exif {
void ExifTagSaver::removeExifEntryWithTag(const ExifTag tag, ExifData* exif_data) {
- ScopeLogger("tag:%d (0x%x)", tag, exif_data);
+ ScopeLogger("tag: %d (%p)", tag, exif_data);
ExifEntry* exif_entry = exif_data_get_entry(exif_data, tag);
if (!exif_entry) {
- LoggerE("Exif entry with tag:%d (0x%x) is not present", tag, tag);
+ LoggerE("Exif entry with tag: %d (0x%x) is not present", tag, tag);
return;
}
}
ExifEntry* ExifTagSaver::prepareEntry(ExifData* exif_data, ExifTag tag) {
- ScopeLogger("tag:%d (0x%x)", tag, exif_data);
+ ScopeLogger("tag: %d (%p)", tag, exif_data);
ExifEntry* exif_entry = exif_data_get_entry(exif_data, tag);
if (!exif_entry) {
}
Rational Rational::createFromDouble(const double value, const long precision) {
- ScopeLogger("value:%f precision:%d", value, precision);
+ ScopeLogger("value: %f precision: %ld", value, precision);
if (value < 0.0) {
LoggerW("Trying to create negative Rational: %f!", value);
return Rational();
class GpsMonitor;
explicit Monitor(const std::string& t) : type_(t) {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
}
virtual ~Monitor() {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
}
std::string type() const {
}
PlatformResult SetListener(JsonCallback callback, const picojson::value& args) {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
auto result = IsSupported();
if (!result) {
}
PlatformResult UnsetListener() {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
auto result = IsSupported();
if (!result) {
}
PlatformResult GetData(picojson::value* data) {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
auto result = IsSupported();
if (!result) {
}
PlatformResult StartDataRecorder(int interval, int retention_period) {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
auto result = IsSupported();
if (!result) {
}
PlatformResult StopDataRecorder() {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
return StopDataRecorderImpl();
}
PlatformResult ReadRecorderData(picojson::array* data, const picojson::value& query) {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
auto result = IsSupported();
if (!result) {
protected:
virtual PlatformResult IsSupportedImpl(bool* supported) const {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
*supported = false;
return PlatformResult(ErrorCode::NO_ERROR);
}
virtual PlatformResult SetListenerImpl(const picojson::value& args) {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR, "NOT_SUPPORTED_ERR");
}
virtual PlatformResult UnsetListenerImpl() {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR, "NOT_SUPPORTED_ERR");
}
virtual PlatformResult GetDataImpl(picojson::value* data) const {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR, "NOT_SUPPORTED_ERR");
}
virtual PlatformResult StartDataRecorderImpl(int interval, int retention_period) const {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR, "NOT_SUPPORTED_ERR");
}
virtual PlatformResult StopDataRecorderImpl() const {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR, "NOT_SUPPORTED_ERR");
}
virtual PlatformResult ReadRecorderDataImpl(picojson::array* data, const picojson::value& query) {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR, "NOT_SUPPORTED_ERR");
}
public:
PlatformResult IsSupported() {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
if (!is_supported_) {
bool is_supported = false;
: public HumanActivityMonitorManager::Monitor {
public:
explicit GestureMonitor(const std::string& t) : Monitor(t), handle_(nullptr) {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
}
virtual ~GestureMonitor() override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
UnsetListenerImpl();
}
protected:
virtual PlatformResult IsSupportedImpl(bool* s) const override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
bool supported = false;
}
virtual PlatformResult SetListenerImpl(const picojson::value&) override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
if (!handle_) {
int ret = gesture_create(&handle_);
}
virtual PlatformResult UnsetListenerImpl() override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
if (handle_) {
int ret = gesture_stop_recognition(handle_);
converter_(c),
converter_recorded_(r),
recorded_data_(nullptr) {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
}
virtual ~SensorMonitor() override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
UnsetListenerImpl();
}
protected:
virtual PlatformResult IsSupportedImpl(bool* s) const override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
bool supported = false;
}
virtual PlatformResult SetListenerImpl(const picojson::value& args) override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
if (!handle_) {
sensor_h sensor_handle = nullptr;
}
virtual PlatformResult UnsetListenerImpl() override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
if (handle_) {
int ret = sensor_listener_stop(handle_);
}
virtual PlatformResult GetDataImpl(picojson::value* data) const override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
if (!handle_) {
return LogAndCreateResult(ErrorCode::SERVICE_NOT_AVAILABLE_ERR, "SERVICE_NOT_AVAILABLE_ERR");
}
virtual PlatformResult StartDataRecorderImpl(int interval, int retention_period) const override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
sensor_recorder_option_h option = nullptr;
}
virtual PlatformResult StopDataRecorderImpl() const override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
int ret = sensor_recorder_stop(sensor_);
if (SENSOR_ERROR_NONE != ret) {
virtual PlatformResult ReadRecorderDataImpl(picojson::array* data,
const picojson::value& query) override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
std::lock_guard<std::mutex> lock(mutex_);
this->recorded_data_ = data;
: public HumanActivityMonitorManager::Monitor {
public:
explicit GpsMonitor(const std::string& t) : Monitor(t), handle_(nullptr) {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
}
virtual ~GpsMonitor() override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
UnsetListenerImpl();
}
protected:
virtual PlatformResult IsSupportedImpl(bool* s) const override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
int ret = 0;
ret = system_info_get_platform_bool("http://tizen.org/feature/location.batch", s);
}
virtual PlatformResult SetListenerImpl(const picojson::value& args) override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
int ret = 0;
}
virtual PlatformResult UnsetListenerImpl() override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
if (handle_) {
int ret = location_manager_stop_batch(handle_);
}
virtual PlatformResult GetDataImpl(picojson::value* data) const override {
- ScopeLogger(type());
+ ScopeLogger("type %s", type().c_str());
if (!handle_) {
return LogAndCreateResult(ErrorCode::SERVICE_NOT_AVAILABLE_ERR, "SERVICE_NOT_AVAILABLE_ERR");
picojson::value metadata = picojson::value(picojson::object());
PlatformResult result = Types::ConvertMetadata(metadata_h, &metadata.get<picojson::object>());
if (!result) {
- LoggerE("ConvertMetadata failed, error: ", result.message().c_str());
+ LoggerE("ConvertMetadata failed, error: %s", result.message().c_str());
return;
}
std::string err;
picojson::parse(data, data_str, data_str + strlen(data_str), &err);
if (!err.empty()) {
- LoggerE("Failed to parse bundle data: %d", err);
+ LoggerE("Failed to parse bundle data: %s", err.c_str());
return;
}
: common::dbus::Proxy(kDBusPathEmailStorageChange, kDBusIfaceEmailStorageChange,
kDBusNameSignalEmail, kDBusPathEmailStorageChange,
kDBusIfaceEmailStorageChange),
- email_manager_(manager) {
+ email_manager_(manager) {
ScopeLogger();
}
LoggerD("Unrecognized status: %d", status);
}
if (ret.IsError()) {
- LoggerE("%d (%s)", ret.error_code(), (ret.message()).c_str());
+ LoggerE("%d (%s)", static_cast<int>(ret.error_code()), (ret.message()).c_str());
}
g_free(name);
}
bool is_in_range = FilterUtils::isBetweenTimeRange(time_stamp, from_time, to_time);
- LoggerD("%d is%s in time range <%d, %d>", time_stamp, (is_in_range ? "" : " NOT"), from_time,
- to_time);
+ LoggerD("%lld is%s in time range <%lld, %lld>", static_cast<long long>(time_stamp),
+ (is_in_range ? "" : " NOT"), static_cast<long long>(from_time),
+ static_cast<long long>(to_time));
return is_in_range;
}
for (auto& it : groups_) {
if (it.second->Remove(id)) {
- LoggerD("Listener with id: %d removed from group: %d", id, it.first);
+ LoggerD("Listener with id: %ld removed from group: %d", id, it.first);
return;
}
}
- LoggerW("WatchId %d not found", id);
+ LoggerW("WatchId %ld not found", id);
}
template <class CallbackType, class EventType>
bool ret = false;
if (true == (ret = message_callbacks_.Remove(id))) {
- LoggerD("Message listener with id: %d removed", id);
+ LoggerD("Message listener with id: %ld removed", id);
} else if (true == (ret = conversation_callbacks_.Remove(id))) {
- LoggerD("Conversation listener with id: %d removed", id);
+ LoggerD("Conversation listener with id: %ld removed", id);
} else if (true == (ret = folder_callbacks_.Remove(id))) {
- LoggerD("Folder listener with id: %d removed", id);
+ LoggerD("Folder listener with id: %ld removed", id);
}
return ret;
PlatformResult ret = RemoveMessagesPlatform(callback);
if (ret.IsError()) {
- LoggerE("%d (%s)", ret.error_code(), (ret.message()).c_str());
+ LoggerE("%d (%s)", static_cast<int>(ret.error_code()), (ret.message()).c_str());
callback->SetError(ret);
removeEmailCompleteCB(callback);
}
PlatformResult ret = UpdateMessagesPlatform(callback);
if (ret.IsError()) {
- LoggerE("%d (%s)", ret.error_code(), (ret.message()).c_str());
+ LoggerE("%d (%s)", static_cast<int>(ret.error_code()), (ret.message()).c_str());
callback->SetError(ret);
}
PlatformResult ret = FindMessagesPlatform(callback);
if (ret.IsError()) {
- LoggerE("%d (%s)", ret.error_code(), (ret.message()).c_str());
+ LoggerE("%d (%s)", static_cast<int>(ret.error_code()), (ret.message()).c_str());
callback->SetError(ret);
}
PlatformResult ret = MessageConversation::convertEmailConversationToObject(
conversationsInfo.at(i).id, &conversation);
if (ret.IsError()) {
- LoggerE("%d (%s)", ret.error_code(), (ret.message()).c_str());
+ LoggerE("%d (%s)", static_cast<int>(ret.error_code()), (ret.message()).c_str());
return ret;
}
conversation->setUnreadMessages(conversationsInfo.at(i).unreadMessages);
PlatformResult ret = FindConversationsPlatform(callback);
if (ret.IsError()) {
- LoggerE("%d (%s)", ret.error_code(), (ret.message()).c_str());
+ LoggerE("%d (%s)", static_cast<int>(ret.error_code()), (ret.message()).c_str());
callback->SetError(ret);
}
PlatformResult ret = FindFoldersPlatform(callback);
if (ret.IsError()) {
- LoggerE("%d (%s)", ret.error_code(), (ret.message()).c_str());
+ LoggerE("%d (%s)", static_cast<int>(ret.error_code()), (ret.message()).c_str());
callback->SetError(ret);
}
PlatformResult ret = RemoveConversationsPlatform(callback);
if (ret.IsError()) {
- LoggerE("%d (%s)", ret.error_code(), (ret.message()).c_str());
+ LoggerE("%d (%s)", static_cast<int>(ret.error_code()), (ret.message()).c_str());
callback->SetError(ret);
}
LoggerD("Loaded body: %s", message->getBody()->getPlainBody().c_str());
} else {
- LoggerE("Unhandled error: %d (%s)!", ret.error_code(), ret.message().c_str());
+ LoggerE("Unhandled error: %d (%s)!", static_cast<int>(ret.error_code()),
+ ret.message().c_str());
LoggerD("[p:%d, m:%d] body is not set", p, m);
}
} else {
bool Message::isMatchingAttributeRange(const std::string& attribute_name, AnyPtr initial_value,
AnyPtr end_value) const {
- ScopeLogger(attribute_name);
+ ScopeLogger("attribute name: %s", attribute_name.c_str());
using namespace MESSAGE_FILTER_ATTRIBUTE;
if (TIMESTAMP == attribute_name) {
bool MessageConversation::isMatchingAttributeRange(const std::string& attribute_name,
AnyPtr initial_value, AnyPtr end_value) const {
- ScopeLogger("attribute_name: " + attribute_name);
+ ScopeLogger("attribute_name: %s", attribute_name.c_str());
using namespace CONVERSATION_FILTER_ATTRIBUTE;
auto ret = callback->getEmailManager().sendMessage(callback);
if (!ret) {
- LoggerE("Error: %d - %s", ret.error_code(), ret.message().c_str());
+ LoggerE("Error: %d - %s", static_cast<int>(ret.error_code()), ret.message().c_str());
}
return FALSE;
const auto ret = callback->getEmailManager().loadMessageAttachment(callback);
if (!ret) {
- LoggerE("Error: %d - %s", ret.error_code(), ret.message().c_str());
+ LoggerE("Error: %d - %s", static_cast<int>(ret.error_code()), ret.message().c_str());
}
}
} else {
auto ret = callback->getShortMsgManager().sendMessage(callback);
if (!ret) {
- LoggerE("Error: %d - %s", ret.error_code(), ret.message().c_str());
+ LoggerE("Error: %d - %s", static_cast<int>(ret.error_code()), ret.message().c_str());
}
return FALSE;
}
LoggerD("[%d] is Message(%p) {", i, message.get());
- LoggerD("[%d] messageId: %d", i, message->getId());
- LoggerD("[%d] message subject: %s", i, message->getSubject().c_str());
- LoggerD("[%d] from: %s", i, message->getFrom().c_str());
+ LoggerD("messageId: %d", message->getId());
+ LoggerD("message subject: %s", message->getSubject().c_str());
+ LoggerD("from: %s", message->getFrom().c_str());
if (message->getBody()) {
const std::string& pBody = message->getBody()->getPlainBody();
- LoggerD("[%d] message plainBody: %s", i, limitedString(pBody).c_str());
+ LoggerD("message plainBody: %s", limitedString(pBody).c_str());
}
- LoggerD("[%d] matched filter: %s", i, matched ? "YES" : "NO");
- LoggerD("[%d] }");
+ LoggerD("matched filter: %s", matched ? "YES" : "NO");
+ LoggerD("}");
}
LoggerD("returning matching %d of %d messages", filtered_messages.size(),
return MSG_ERR_DB_CONNECT;
}
- LoggerD("DB connecting success: [%d]", sqlHandle);
+ LoggerD("DB connecting success: [%p]", sqlHandle);
} else {
- LoggerD("DB connection exists: [%d]", sqlHandle);
+ LoggerD("DB connection exists: [%p]", sqlHandle);
}
return MSG_SUCCESS;
break;
default:
- LoggerE("Unexpected folder ID: %d", folder_id);
+ LoggerE("Unexpected folder ID: %ld", static_cast<long>(folder_id));
folder_id = -1;
break;
}
updated_conv.push_back(cur_conv);
}
- LoggerD("%s conversation with id:%d last_msg_id:d", (new_conv ? "ADDED" : "UPDATED"),
+ LoggerD("%s conversation with id:%d last_msg_id:%d", (new_conv ? "ADDED" : "UPDATED"),
cur_conv->getConversationId(), cur_conv->getLastMessageId());
}
PlatformResult ret = addDraftMessagePlatform(message);
if (ret.IsError()) {
- LoggerE("%d (%s)", ret.error_code(), ret.message().c_str());
+ LoggerE("%d (%s)", static_cast<int>(ret.error_code()), ret.message().c_str());
callback->SetError(ret);
}
}
PlatformResult ret =
MessagingDatabaseManager::getInstance().findShortMessages(callback, &messagesIds);
if (ret.IsError()) {
- LoggerE("Failed to find short message: %s (%d)", ret.message().c_str(), ret.error_code());
+ LoggerE("Failed to find short message: %s (%d)", ret.message().c_str(),
+ static_cast<int>(ret.error_code()));
callback->SetError(ret);
}
"saved MessageConversation(%p) with conv_id:%d",
conv_index, msg_index, cur_msg_id, conv.get(), conv_id);
} else {
- LoggerE("[%d] Couldn't get msg_id, error: %d!", error);
+ LoggerE("[%d] Couldn't get msg_id, error: %s!", error, get_error_message(error));
}
}
} else {
int err = nfc_tag_get_ndef_size(m_last_tag_handle, size);
if (NFC_ERROR_NONE != err) {
- LoggerE("Failed to get tag NDEF size: %d, %s", err);
+ LoggerE("Failed to get tag NDEF size: %d, %s", err, get_error_message(err));
return NFCUtil::CodeToResult(err, "Failed to get tag NDEF size");
}
return PlatformResult(ErrorCode::NO_ERROR);
PlatformResult ret = NFCMessageUtils::ReportNdefMessageFromData(raw_data, size, out);
free(raw_data);
if (ret.IsError()) {
- LoggerE("Error: %d", ret.message().c_str());
+ LoggerE("Error: %s", ret.message().c_str());
NFCMessageUtils::RemoveMessageHandle(message_handle);
return ret;
}
ret = device_led_play_custom(timeOn, timeOff, color, platformFlags);
if (DEVICE_ERROR_NONE != ret) {
return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Cannot play LED custom effect",
- ("Cannot play LED custom effect: ", ret));
+ ("Cannot play LED custom effect: %d", ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
int ret = device_led_stop_custom();
if (DEVICE_ERROR_NONE != ret) {
return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Cannot stop LED custom effect",
- ("Cannot stop LED custom effect: ", ret));
+ ("Cannot stop LED custom effect: %d", ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
}
PlatformResult FMRadioManager::Start(double frequency) {
- ScopeLogger("freq: %d", frequency);
+ ScopeLogger("freq: %lf", frequency);
radio_state_e state;
const auto err = radio_get_state(radio_instance_, &state);
}
SensorData::~SensorData() {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
if (listener_) {
sensor_destroy_listener(listener_);
}
PlatformResult SensorData::CheckInitialization() {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
std::lock_guard<std::mutex> lock(initialization_mutex_);
if (!handle_) {
}
PlatformResult SensorData::IsSupported(bool* supported) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
if (!is_supported_) {
bool is_supported = false;
}
PlatformResult SensorData::IsSupportedImpl(bool* supported) const {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
bool is_supported = false;
int ret = sensor_is_supported(type_enum_, &is_supported);
}
bool SensorData::is_supported() {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
if (!is_supported_) {
bool is_supported = false;
}
bool SensorData::UpdateEvent(sensor_event_s* event) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
if (comparator_(&previous_event_, event, sensor_value_count_)) {
// previous and current events are the same -> no update
PlatformResult SensorData::Start(
const std::shared_ptr<picojson::value>& result,
const std::function<void(const std::shared_ptr<picojson::value>&)>& report_result) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
auto res = CheckInitialization();
if (!res) {
}
PlatformResult SensorData::Stop() {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
auto res = CheckInitialization();
}
PlatformResult SensorData::SetChangeListener(unsigned int interval, unsigned int batch_latency) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
auto res = CheckInitialization();
}
PlatformResult SensorData::UnsetChangeListener() {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
auto res = CheckInitialization();
}
PlatformResult SensorData::GetSensorData(picojson::object* data) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
auto res = CheckInitialization();
}
PlatformResult SensorData::GetHardwareInfo(picojson::object* data) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
auto res = CheckInitialization();
int ret = sensor_get_name(handle_, &name);
if (ret != SENSOR_ERROR_NONE) {
- LoggerE("Failed to sensor_get_name error code: %d", &ret);
+ LoggerE("Failed to sensor_get_name error code: %d", ret);
return native_result(ret);
}
ret = sensor_get_vendor(handle_, &vendor);
if (ret != SENSOR_ERROR_NONE) {
- LoggerE("Failed to sensor_get_vendor error code: %d", &ret);
+ LoggerE("Failed to sensor_get_vendor error code: %d", ret);
return native_result(ret);
}
ret = sensor_get_type(handle_, &type);
if (ret != SENSOR_ERROR_NONE) {
- LoggerE("Failed to sensor_get_type error code: %d", &ret);
+ LoggerE("Failed to sensor_get_type error code: %d", ret);
return native_result(ret);
}
ret = sensor_get_min_range(handle_, &min_range);
if (ret != SENSOR_ERROR_NONE) {
- LoggerE("Failed to sensor_get_min_range error code: %d", &ret);
+ LoggerE("Failed to sensor_get_min_range error code: %d", ret);
return native_result(ret);
}
ret = sensor_get_max_range(handle_, &max_range);
if (ret != SENSOR_ERROR_NONE) {
- LoggerE("Failed to sensor_get_max_range error code: %d", &ret);
+ LoggerE("Failed to sensor_get_max_range error code: %d", ret);
return native_result(ret);
}
ret = sensor_get_resolution(handle_, &resolution);
if (ret != SENSOR_ERROR_NONE) {
- LoggerE("Failed to sensor_get_resolution error code: %d", &ret);
+ LoggerE("Failed to sensor_get_resolution error code: %d", ret);
return native_result(ret);
}
ret = sensor_get_min_interval(handle_, &min_interval);
if (ret != SENSOR_ERROR_NONE) {
- LoggerE("Failed to sensor_get_min_interval error code: %d", &ret);
+ LoggerE("Failed to sensor_get_min_interval error code: %d", ret);
return native_result(ret);
}
ret = sensor_get_max_batch_count(handle_, &max_batch_count);
if (ret != SENSOR_ERROR_NONE) {
- LoggerE("Failed to sensor_get_max_batch_count error code: %d", &ret);
+ LoggerE("Failed to sensor_get_max_batch_count error code: %d", ret);
return native_result(ret);
}
HrmSensorData::HrmSensorData(SensorInstance& instance)
: SensorData(instance, SENSOR_CUSTOM, "HRM_RAW", 1) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
// For amount of retrieved values from sensors please refer to native guides.
AddSensor(new SensorData(instance, SENSOR_HRM_LED_IR, "LED_IR", 1));
AddSensor(new SensorData(instance, SENSOR_HRM_LED_RED, "LED_RED", 1));
}
HrmSensorData::~HrmSensorData() {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
}
void HrmSensorData::AddSensor(SensorData* sensor) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
hrm_sensors_.insert(std::make_pair(sensor->type(), std::shared_ptr<SensorData>(sensor)));
}
PlatformResult HrmSensorData::CallMember(PlatformResult (SensorData::*member)()) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
bool is_any_supported = false;
for (const auto& sensor : hrm_sensors_) {
if (sensor.second->is_supported()) {
const std::function<void(const std::shared_ptr<picojson::value>&)>&),
const std::shared_ptr<picojson::value>& result,
const std::function<void(const std::shared_ptr<picojson::value>&)>& work) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
bool is_any_supported = false;
for (const auto& sensor : hrm_sensors_) {
if (sensor.second->is_supported()) {
}
PlatformResult HrmSensorData::IsSupportedImpl(bool* supported) const {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
bool result = false;
for (const auto& sensor : hrm_sensors_) {
PlatformResult HrmSensorData::Start(
const std::shared_ptr<picojson::value>& result,
const std::function<void(const std::shared_ptr<picojson::value>&)>& work) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
return CallMember(&SensorData::Start, result, work);
}
PlatformResult HrmSensorData::Stop() {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
return CallMember(&SensorData::Stop);
}
PlatformResult HrmSensorData::SetChangeListener(unsigned int interval, unsigned int batch_latency) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
for (const auto& sensor : hrm_sensors_) {
if (sensor.second->is_supported()) {
auto res = sensor.second->SetChangeListener(interval, batch_latency);
}
PlatformResult HrmSensorData::UnsetChangeListener() {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
return CallMember(&SensorData::UnsetChangeListener);
}
PlatformResult HrmSensorData::GetSensorData(picojson::object* data) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
for (const auto& sensor : hrm_sensors_) {
if (sensor.second->is_supported()) {
// HRMRawSensor.getHRMRawSensorData() can return only one value,
}
PlatformResult HrmSensorData::GetHardwareInfo(picojson::object* data) {
- ScopeLogger(type_to_string_map[type()]);
+ ScopeLogger("type: %s", type_to_string_map[type()].c_str());
for (const auto& sensor : hrm_sensors_) {
if (sensor.second->is_supported()) {
return sensor.second->GetHardwareInfo(data);
auto it = max_volume_map_.find(sound_type);
if (it == max_volume_map_.end()) {
return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Failed to find maxVolume",
- ("Failed to find maxVolume of type: %d", type.c_str()));
+ ("Failed to find maxVolume of type: %s", type.c_str()));
}
int max_volume = it->second;