{
int err = MSG_SUCCESS;
result r = E_SUCCESS;
- CbsChannel* pCbsChannel = NULL;
+ CbsChannel* pCbsChannel = null;
+ int fromId = 0;
+ int toId = 0;
+ bool channelFound = false;
+ SysLog(NID_MSG, "AddCbsChannel from %d to %d name %s activate %d ",from, to, name.GetPointer(), activate);
+
+ for (int index = 0; index < __pTempCbsChannelList->GetCount(); index++)
+ {
+ CbsChannel* pCbsChannel = null;
+ pCbsChannel = dynamic_cast< Tizen::Messaging::CbsChannel* >(__pTempCbsChannelList->GetAt(index));
+ SysTryReturn(NID_MSG, pCbsChannel != null, r = E_SYSTEM, E_SYSTEM, "Failed to get the channel.");
+
+ pCbsChannel->GetRange(fromId, toId);
+ if (from == fromId && to == toId && pCbsChannel->GetName() == name)
+ {
+ channelFound = true;
+ _CbsChannelImpl::GetInstance(*pCbsChannel)->SetCbsChannelState(activate);
+ break; // found channel to be updated.
+ }
+
+
+ }
+
+ if (!channelFound)
+ {
+ CbsChannel* pCbsChannel = null;
pCbsChannel = _CbsChannelImpl::GetCbsChannelN(from, to, name);
SysTryReturn(NID_MSG, pCbsChannel != null, r = E_SYSTEM, E_SYSTEM, "Failed to get the channel.");
{
_CbsChannelImpl::GetInstance(*pCbsChannel)->SetCbsChannelState(activate);
}
-
r =__pTempCbsChannelList->Add(*pCbsChannel);
+ SysTryReturn(NID_MSG,r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "Failed to set the channel.");
+
+ }
+
- err = SaveCbsSettings();
- r = ConvertException(err);
+
+ r = SaveCbsSettings();
return r;
}
int toId = 0;
bool channelFound = false;
CbsChannel* pCbsChannel = NULL;
+ SysLog(NID_MSG, "RemoveCbsChannel from %d %d ",from, to);
for (int index = 0; index < __pTempCbsChannelList->GetCount(); index++)
{
{
channelFound = true; // found channel to be removed.
__pTempCbsChannelList->RemoveAt(index);
-
- err = SaveCbsSettings();
- r = ConvertException(err);
+ index--;
delete pCbsChannel;
- break;
+
}
}
+
if (!channelFound)
{
return E_OBJ_NOT_FOUND;
}
+ r = SaveCbsSettings();
+ SysTryReturn(NID_MSG, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "Failed to remove the channel.");
return r;
}
int toId = 0;
bool channelFound = false;
CbsChannel* pCbsChannel = NULL;
+ SysLog(NID_MSG, "SearchCbsChannel from %d %d ",from, to);
for (int tempIndex = 0; tempIndex < __pTempCbsChannelList->GetCount(); tempIndex++)
{
int fromId = 0;
int toId = 0;
bool channelFound = false;
+ int index = 0;
CbsChannel* pCbsChannel = NULL;
+ SysLog(NID_MSG, "UpdateCbsChannel from %d to %d name %s activate %d ",from, to, name.GetPointer(), activate);
- for (int index = 0; index < __pTempCbsChannelList->GetCount(); index++)
+ for (int i = 0; i < __pTempCbsChannelList->GetCount(); i++)
{
- pCbsChannel = dynamic_cast< Tizen::Messaging::CbsChannel* >(__pTempCbsChannelList->GetAt(index));
+ pCbsChannel = dynamic_cast< Tizen::Messaging::CbsChannel* >(__pTempCbsChannelList->GetAt(i));
SysTryReturn(NID_MSG, pCbsChannel != null, r = E_SYSTEM, E_SYSTEM, "Failed to get the channel.");
pCbsChannel->GetRange(fromId, toId);
if (from == fromId && to == toId)
{
channelFound = true;
+ index = i;
break; // found channel to be updated.
}
}
{
_CbsChannelImpl::GetInstance(*pCbsChannel)->SetCbsChannelState(false);
}
+ //For changing to latest
+ __pTempCbsChannelList->RemoveAt(index);
+ __pTempCbsChannelList->Add(*pCbsChannel);
+
+ r = SaveCbsSettings();
+ SysTryReturn(NID_MSG, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "Failed to save the channel.");
- err = SaveCbsSettings();
- r = ConvertException(err);
return r;
}