void MediaControllerClient::OnServerStatusUpdate(const char* server_name,
mc_server_state_e state,
void* user_data) {
- LOGGER(DEBUG) << "entered";
MediaControllerClient* client = static_cast<MediaControllerClient*>(user_data);
const picojson::value& data,
const std::string& reply_id,
const JsonCallback& reply_cb) {
- LOGGER(DEBUG) << "entered";
-
- int ret;
bundle* bundle = bundle_create();
SCOPE_EXIT {
bundle_free(bundle);
};
+ int ret;
ret = bundle_add(bundle, "replyId", reply_id.c_str());
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
LOGGER(ERROR) << "bundle_add(replyId) failed, error: " << ret;
int result_code,
bundle* bundle,
void* user_data) {
- LOGGER(DEBUG) << "entered";
MediaControllerClient* client = static_cast<MediaControllerClient*>(user_data);
PlatformResult MediaControllerClient::SendPlaybackState(
const std::string& server_name,
const std::string& state) {
- LOGGER(DEBUG) << "entered";
-
- int ret;
int state_e;
PlatformResult result = Types::StringToPlatformEnum(
return result;
}
+ int ret;
ret = mc_client_send_playback_state_command(
handle_, server_name.c_str(), static_cast<mc_playback_states_e>(state_e));
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
return;
}
- // TODO(r.galka) check privileges
+ CHECK_PRIVILEGE_ACCESS(kPrivilegeMediaControllerServer, &out);
server_ = std::make_shared<MediaControllerServer>();
const PlatformResult& result = server_->Init();
void MediaControllerInstance::MediaControllerServerAddChangeRequestPlaybackInfoListener(
const picojson::value& args,
picojson::object& out) {
- LOGGER(DEBUG) << "entered";
if (!server_) {
ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR,
void MediaControllerInstance::MediaControllerServerRemoveChangeRequestPlaybackInfoListener(
const picojson::value& args,
picojson::object& out) {
- LOGGER(DEBUG) << "entered";
if (!server_) {
ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR,
void MediaControllerInstance::MediaControllerServerAddCommandListener(
const picojson::value& args,
picojson::object& out) {
- LOGGER(DEBUG) << "entered";
if (!server_) {
ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR,
}
JsonCallback on_command = [this, args](picojson::value* request) -> void {
- LOGGER(DEBUG) << "entered";
picojson::object& request_o = request->get<picojson::object>();
request_o["listenerId"] = args.get("listenerId");
void MediaControllerInstance::MediaControllerServerReplyCommand(
const picojson::value& args,
picojson::object& out) {
- LOGGER(DEBUG) << "entered";
if (!server_) {
ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR,
void MediaControllerInstance::MediaControllerServerRemoveCommandListener(
const picojson::value& args,
picojson::object& out) {
- LOGGER(DEBUG) << "entered";
if (!server_) {
ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR,
return;
}
- // TODO(r.galka) check privileges
+ CHECK_PRIVILEGE_ACCESS(kPrivilegeMediaControllerClient, &out);
client_ = std::make_shared<MediaControllerClient>();
const PlatformResult& result = client_->Init();
CHECK_EXIST(args, "data", out)
JsonCallback reply_cb = [this, args](picojson::value* reply) -> void {
- LOGGER(DEBUG) << "entered";
picojson::object& reply_obj = reply->get<picojson::object>();
void MediaControllerInstance::MediaControllerServerInfoAddServerStatusChangeListener(
const picojson::value& args,
picojson::object& out) {
- LOGGER(DEBUG) << "entered";
if (!client_) {
ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR,
CHECK_EXIST(args, "listenerId", out)
JsonCallback callback = [this, args](picojson::value* data) -> void {
- LOGGER(DEBUG) << "entered";
if (nullptr == data) {
LOGGER(ERROR) << "No data passed to json callback";
void MediaControllerInstance::MediaControllerServerInfoRemoveServerStatusChangeListener(
const picojson::value& args,
picojson::object& out) {
- LOGGER(DEBUG) << "entered";
if (!client_) {
ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR,