result
AccessoryConditionHandler::Register(_AppLaunchCondition& operation)
{
- SysLog(NID_SYS, "Request to register accessory process");
- __appConditionList.Remove(operation.GetAppId());
- __appConditionList.Add(operation.GetAppId(), operation.GetConditionString());
+ SysLog(NID_SYS, "Request to register accessory process, [%S][%S]", operation.GetAppId().GetPointer(), operation.GetConditionString().GetPointer());
+
+ AppId* pAppId = new (std::nothrow) AppId(operation.GetAppId());
+ String* pCondition = new (std::nothrow) String(operation.GetConditionString());
+
+ __appConditionList.Remove(operation.GetAppId(), true);
+ __appConditionList.Add(*pAppId, *pCondition);
+ //__appConditionList.Add(operation.GetAppId(), operation.GetConditionString());
+
return E_SUCCESS;
}
AccessoryConditionHandler::Unregister(_AppLaunchCondition& operation)
{
SysLog(NID_SYS, "Request to unregister accessory process");
- __appConditionList.Remove(operation.GetAppId());
+ __appConditionList.Remove(operation.GetAppId(), true);
return E_SUCCESS;
}
SysTryCatch(NID_IO, commandValue != null, resultValue = false, E_SYSTEM, "[E_SYSTEM] there is no message command");
- SysLog(NID_IO, "Request command is [%s]", commandValue);
-
pMapEnum = __appConditionList.GetMapEnumeratorN();
SysTryCatch(NID_IO, pMapEnum != null, resultValue = false, E_SYSTEM, "[E_SYSTEM] There is wrong app list");
if (strcmp(commandValue, executionCondition) == 0)
{
//Launch applicaiton.
- r = _AppManagerImpl::GetInstance()->LaunchApplication(*pAppId, null, null, AppManager::LAUNCH_OPTION_DEFAULT);
+ _AppManagerImpl* pAppManagerImpl = _AppManagerImpl::GetInstance();
+
+ if(pAppManagerImpl == null)
+ {
+ SysLog(NID_IO, "Not found AppManager instance");
+ executed = false;
+ break;
+ }
+ r = pAppManagerImpl->LaunchApplication(*pAppId, null, null, AppManager::LAUNCH_OPTION_DEFAULT);
+ SysLog(NID_IO, "Application[%S] launch is requested.", pAppId->GetPointer());
if (r != E_SUCCESS)
{
if (executed == true)
{
- int responseLength = strlen(ACCESSORY_SERIAL_COMMAND_RESPONSE) + strlen(ACCESSORY_SERIAL_COMMAND_SUCCESS) + 5;
+
+ int responseLength = strlen(ACCESSORY_SERIAL_COMMAND_RESPONSE) + strlen(ACCESSORY_SERIAL_COMMAND_SUCCESS) + 6;
response = new (std::nothrow) char[responseLength];
memset(response, 0, responseLength);
}
else
{
- int responseLength = strlen(ACCESSORY_SERIAL_COMMAND_RESPONSE) + strlen(ACCESSORY_SERIAL_COMMAND_FAIL) + 5;
+ int responseLength = strlen(ACCESSORY_SERIAL_COMMAND_RESPONSE) + strlen(ACCESSORY_SERIAL_COMMAND_FAIL) + 6;
response = new (std::nothrow) char[responseLength];
memset(response, 0, responseLength);
SysTryCatch(NID_IO, r == E_SUCCESS, resultValue = true, E_SYSTEM, "[%s] Fail to send data");
CATCH:
- delete [] commandValue;
- delete [] registered;
- delete [] executionCondition;
- delete [] response;
- delete pMapEnum;
+ if(commandValue != null)
+ {
+ delete [] commandValue;
+ }
+ if(registered != null)
+ {
+ delete [] registered;
+ }
+ if(executionCondition != null)
+ {
+ delete [] executionCondition;
+ }
+ if(response != null)
+ {
+ delete [] response;
+ }
+ if(pMapEnum != null)
+ {
+ delete pMapEnum;
+ }
return resultValue;
}