本文整理汇总了C++中BaseError类的典型用法代码示例。如果您正苦于以下问题:C++ BaseError类的具体用法?C++ BaseError怎么用?C++ BaseError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG4CPLUS_TRACE_METHOD
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: LOG4CPLUS_TRACE_METHOD
void IpcClient::testCaseShutdownOnRequest()
{
LOG4CPLUS_TRACE_METHOD(mLogger, __PRETTY_FUNCTION__);
BaseError err = mIpc->connect();
assert (err.isNoError());
mSema.wait();
}
示例3: connect
bool connect()
{
BaseError err = BaseError::NoError();
if (mpIpc == NULL)
{
char const * addr;
if (gpNEGOTIATOR_IPC_ADDR != NULL)
{
addr = gpNEGOTIATOR_IPC_ADDR;
} else
{
addr = ipcNegotiatorId;
}
mpIpc = new CIpc(addr, *this);
}
for (int tryNum = 1; tryNum <= MAX_TRY_COUNT; ++tryNum)
{
err = mpIpc->connect();
if (err.isNoError())
{
return true;
}
sleep(2);
}
return false;
}
示例4: mpStorage
CTrustList::CTrustList(std::string pathToStorage) :
mpStorage(new CFileStorage(pathToStorage.c_str()))
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
BaseError err = mpStorage->connect();
if (!err.isNoError())
LOG4CPLUS_ERROR(msLogger, static_cast<std::string>(err));
}
示例5: LOG4CPLUS_TRACE_METHOD
void L1InterfaceStub::start(bool isServer, const char* sockPath)
{
LOG4CPLUS_TRACE_METHOD(logger, __PRETTY_FUNCTION__);
mpAgent = new CConnectivityAgent(isServer);
mpAgent->start();
mpIpc = new iviLink::Ipc::CIpc(sockPath, *this);
BaseError err = mpIpc->beginWaitForConnection();
assert(err.isNoError());
}
示例6: memcpy
void L1InterfaceStub::processServiceDeallocateResponse(CDataAccessor & accessor)
{
UInt32 channel_id = accessor.getChannelID();
UInt32 errCode = 0;
memcpy(&errCode, accessor.getData(), sizeof(UInt32));
ConnectivityAgentError ret(static_cast<ConnectivityAgentError::AgentErrorCodes>(errCode));
LOG4CPLUS_INFO(logger, "L1InterfaceStub::processServiceDeallocateResponse() => "
"Channel deallocated responce id = "
+ convertIntegerToString(channel_id) + " err = " +
convertIntegerToString((int)ret.getCode()));
if (ret.isNoError())
{
ret = deallocateChannel(channel_id);
if (ret.isNoError())
{
bool found = false;
iviLink::Ipc::DirectionID dirId;
mRegistryMutex.lock();
{
tChannelsRegistryMap::iterator iter = mL1ChannelRegistry.find(channel_id);
if (iter != mL1ChannelRegistry.end())
{
dirId = iter->second.mClientDir;
found = true;
mL1ChannelRegistry.erase(iter);
}
}
mRegistryMutex.unlock();
if (found)
{
UInt8* buf = new UInt8[accessor.getObjectSize()];
accessor.copyToRawArray(buf);
BaseError err = mpIpc->asyncRequest(mMsgIdGen.next(),
buf, accessor.getObjectSize(), &dirId);
if (!err.isNoError())
{
LOG4CPLUS_WARN(logger, static_cast<std::string>(err));
}
delete [] buf;
}
else
{
LOG4CPLUS_INFO(logger, "Channel " + convertIntegerToString(channel_id) +
" is not found. Probably, already deleted");
}
}
}
}
示例7: LOG4CPLUS_INFO
void L1InterfaceStub::processServiceDeallocateRequest(CDataAccessor & accessor)
{
UInt32 channel_id = accessor.getChannelID();
LOG4CPLUS_INFO(logger, "L1InterfaceStub::processServiceDeallocateRequest() => "
"Channel deallocate request id = " + convertIntegerToString(channel_id));
ConnectivityAgentError ret = deallocateChannel(channel_id );
accessor.setOpCode(E_DEALLOCATE_CHANNEL_RESP);
UInt32 data = ret.getCode();
accessor.setData(reinterpret_cast<UInt8 *>(&data), sizeof(UInt32));
sendRequest(accessor);
if (ret.isNoError())
{
LOG4CPLUS_INFO(logger, "L1InterfaceStub::processServiceDeallocateRequest() => "
"channel successfully deallocated. "
"Notifying client");
iviLink::Ipc::DirectionID dirId;
bool found = false;
mRegistryMutex.lock();
tChannelsRegistryMap::iterator iter = mL1ChannelRegistry.find(accessor.getChannelID());
if (mL1ChannelRegistry.end() != iter)
{
dirId = iter->second.mClientDir;
found = true;
LOG4CPLUS_INFO(logger, "L1InterfaceStub::processServiceDeallocateRequest() => "
"channel found in registry - removing");
mL1ChannelRegistry.erase(accessor.getChannelID());
}
mRegistryMutex.unlock();
if (found)
{
accessor.setOpCode(E_DEALLOCATE_CHANNEL_NTF);
UInt8* buf = new UInt8[accessor.getObjectSize()];
accessor.copyToRawArray(buf);
BaseError err = mpIpc->asyncRequest(mMsgIdGen.next(),
buf, accessor.getObjectSize(), &dirId);
if (!err.isNoError())
{
LOG4CPLUS_WARN(logger, static_cast<std::string>(err));
}
delete[] buf;
}
} // ret == OK
}
示例8: assert
void L1InterfaceStub::sendIpcNotification(CDataAccessor & accessor,
iviLink::Ipc::DirectionID dirId)
{
assert(dirId != -1);
UInt8* buf = new UInt8[accessor.getObjectSize()];
accessor.copyToRawArray(buf);
BaseError err = mpIpc->asyncRequest(mMsgIdGen.next(),
buf, accessor.getObjectSize(), &dirId);
if (!err.isNoError())
{
LOG4CPLUS_WARN(logger, "sendIpcNotification error : " + static_cast<std::string>(err));
}
delete [] buf;
}
示例9: LOG4CPLUS_TRACE_METHOD
bool CTrustList::isKnownUid(iviLink::BaseUid const& uid) const
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
tNameUidVector vec;
tNameUidVector::iterator i;
BaseError err = mpStorage->readAll(vec);
if (!err.isNoError())
{
LOG4CPLUS_ERROR(msLogger, static_cast<std::string>(err));
return false;
}
LOG4CPLUS_INFO(msLogger, "Looking for: " + uid.value());
for(i = vec.begin(); i != vec.end(); ++i)
{
if(uid == i->first) return true;
}
return false;
}
示例10: mpClient
CServiceManager::CServiceManager(iviLink::Android::AppInfo appInfo)
: mpClient(0)
#ifndef ANDROID
, mXmlPath((std::string)SERVICE_REPOSITORY)
#else
, mXmlPath(appInfo.serviceRepoPath)
#endif //ANDROID
, mAppInfo(appInfo)
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
loadDb();
BaseError err = initPmal();
if(!err.isNoError())
{
LOG4CPLUS_ERROR(msLogger,
"CServiceManager::CServiceManager()=> PMAL component manager creation error "
+ static_cast<std::string>(err));
}
}
示例11: SystemControllerMsgProxy
AuthenticationStateMachine::AuthenticationStateMachine(const std::string& pathToTrlist, iviLink::Android::AppInfo appInfo)
: iviLink::Application(iviLink::Service::Uid("AuthenticationService"), appInfo)
, SystemControllerMsgProxy("SysCtrl_AuthApp")
, mAppInfo(appInfo)
, mKeygenThread(NULL)
, mpState(NULL)
, mInternalPath(pathToTrlist)
{
LOG4CPLUS_TRACE_METHOD(sLogger, __PRETTY_FUNCTION__);
mpAuthenticationProxy = new CAuthenticationProxy(iviLink::Service::Uid("AuthenticationService"), mAppInfo);
mKeygenThread = new PrivateKeyGenerationThread(mpAuthenticationProxy);
BaseError err = SystemControllerMsgProxy::connect();
if (!err.isNoError())
{
LOG4CPLUS_ERROR(sLogger, "Unable to establish connection to system controller " + (std::string)err);
killProcess(1); // Watchdog will detect this and restart the stack
}
}
示例12: LOG4CPLUS_TRACE_METHOD
void ConnectivityAgentMsgProxy::OnRequest(iviLink::Ipc::MsgID id, UInt8 const* pPayload,
UInt32 payloadSize, UInt8* const pResponseBuffer, UInt32& bufferSize,
iviLink::Ipc::DirectionID)
{
LOG4CPLUS_TRACE_METHOD(logger, __PRETTY_FUNCTION__);
Message const* req = reinterpret_cast<Message const*>(pPayload);
assert(req->header.size + sizeof(Message) == payloadSize);
assert(bufferSize >= sizeof(Message));
UInt8 role = 0;
CBufferReader bufReader(req->data, req->header.size);
switch (req->header.type)
{
case CA_SC_CONNECTION_ESTABLISHED:
{
BaseError err = bufReader.read(role);
if (err.isNoError())
{
LOG4CPLUS_INFO(logger,
"CA_SC_CONNECTION_ESTABLISHED role = " + convertIntegerToString(role));
onCounterCAConnected(role);
} else
{
LOG4CPLUS_WARN(logger,
"CA_SC_CONNECTION_ESTABLISHED err = " + static_cast<std::string>(err));
}
}
break;
case CA_SC_CONNECTION_LOST:
onCounterCADisconnected();
break;
default:
break;
}
bufferSize = 0;
}
示例13: BaseError
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);
}
示例14: init
CPMALError init(IProfileManagerCallbacks* pClbs, conf::Configurator* pConfig)
{
mpProfileManagerCallbacks = pClbs;
mpConfig = pConfig;
std::string pmpAddr;
if (mpConfig)
{
pmpAddr = mpConfig->getParam("pmp_ipc_address");
}
mpIpcProtocol = new Ipc::CIpcProtocol(pmpAddr.empty() ? NULL : pmpAddr.c_str());
BaseError err = mpIpcProtocol->connect();
while(!err.isNoError())
{
err = mpIpcProtocol->connect();
usleep(5000000);
}
if (!err.isNoError())
{
delete mpIpcProtocol;
mpIpcProtocol = NULL;
LOG4CPLUS_ERROR(msLogger, "CComponentMgrImpl::init() " + static_cast<std::string>(err));
return CPMALError(CPMALError::ERROR_OTHER, gModuleName, "ipc error");
}
mpCore = new CPmalCore(mpIpcProtocol);
mpPim = new CPIM();
return CPMALError::NoPMALError(gModuleName);
}
示例15: LOG4CPLUS_TRACE_METHOD
void CAppManProxy::handleUseService()
{
LOG4CPLUS_TRACE_METHOD(gCAppManProxyLogger,__PRETTY_FUNCTION__);
mpUseListMutex->lock();
if (mUseList.empty())
{
mpUseListMutex->unlock();
return;
}
bool use = mUseList.front().second;
Service::Uid service = mUseList.front().first;
mpUseListMutex->unlock();
BaseError err = AppMan::CAppManConnectController::instance(mAppInfo)->applicationManager()
->useService(service, use);
if (err.isNoError())
{
mpUseListMutex->lock();
mUseList.erase(mUseList.begin());
mpUseListMutex->unlock();
}
}