using common::QuotaExceededException;
MessageportInstance::MessageportInstance() {
+ LoggerD("Enter");
using std::placeholders::_1;
using std::placeholders::_2;
#define REGISTER_SYNC(c, x) \
}
MessageportInstance::~MessageportInstance() {
+ LoggerD("Enter");
}
};
static void BundleJsonIterator(const char *k, const char *v, void *d) {
+ LoggerD("Enter");
picojson::value::array *array = static_cast<picojson::value::array *>(d);
picojson::value::object o;
o["key"] = picojson::value(k);
static void OnReceiveLocalMessage(int local_port_id,
const char* remote_app_id, const char* remote_port,
bool trusted_remote_port, bundle* message, void* user_data) {
+
+ LoggerD("Enter");
MessageportInstance* object = static_cast<MessageportInstance*>(user_data);
picojson::value::object o;
picojson::value::array data;
void MessageportInstance::MessagePortManagerRequestlocalmessageport
(const picojson::value& args, picojson::object& out) {
+ LoggerD("Enter");
CHECK_EXIST(args, "localMessagePortName", out)
int portId;
if (portId < 0) {
switch (portId) {
case MESSAGE_PORT_ERROR_INVALID_PARAMETER:
+ LoggerE("The input parameter contains an invalid value");
ReportError(InvalidValuesException
("The input parameter contains an invalid value."), out);
break;
case MESSAGE_PORT_ERROR_OUT_OF_MEMORY:
+ LoggerE("Out of memory");
ReportError(UnknownException("Out of memory."), out);
break;
case MESSAGE_PORT_ERROR_IO_ERROR:
+ LoggerE("Internal I/O error ocurred");
ReportError(UnknownException("Internal I/O error ocurred."), out);
break;
default:
+ LoggerE("Unknown Exception");
ReportError(UnknownException("Unknown Exception"), out);
break;
}
void MessageportInstance::
MessagePortManagerRequesttrustedlocalmessageport
(const picojson::value& args, picojson::object& out) {
+
+ LoggerD("Enter");
CHECK_EXIST(args, "localMessagePortName", out)
int portId;
if (portId < 0) {
switch (portId) {
case MESSAGE_PORT_ERROR_INVALID_PARAMETER:
+ LoggerE("The input parameter contains an invalid value");
ReportError(InvalidValuesException
("The input parameter contains an invalid value."), out);
break;
case MESSAGE_PORT_ERROR_OUT_OF_MEMORY:
+ LoggerE("Out of memory");
ReportError(UnknownException("Out of memory."), out);
break;
case MESSAGE_PORT_ERROR_IO_ERROR:
+ LoggerE("Internal I/O error ocurred");
ReportError(UnknownException("Internal I/O error ocurred."), out);
break;
default:
+ LoggerE("Unknown Exception");
ReportError(UnknownException("Unknown Exception"), out);
break;
}
void MessageportInstance::
MessagePortManagerRequestremotemessageport
(const picojson::value& args, picojson::object& out) {
+ LoggerD("Enter");
CHECK_EXIST(args, "remoteMessagePortName", out)
const std::string& remoteMessagePortName =
if (portCheck) {
ReportSuccess(out);
} else {
+ LoggerE("The port of the target application is not found");
ReportError(
NotFoundException("The port of the target application is not found"),
out);
}
} else if (ret == MESSAGE_PORT_ERROR_INVALID_PARAMETER) {
+ LoggerE("An input parameter contains an invalid value");
ReportError(
InvalidValuesException("An input parameter contains an invalid value."),
out);
} else if (ret == MESSAGE_PORT_ERROR_OUT_OF_MEMORY) {
+ LoggerE("Out of memory");
ReportError(UnknownException("Out of memory."), out);
} else if (ret == MESSAGE_PORT_ERROR_IO_ERROR) {
// IO error means that remote port does not exist
+ LoggerE("The port of the target application is not found");
ReportError(
NotFoundException("The port of the target application is not found"),
out);
NotFoundException("The port of the target application is not found"),
out);
} else {
+ LoggerE("Unknown Error");
ReportError(UnknownException("Unknown Error"), out);
}
}
void MessageportInstance::
MessagePortManagerRequesttrustedremotemessageport
(const picojson::value& args, picojson::object& out) {
+ LoggerD("Enter");
CHECK_EXIST(args, "remoteMessagePortName", out)
const std::string& remoteMessagePortName =
if (portCheck) {
ReportSuccess(out);
} else {
+
+ LoggerE("The port of the target application is not found");
ReportError(
NotFoundException("The port of the target application is not found"),
out);
}
} else if (ret == MESSAGE_PORT_ERROR_INVALID_PARAMETER) {
+ LoggerE("An input parameter contains an invalid value");
ReportError(
InvalidValuesException("An input parameter contains an invalid value."),
out);
} else if (ret == MESSAGE_PORT_ERROR_OUT_OF_MEMORY) {
+ LoggerE("Out of memory");
ReportError(UnknownException("Out of memory."), out);
} else if (ret == MESSAGE_PORT_ERROR_IO_ERROR) {
// IO error means that remote port does not exist
+ LoggerE("The port of the target application is not found");
ReportError(
NotFoundException("The port of the target application is not found"),
out);
NotFoundException("The port of the target application is not found"),
out);
} else if (ret == MESSAGE_PORT_ERROR_CERTIFICATE_NOT_MATCH) {
+ LoggerE("The remote application is not signed with the same certificate");
ReportError(
UnknownException(
"The remote application is not signed with the same certificate"),
out);
} else {
+ LoggerE("Unknown Error");
ReportError(UnknownException("Unknown Error"), out);
}
}
void MessageportInstance::RemoteMessagePortSendmessage
(const picojson::value& args, picojson::object& out) {
+ LoggerD("Enter");
const std::string& appId = args.get("appId").get<std::string>();
const std::string& message_port_name =
args.get("messagePortName").get<std::string>();