#include "FIo_ChannelService.h"
#include "FIo_ChannelMessages.h"
#include "FIo_IChannelServiceStub.h"
-#include "FIo_ChannelCAppStub.h"
-using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
using namespace Tizen::Base::Runtime;
{
static _StringHashProvider hashProvider;
static _StringComparer stringComparer;
- result r = E_SUCCESS;
__channels.Construct(0, 0, hashProvider, stringComparer);
__pIChannelServiceStub->SetChannelService(*this);
- // Create a CAppStub
- unique_ptr<_ChannelCAppStub> pCStub(new (std::nothrow) _ChannelCAppStub());
- SysTryReturnResult(NID_IO, pCStub != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-
- r = pCStub->Construct();
- SysTryReturnResult(NID_IO, r == E_SUCCESS, E_SYSTEM, "Failed to create a CAppStub.");
-
- pCStub->SetChannelService(*this);
-
- pCStub.release();
-
return E_SUCCESS;
}
}
result
-_ChannelService::RegisterChannel(const String& channelId, int clientId, unsigned int type)
+_ChannelService::RegisterChannel(const String& channelId, int clientId)
{
result r = E_SUCCESS;
_ChannelInfo* pChannelInfo = null;
pChannelInfo->channelId = channelId;
pChannelInfo->clientId = clientId;
- pChannelInfo->type = type;
pChannelInfo->pGIOChannel = null;
__channels.Add(channelId, pChannelInfo);
}
result
-_ChannelService::RegisterChannel(const String& channelId, int clientId, void* pGIOChannel)
-{
- result r = E_SUCCESS;
- _ChannelInfo* pChannelInfo = null;
-
- SysLog(NID_IO, "Register a channel : [%ls]", channelId.GetPointer());
-
- r = __channels.GetValue(channelId, pChannelInfo);
- if (pChannelInfo != null)
- {
- SysTryReturnResult(NID_IO, pChannelInfo->clientId != clientId, E_SYSTEM, "Channel has already been registered.");
-
- SysLog(NID_IO, "Remove garbage values : %ls", channelId.GetPointer());
- __channels.Remove(channelId);
- }
-
- pChannelInfo = new (std::nothrow) _ChannelInfo;
- SysTryReturnResult(NID_IO, pChannelInfo != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-
- pChannelInfo->channelId = channelId;
- pChannelInfo->clientId = clientId;
- pChannelInfo->type = CAPP_CHANNEL;
- pChannelInfo->pGIOChannel = pGIOChannel;
-
- __channels.Add(channelId, pChannelInfo);
-
- return E_SUCCESS;
-}
-
-result
_ChannelService::UnregisterChannel(const String& channelId)
{
return E_SUCCESS;
result
_ChannelService::UnregisterChannel(int clientId)
{
- SysLog(NID_IO, "Unregister - clientId = %d", clientId);
+ SysLog(NID_IO, "Unregister - client = %d", clientId);
result r = E_OBJ_NOT_FOUND;
__channels.GetValue(key, pValue);
if (pValue != null && pValue->clientId == clientId)
{
- SysLog(NID_IO, "Unregister - ChannelId = %ls", key.GetPointer());
+ SysLog(NID_IO, "Unregister - Channel = %ls", key.GetPointer());
__channels.Remove(key);
delete pValue;
const ArrayList& args,
int requestId)
{
- SysLog(NID_IO, "[%ls] ---> [%ls], Request ID = %d", src.GetPointer(), dest.GetPointer(), requestId);
+ SysLog(NID_IO, "[%ls] ---> [%ls], Request = %d", src.GetPointer(), dest.GetPointer(), requestId);
_ChannelInfo* pChannelInfo = null;
const String& dest,
int requestId)
{
- SysLog(NID_IO, "[%ls] ---> [%ls], Request ID = %d", src.GetPointer(), dest.GetPointer(), requestId);
+ SysLog(NID_IO, "[%ls] ---> [%ls], Request = %d", src.GetPointer(), dest.GetPointer(), requestId);
_ChannelInfo* pChannelInfo = null;
const ArrayList& args,
int requestId)
{
- SysLog(NID_IO, "[%ls] ---> [%ls], Request ID = %d", src.GetPointer(), dest.GetPointer(), requestId);
+ SysLog(NID_IO, "[%ls] ---> [%ls], Request = %d", src.GetPointer(), dest.GetPointer(), requestId);
_ChannelInfo* pChannelInfo = null;
SysTryReturnResult(NID_IO, pChannelInfo != null, E_OBJ_NOT_FOUND,
"Destination channel not found.");
- // Channel for CApp
- if (pChannelInfo->type == CAPP_CHANNEL)
- {
- bool ret = _ChannelCAppStub::SendResponse(requestId, pChannelInfo->pGIOChannel, args);
- SysTryReturnResult(NID_IO, ret, E_SYSTEM, "Failed to send the data to a CApp.");
- }
- // Channel for OspApp
- else
- {
- result r = __pIChannelServiceStub->SendResponse(pChannelInfo->clientId, src, dest, args, requestId);
- SysTryReturnResult(NID_IO, r == E_SUCCESS, E_SYSTEM, "Failed to send the response data");
- }
+ result r = __pIChannelServiceStub->SendResponse(pChannelInfo->clientId, src, dest, args, requestId);
+ SysTryReturnResult(NID_IO, r == E_SUCCESS, E_SYSTEM, "Failed to send the response data");
return E_SUCCESS;
}
const String& dest,
int requestId)
{
- SysLog(NID_IO, "[%ls] ---> [%ls], Request ID = %d", src.GetPointer(), dest.GetPointer(), requestId);
+ SysLog(NID_IO, "[%ls] ---> [%ls], Request = %d", src.GetPointer(), dest.GetPointer(), requestId);
_ChannelInfo* pChannelInfo = null;