예제 #1
0
bool PmpIpcProtocol::findProfilesResponse(const std::list<iviLink::Profile::Uid> & profiles,
        iviLink::Ipc::DirectionID const& dirId)
{
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );

    CBuffer writeBuf = mWriteBufMgr.getBuffer();
    ProfileManager::Ipc::PmMessage* req = reinterpret_cast<ProfileManager::Ipc::PmMessage*>(writeBuf.get());
    req->header.type = ProfileManager::Ipc::PMP_PMAL_FIND_PROFILES;
    iviLink::Ipc::Helpers::CBufferWriter writer(req->data, writeBuf.getSize() - sizeof(req->header));

    BaseError err = writer.write(profiles.begin(), profiles.end());
    if (!err.isNoError())
    {
        LOG4CPLUS_ERROR(msLogger, static_cast<std::string>(err));
        return false;
    }

    req->header.size = writer.getUsedSize();
    iviLink::Ipc::MsgID id = mMsgIdGen.getNext();

    UInt32 const reqSize = sizeof(ProfileManager::Ipc::PmMessage) + req->header.size;

    err = mIpc->asyncRequest(id, writeBuf.get(), reqSize, &dirId);

    if (!err.isNoError())
    {
        LOG4CPLUS_ERROR(msLogger, static_cast<std::string>(err));
        return false;
    }

    return true;
}
예제 #2
0
bool PmpIpcProtocol::incomingProfile(iviLink::BaseUid const& profileUid,
         iviLink::Profile::ApiUid const& papiUid,
         iviLink::Profile::IUid const& piuid,
         iviLink::Service::Uid const& serviceUID,
         iviLink::Ipc::DirectionID const& dirId)
{
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );

    CBuffer writeBuf = mWriteBufMgr.getBuffer();
    ProfileManager::Ipc::PmMessage* req = reinterpret_cast<ProfileManager::Ipc::PmMessage*>(writeBuf.get());
    req->header.type = ProfileManager::Ipc::PMP_PMAL_INCOMMING_PROFILE;

    iviLink::Ipc::Helpers::CBufferWriter writer(req->data, writeBuf.getSize() - sizeof(req->header));

    BaseError err = writer.write(profileUid);
    if (!err.isNoError())
    {
    LOG4CPLUS_ERROR(msLogger, static_cast<std::string>(err));
    return false;
    }

    err = writer.write(papiUid);
    if (!err.isNoError())
    {
    LOG4CPLUS_ERROR(msLogger, static_cast<std::string>(err));
    return false;
    }

    err = writer.write(piuid);
    if (!err.isNoError())
    {
    LOG4CPLUS_ERROR(msLogger, static_cast<std::string>(err));
    return false;
    }

    err = writer.write(serviceUID);
    if (!err.isNoError())
    {
    LOG4CPLUS_ERROR(msLogger, static_cast<std::string>(err));
    return false;
    }

    req->header.size = writer.getUsedSize();

    iviLink::Ipc::MsgID id = mMsgIdGen.getNext();

    UInt32 const reqSize = sizeof(ProfileManager::Ipc::PmMessage) + req->header.size;
    err = mIpc->asyncRequest(id, writeBuf.get(), reqSize, &dirId);
    return err.isNoError();
}