}
std::string state_str;
- PlatformResult result = Types::PlatformEnumToString(Types::kMediaControllerServerState,
- static_cast<int>(state), &state_str);
+ PlatformResult result = types::MediaControllerServerStateEnum.getName(state, &state_str);
if (!result) {
- LoggerE("PlatformEnumToString failed, error: %s", result.message().c_str());
+ LoggerE("MediaControllerServerStateEnum.getName() failed, error: %s", result.message().c_str());
return result;
}
// playback state
std::string state;
- PlatformResult result = Types::ConvertPlaybackState(playback_h, &state);
+ PlatformResult result = types::ConvertPlaybackState(playback_h, &state);
if (!result) {
LoggerE("ConvertPlaybackState failed, error: %s", result.message().c_str());
return result;
// playback position
double position;
- result = Types::ConvertPlaybackPosition(playback_h, &position);
+ result = types::ConvertPlaybackPosition(playback_h, &position);
if (!result) {
LoggerE("ConvertPlaybackPosition failed, error: %s", result.message().c_str());
return result;
// content age rating
std::string rating;
- result = Types::ConvertContentAgeRating(playback_h, &rating);
+ result = types::ConvertContentAgeRating(playback_h, &rating);
if (!result) {
LoggerE("ConvertContentAgeRating failed, error: %s", result.message().c_str());
return result;
(*playback_info)["index"] = picojson::value(std::string(index ? index : ""));
(*playback_info)["playlistName"] =
picojson::value(std::string(playlist_name ? playlist_name : ""));
- ;
return PlatformResult(ErrorCode::NO_ERROR);
}
mc_metadata_destroy(metadata_h);
};
- PlatformResult result = Types::ConvertMetadata(metadata_h, metadata);
+ PlatformResult result = types::ConvertMetadata(metadata_h, metadata);
if (!result) {
return result;
}
// server state
std::string state_str;
- PlatformResult result = Types::PlatformEnumToString(Types::kMediaControllerServerState,
- static_cast<int>(state), &state_str);
+ PlatformResult result = types::MediaControllerServerStateEnum.getName(state, &state_str);
if (!result) {
- LoggerE("PlatformEnumToString failed, error: %s", result.message().c_str());
+ LoggerE("MediaControllerServerStateEnum.getName() failed, error: %s", result.message().c_str());
return;
}
// playback state
std::string state;
- PlatformResult result = Types::ConvertPlaybackState(playback, &state);
+ PlatformResult result = types::ConvertPlaybackState(playback, &state);
if (!result) {
LoggerE("ConvertPlaybackState failed, error: %s", result.message().c_str());
return;
// playback position
double position;
- result = Types::ConvertPlaybackPosition(playback, &position);
+ result = types::ConvertPlaybackPosition(playback, &position);
if (!result) {
LoggerE("ConvertPlaybackPosition failed, error: %s", result.message().c_str());
return;
data_o["mode"] = picojson::value(mode == MC_REPEAT_MODE_ON);
client->playback_info_listener_(&data);
}
- std::string state{};
- PlatformResult result = Types::PlatformEnumToString(Types::kMediaControllerRepeatState,
- static_cast<int>(mode), &state);
+ std::string state;
+ PlatformResult result = types::MediaControllerRepeatModeEnum.getName(mode, &state);
if (!result) {
- LoggerE("PlatformEnumToString failed, error: %s", result.message().c_str());
+ LoggerE("MediaControllerRepeatModeEnum.getName() failed, error: %s", result.message().c_str());
return;
}
data_o["action"] = picojson::value(std::string("onrepeatstatechanged"));
picojson::object& data_o = data.get<picojson::object>();
picojson::value metadata = picojson::value(picojson::object());
- PlatformResult result = Types::ConvertMetadata(metadata_h, &metadata.get<picojson::object>());
+ PlatformResult result = types::ConvertMetadata(metadata_h, &metadata.get<picojson::object>());
if (!result) {
LoggerE("ConvertMetadata failed, error: %s", result.message().c_str());
return;
PlatformResult MediaControllerClient::SendPlaybackState(const std::string& server_name,
const std::string& state) {
ScopeLogger();
- int state_e;
// In Native API, since Tizen 5.0 an action instead of a state is sent to change the state of a
// server. In Web API the names were not refactored.
- PlatformResult result =
- Types::StringToPlatformEnum(Types::kMediaControllerPlaybackAction, state, &state_e);
+ mc_playback_action_e action_e;
+ PlatformResult result = types::MediaControllerPlaybackActionEnum.getValue(state, &action_e);
if (!result) {
return result;
}
SCOPE_EXIT {
free(request_id);
};*/
- int ret;
- ret = mc_client_send_playback_action_cmd(handle_, server_name.c_str(),
- static_cast<mc_playback_action_e>(state_e),
- /*&request_id*/ nullptr);
+ int ret = mc_client_send_playback_action_cmd(handle_, server_name.c_str(), action_e, nullptr);
if (MEDIA_CONTROLLER_ERROR_NONE != ret) {
return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Error sending playback state",
("mc_client_send_playback_action_cmd() error: %d, message: %s", ret,
SCOPE_EXIT {
free(request_id);
};*/
- int state_e;
- PlatformResult result =
- Types::StringToPlatformEnum(Types::kMediaControllerRepeatState, state, &state_e);
+ mc_repeat_mode_e state_e;
+ PlatformResult result = types::MediaControllerRepeatModeEnum.getValue(state, &state_e);
if (!result) {
return result;
}
- int ret = mc_client_send_repeat_mode_cmd(handle_, server_name.c_str(),
- static_cast<mc_repeat_mode_e>(state_e),
- /*&request_id*/ nullptr);
+
+ int ret = mc_client_send_repeat_mode_cmd(handle_, server_name.c_str(), state_e, nullptr);
if (MEDIA_CONTROLLER_ERROR_NONE != ret) {
return LogAndCreateResult(
ErrorCode::UNKNOWN_ERR, "Error sending repeat state",
const std::string& state, double position) {
ScopeLogger();
- int state_e;
// In Native API, since Tizen 5.0 an action instead of a state is sent to change the state of a
// server. In Web API the names were not refactored.
- PlatformResult result =
- Types::StringToPlatformEnum(Types::kMediaControllerPlaybackAction, state, &state_e);
-
+ mc_playback_action_e action_e;
+ PlatformResult result = types::MediaControllerPlaybackActionEnum.getValue(state, &action_e);
if (!result) {
return result;
}
+ auto position_ull = static_cast<unsigned long long>(position);
int ret = mc_client_send_playlist_cmd(handle_, name.c_str(), playlist_name.c_str(), index.c_str(),
- static_cast<mc_playback_action_e>(state_e),
- static_cast<unsigned long long>(position), nullptr);
+ action_e, position_ull, nullptr);
if (MEDIA_CONTROLLER_ERROR_NONE != ret) {
return LogAndCreateResult(