BaseError CServiceManager::incomingProfile(Service::Uid const& service, Profile::Uid const& profile, Profile::ApiUid const& api) { LOG4CPLUS_TRACE(msLogger, "CServiceManager::incomingProfileRequest()=> requested profile " + profile.value() +"for service"+service.value() ); mActiveServicesMutex.lock(); tServiceMap::iterator it = mActiveServices.find(service); if (mActiveServices.end() == it) { mActiveServicesMutex.unlock(); return BaseError(1,"ServiceManager",BaseError::IVILINK_ERROR,"Can't load incoming profile"); } ERROR_CODE err = it->second->incomingProfileRequest(profile,api); bool allLoaded = it->second->allLoaded(); mActiveServicesMutex.unlock(); if (ERR_OK != err) { if (mpClient) { LOG4CPLUS_ERROR(msLogger, service.value() + ": error " + convertIntegerToString(int(err)) + "in incomingProfileRequest(" + profile.value() + ","+ api.value() + ")"); mpClient->serviceLoadError(service); } unload(service); return BaseError(1,gModuleName, BaseError::IVILINK_ERROR, "incomingProfile-Error"); } if (allLoaded && mpClient) { mpClient->serviceLoaded(service); } return BaseError::NoError(gModuleName, "incomingProfile-No_Error"); }
BaseError CServiceManager::initPmal() { LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__); AppMan::CAppManConnectController * pAppmanCC = AppMan::CAppManConnectController::instance(mAppInfo); PMAL::CPMALError err = PMAL::CPMALComponentMgr::create(this, NULL); if (!err.isNoError()) { return err; } PMAL::CPMALComponentMgr* pPmalMgr = PMAL::CPMALComponentMgr::getInstance(); if (!pAppmanCC) { return BaseError(1, gModuleName, BaseError::IVILINK_FATAL, "unable to get app man connect controller"); } iviLink::AppMan::IAppManHandler* pHandler = pPmalMgr->getAppManHandler(); if (!pHandler) { LOG4CPLUS_WARN(msLogger, "unable to get app man handler"); return BaseError(1, gModuleName, BaseError::IVILINK_FATAL, "unable to get app man handler"); } pAppmanCC->init(pHandler); return BaseError::NoError(); }
BaseError AppManMsgProxy::send_notify(eSCtoAMMessages notify_code) { if (!mpIpc) return BaseError(1, getName(), BaseError::IVILINK_FATAL, "no ipc"); const Message msg = { { notify_code, 0 } }; return mpIpc->asyncRequest(mMsgIdGen.getNext(), reinterpret_cast<const UInt8*>(&msg), sizeof(msg)); }
BaseError AuthenticationAppMsgProxy::requestShutDown() { LOG4CPLUS_TRACE_METHOD(logger, __PRETTY_FUNCTION__); if (!mpIpc) return BaseError(1, getName(), BaseError::IVILINK_FATAL, "no ipc"); AuthenticationMessage* req = reinterpret_cast<AuthenticationMessage*>(mWriteBuffer); req->requestType = SC_AA_DIE; iviLink::Ipc::MsgID id = mMsgIdGen.getNext(); UInt32 const reqSize = sizeof(Message); return mpIpc->asyncRequest(id, mWriteBuffer, reqSize); }
BaseError SystemControllerMsgProxy::sendRequest(NegotiatorToSystemController requestType) { if (!mpIpc) return BaseError(1, getName(), BaseError::IVILINK_FATAL, "no ipc"); Message* req = reinterpret_cast<Message*>(mWriteBuffer); req->header.type = requestType; req->header.size = 0; iviLink::Ipc::MsgID id = mMsgIdGen.getNext(); UInt32 const reqSize = sizeof(Message) + req->header.size; UInt32 respSize = 0; return mpIpc->request(id, mWriteBuffer, reqSize, mReadBuffer, respSize); }
BaseError SystemControllerMsgProxy::requestConnectionLost() { if (!mSystemCtrlIpc) return BaseError(1, getName(), BaseError::IVILINK_FATAL, "no ipc"); Message* req = reinterpret_cast<Message*>(mWriteBuffer); req->header.type = CA_SC_CONNECTION_LOST; req->header.size = 0; iviLink::Ipc::MsgID id = mMsgIdGen.getNext(); UInt32 const reqSize = sizeof(Message) + req->header.size; UInt32 respSize = 0; return mSystemCtrlIpc->request(id, mWriteBuffer, reqSize, mReadBuffer, respSize); }
BaseError ConnectivityAgentMsgProxy::requestShutDown() { LOG4CPLUS_TRACE_METHOD(logger, __PRETTY_FUNCTION__); if (!mpIpc) return BaseError(1, getName(), BaseError::IVILINK_FATAL, "no ipc"); Message* req = reinterpret_cast<Message*>(mWriteBuffer); req->header.type = SC_CA_SHUTDOWN; req->header.size = 0; iviLink::Ipc::MsgID id = mMsgIdGen.getNext(); UInt32 const reqSize = sizeof(Message) + req->header.size; UInt32 respSize = 0; return mpIpc->request(id, mWriteBuffer, reqSize, mReadBuffer, respSize); }
BaseError CServiceManager::serviceRequestCallback(iviLink::Service::Uid const& service) { LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__); if (mpClient) { if(!isServiceAlreadyLoaded(service)) { mpClient->serviceRequestCallback(service); } } if (!incomingLoad(service)) { if (mpClient) { LOG4CPLUS_ERROR(msLogger, service.value() + ": " + "Failed to load incoming service" ); mpClient->serviceLoadError(service); } return BaseError(1, gModuleName, BaseError::IVILINK_ERROR, "Can't load incoming service"); } return BaseError::NoError(); }
BaseError SystemControllerMsgProxy::requestConnectionEstablished(UInt8 gender) { if (!mSystemCtrlIpc) return BaseError(1, getName(), BaseError::IVILINK_FATAL, "no ipc"); Message* req = reinterpret_cast<Message*>(mWriteBuffer); req->header.type = CA_SC_CONNECTION_ESTABLISHED; CBufferWriter writer(req->data, BUFFER_SIZE); BaseError err = writer.write(gender); if (!err.isNoError()) return err; req->header.size = writer.getUsedSize(); iviLink::Ipc::MsgID id = mMsgIdGen.getNext(); UInt32 const reqSize = sizeof(Message) + req->header.size; UInt32 respSize = 0; return mSystemCtrlIpc->request(id, mWriteBuffer, reqSize, mReadBuffer, respSize); }
BaseError AppManMsgProxy::requestShutDown() { LOG4CPLUS_TRACE_METHOD(logger, __PRETTY_FUNCTION__); if (!mpIpc) return BaseError(1, getName(), BaseError::IVILINK_FATAL, "no ipc"); Message* req = reinterpret_cast<Message*>(mWriteBuffer); req->header.type = SC_AM_SHUTDOWN; req->header.size = 0; iviLink::Ipc::MsgID id = mMsgIdGen.getNext(); UInt32 const reqSize = sizeof(Message) + req->header.size; BaseError err = mpIpc->asyncRequest(id, mWriteBuffer, reqSize); if (!err.isNoError()) return err; return BaseError::NoError(getName()); }
virtual BaseError onCounterAMDisconnected(){return BaseError(BaseError::IVILINK_NO_ERROR, "CSystemStateMachine");}