//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
_RemoteMessagePortImpl::SendMessage(const IMap* pMessage)
{
SysTryReturnResult(NID_IO, pMessage != null, E_INVALID_ARG, "The argument is null.");
- SysTryReturnResult(NID_IO, CheckMessageType(pMessage), E_INVALID_ARG, "The argument is invalid.");
return _MessagePortProxy::GetProxy()->SendMessage(__remoteAppId, __remotePort, __isTrusted, (HashMap*)pMessage);
}
{
SysTryReturnResult(NID_IO, pLocalMessagePort != null, E_INVALID_ARG, "The argument is null.");
SysTryReturnResult(NID_IO, pMessage != null, E_INVALID_ARG, "The argument is null.");
- SysTryReturnResult(NID_IO, CheckMessageType(pMessage), E_INVALID_ARG, "The argument is invalid.");
return _MessagePortProxy::GetProxy()->SendMessage(pLocalMessagePort->GetName(), pLocalMessagePort->IsTrusted(), __remoteAppId, __remotePort, __isTrusted, (HashMap*)pMessage);
}
-bool
-_RemoteMessagePortImpl::CheckMessageType(const IMap* pMessage)
-{
- std::unique_ptr<IMapEnumerator> pEnum (pMessage->GetMapEnumeratorN());
- while(pEnum->MoveNext() == E_SUCCESS)
- {
- const String* pKey = dynamic_cast<const String*>(pEnum->GetKey());
- const Object* pValue = pEnum->GetValue();
-
- if (pKey && pValue)
- {
- if (typeid(*pValue) != typeid(const String))
- {
- if (typeid(*pValue) != typeid(const ByteBuffer))
- {
- return false;
- }
- }
- }
- else
- {
- return false;
- }
- }
-
- return true;
-}
-
RemoteMessagePort*
_RemoteMessagePortImpl::GetMessagePort(const AppId& remoteAppId, const String& remotePort, bool isTrusted)
{
SysTryCatch(NID_IO, pImpl != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
r = pImpl->Construct(remoteAppId, remotePort, isTrusted);
- //SysTryCatch(NID_IO, r != E_OBJ_NOT_FOUND, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The remote message port is not found.");
- //SysTryCatch(NID_IO, r != E_CERTIFICATE_VERIFICATION_FAILED, , E_CERTIFICATE_VERIFICATION_FAILED, "[E_CERTIFICATE_VERIFICATION_FAILED] The target application is not signed with the same certificate.");
SysTryCatch(NID_IO, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
pRemoteMessagePort->__pRemoteMessagePortImpl = pImpl.release();