Example #1
0
bool PmpPimProtocol::createProfile(iviLink::Profile::Uid const& profileUid,
        iviLink::Profile::IUid const& piuid,
        iviLink::Service::Uid const& sid)
{
    UInt32 size = sizeof(PMPFrame);
    size += stringInBufSize(profileUid.value());
    size += stringInBufSize(piuid.value());
    size += stringInBufSize(sid.value());

    UInt8 * pBuf = new UInt8[size];
    PMPFrame * pReq = reinterpret_cast<PMPFrame*>(pBuf);
    pReq->size = size;
    pReq->reqType = PMP_REQ_PIM_CREATE_PROFILE;

    stringToBuffer(profileUid.value(),pReq->data,true);
    unsigned int pos = stringInBufSize(profileUid.value());
    stringToBuffer(piuid.value(),pReq->data + pos,true);
    pos += stringInBufSize(piuid.value());
    stringToBuffer(sid.value(),pReq->data + pos,true);

    bool res = mPmpProtocol->makePimRequest(*pReq);
    delete [] pReq;

    return res;
}
 CError CAppManPmpIpcClient::applicationRequest(iviLink::Service::SessionUid session, iviLink::Service::Uid service)
 {
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    UInt32 type = 0;
    UInt32 size = sizeof(type) + sizeof(size);
    size += stringInBufSize(session.value());
    size += stringInBufSize(service.value());
    UInt8 * buf = new UInt8[size];
    memcpy(buf,&size,sizeof(size));
    UInt32 pos = sizeof(size);
    memcpy(buf+pos,&type,sizeof(type));
    pos += sizeof(type);
    stringToBuffer(session.value(),buf+pos,false);
    pos += stringInBufSize(session.value());
    stringToBuffer(service.value(),buf+pos,false);
    UInt8 * resp = new UInt8[1];
    UInt32 rSize;
    CError err = mpIpc->request(genId(),buf,size,resp,rSize);
    delete [] buf;
    delete [] resp;
    return err;
 }
Example #3
0
 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();
 }
Example #4
0
void CPIM::incomingProfileInternal(iviLink::Profile::Uid const& profileUid,
      iviLink::Profile::ApiUid const& papiUid,
      iviLink::Profile::IUid const& piuid,
      iviLink::Service::Uid const& serviceUID)
{
   LOG4CPLUS_TRACE_METHOD(logger, __PRETTY_FUNCTION__ + (" uid " + profileUid.value() + " piuid" + piuid.value() + " sid " + serviceUID.value()));

   CPMALComponentMgr* mgr = CPMALComponentMgr::getInstance();
   if (!mgr)
   {
      LOG4CPLUS_ERROR(logger, "!mgr");
      return;
   }

   IProfileManagerCallbacks* clb = mgr->getProfileManagerCallbacks();
   if (!clb)
   {
      LOG4CPLUS_ERROR(logger, "!clb");
      return;
   }

   CError err = clb->serviceRequestCallback(serviceUID);
   if (!err.isNoError())
   {
      LOG4CPLUS_ERROR(logger, static_cast<std::string>(err));
      return;
   }

   mIncomingPrfMapMutex.lock();
   {
      mIncomingPrfMap.insert(std::make_pair(std::make_pair(serviceUID, profileUid), piuid));
   }
   mIncomingPrfMapMutex.unlock();

   clb->incomingProfile(serviceUID, profileUid, papiUid);
}
Example #5
0
CError CPIM::sessionRequest(iviLink::Service::SessionUid session,
   iviLink::Service::Uid service)
{
   LOG4CPLUS_TRACE_METHOD(logger, __PRETTY_FUNCTION__ + (" session " + session.value() + " service " + service.value()));

   CPMALComponentMgr *pMgr = CPMALComponentMgr::getInstance();
   if (pMgr)
   {
      IPMALIpcToPIM* ipc = pMgr->getIpcToPIM();
      if (ipc)
      {
         CError err = ipc->readyToServe(session);
         if (!err.isNoError())
         {
            LOG4CPLUS_ERROR(logger, static_cast<std::string>(err));
         }

         return err;
      }
      return CError(1, gModuleName, CError::ERROR, "sessionRequest() no ipc");
   }
   return CError(1, gModuleName, CError::ERROR, "sessionRequest() no manager");
}
Example #6
0
void CPIM::incomingProfile(iviLink::CUid const& profileUid,
         iviLink::Profile::ApiUid const& papiUid,
         iviLink::Profile::IUid const& piuid,
         iviLink::Service::Uid const& serviceUID)
{
   LOG4CPLUS_TRACE_METHOD(logger, __PRETTY_FUNCTION__ + (" uid " + profileUid.value() + " piuid" + piuid.value() + " sid " + serviceUID.value()));
   // Here is the thread border - to return the code flow to the ipc as
   // fast as possible
   CIncomingProfileJobData* data = new CIncomingProfileJobData(this, profileUid, papiUid, piuid, serviceUID);
   CThreadPoolJob job(CPIMJobStarter::incomingProfile, data);
   mpThreadPool->addJob(job);
}
Example #7
0
void CAppImplementation::onServiceLoadError(const iviLink::Service::Uid &service)
{
    LOG4CPLUS_TRACE_METHOD(mLog, __PRETTY_FUNCTION__);
    callStringVoidMethod(service.value(), midServiceLoadError);
}
Example #8
0
void CAppImplementation::onIncomingServiceAfterLoading(const iviLink::Service::Uid &service)
{
    LOG4CPLUS_TRACE_METHOD(mLog, __PRETTY_FUNCTION__);
    callStringVoidMethod(service.value(), midIncomingServiceAfterLoading);
}