本文整理汇总了C++中LOG_BLOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_BLOCK函数的具体用法?C++ LOG_BLOCK怎么用?C++ LOG_BLOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOG_BLOCK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool EnhancedVtoRouter::CheckIncomingVtoData(const VtoData& arData)
{
switch(arData.GetType()) {
case(VTODT_DATA):
if(mInstRemoteConnected) return true;
else {
LOG_BLOCK(LEV_WARNING, "Discarding received data, because remote side is offline");
this->HandleReceivingDataWhenRemoteClosed();
return false;
}
case(VTODT_REMOTE_OPENED):
if(mInstRemoteConnected) {
LOG_BLOCK(LEV_WARNING, "Remote side opened, but it was already open");
this->HandleDuplicateOpen();
return false;
}
else {
mInstRemoteConnected = true;
return true;
}
case(VTODT_REMOTE_CLOSED):
if(mInstRemoteConnected) {
mInstRemoteConnected = false;
return true;
}
else {
LOG_BLOCK(LEV_WARNING, "Remote side closed, but it was already closed");
this->HandleDuplicateClose();
return false;
}
default:
throw ArgumentException(LOCATION, "Unknown VtoData type");
}
}
示例2: LOG_BLOCK
void MockAppLayer::SendUnsolicited(APDU& arAPDU)
{
LOG_BLOCK(LEV_COMM, "=> " << toHex(arAPDU.GetBuffer(), arAPDU.Size(), true));
LOG_BLOCK(LEV_INTERPRET, "=> " << arAPDU.ToString());
mFragments.push_back(arAPDU);
this->DoSendUnsol();
}
示例3: LOG_BLOCK
void AddressScanner::Run()
{
mRouter.Start();
LOG_BLOCK(LEV_INFO, "Scanning from " << mCurrent << " to " << mStop);
mThread.Run();
LOG_BLOCK(LEV_INFO, "Scan complete...");
}
示例4: LOG_BLOCK
void PhysicalLayerAsyncTCPClient::DoOpenSuccess()
{
LOG_BLOCK(LEV_INFO, "Connected to: " << mRemoteEndpoint);
if (mUseKeepAlives) {
LOG_BLOCK(LEV_DEBUG, "Enabling keepalives on the socket connection to " << mRemoteEndpoint);
boost::asio::socket_base::keep_alive option(true);
mSocket.set_option(option);
}
}
示例5: LOG_BLOCK
void AsyncPort::Associate(const std::string& arStackName, AsyncStack* apStack, uint_16_t aLocalAddress)
{
LOG_BLOCK(LEV_DEBUG, "Linking stack to port: " << aLocalAddress);
mStackMap[arStackName] = StackRecord(apStack, aLocalAddress);
apStack->mLink.SetRouter(&mRouter);
mRouter.AddContext(&apStack->mLink, aLocalAddress);
if(!mRouter.IsRunning()) {
LOG_BLOCK(LEV_DEBUG, "Starting router");
mRouter.Start();
}
}
示例6: LOG_BLOCK
void Slave::OnUnsolFailure()
{
// disable unsol responses until request is received from master
if (mUnsolExpectCON) {
LOG_BLOCK(LEV_WARNING, "Disable unsol response");
mUnsolDisable = true;
}
mpState->OnUnsolFailure(this);
LOG_BLOCK(LEV_WARNING, "Unsol response failure");
this->FlushDeferredEvents();
}
示例7: catch
void IOServiceThread::Run()
{
size_t num = 0;
try {
num = mpService->run();
} catch(IOServiceExitException&) {
LOG_BLOCK(LEV_INFO, "IOService exited via IOServiceExitException");
} catch(const std::exception& ex) {
LOG_BLOCK(LEV_ERROR, "Unexpected exception: " << ex.what());
}
}
示例8: cs
size_t VtoWriter::Write(const boost::uint8_t* apData,
size_t aLength,
boost::uint8_t aChannelId)
{
size_t num = 0;
{
CriticalSection cs(&mLock);
/*
* Only write the maximum amount available or requested. If the
* requested data size is larger than the available buffer space,
* only send what will fit.
*/
num = Min<size_t>(this->NumBytesAvailable(), aLength);
/*
* Chop up the data into Max(255) segments and add it to the queue.
*/
this->Commit(apData, num, aChannelId);
LOG_BLOCK(LEV_INTERPRET, "VtoWriter: " << this->NumBytesAvailable() << " available out of "
<< (mMaxVtoChunks * VtoData::MAX_SIZE));
}
/* Tell any listeners that the queue has new data to be read. */
if (num > 0) this->NotifyAll();
/* Return the number of bytes from apData that were queued. */
return num;
}
示例9: switch
void Slave::HandleEnableUnsolicited(const APDU& arRequest, bool aIsEnable)
{
mResponse.Set(FC_RESPONSE);
if (mConfig.mDisableUnsol) {
mRspIIN.SetFuncNotSupported(true);
}
else {
if (aIsEnable) {
this->mDeferredUnsol = true;
}
for (HeaderReadIterator hdr = arRequest.BeginRead(); !hdr.IsEnd(); ++hdr) {
switch (MACRO_DNP_RADIX(hdr->GetGroup(), hdr->GetVariation())) {
case (MACRO_DNP_RADIX(60, 2)):
mConfig.mUnsolMask.class1 = aIsEnable;
break;
case (MACRO_DNP_RADIX(60, 3)):
mConfig.mUnsolMask.class2 = aIsEnable;
break;
case (MACRO_DNP_RADIX(60, 4)):
mConfig.mUnsolMask.class3 = aIsEnable;
break;
default:
mRspIIN.SetFuncNotSupported(true);
LOG_BLOCK(LEV_WARNING, "Cannot enable/disable unsol for " << hdr->GetBaseObject()->Name());
break;
}
}
}
}
示例10: LOG_BLOCK
void AppLayerChannel::ChangeState(ACS_Base* apState)
{
if(apState != mpState) {
LOG_BLOCK(LEV_DEBUG, "State changed from " << mpState->Name() << " to " << apState->Name());
mpState = apState;
}
}
示例11: LOG_BLOCK
void PhysicalLayerMonitor::_OnLowerLayerUp()
{
LOG_BLOCK(LEV_DEBUG, "_OnLowerLayerUp");
this->mCurrentRetry = mMinOpenRetry;
mpState->OnLayerOpen(this);
this->OnPhysicalLayerOpenSuccessCallback();
}
示例12: LOG_BLOCK
void VtoRouter::CheckForVtoWrite()
{
if(!mVtoTxBuffer.empty()) {
VtoMessage msg = mVtoTxBuffer.front();
mVtoTxBuffer.pop_front();
// type DATA means this is a buffer and we need to pull the data out and send it to the vto writer
if(msg.type == VTODT_DATA) {
size_t numWritten = mpVtoWriter->Write(msg.data.Buffer(), msg.data.Size(), this->GetChannelId());
LOG_BLOCK(LEV_INTERPRET, "VtoWriter: " << numWritten << " of " << msg.data.Size());
if(numWritten < msg.data.Size()) {
size_t remainder = msg.data.Size() - numWritten;
VtoMessage partial(VTODT_DATA, msg.data.Buffer() + numWritten, remainder);
mVtoTxBuffer.push_front(partial);
}
else this->CheckForVtoWrite();
}
else {
// if we have generated REMOTE_OPENED or REMOTE_CLOSED message we need to send the SetLocalVtoState
// update to the vtowriter so it can be serialized in the correct order.
mpVtoWriter->SetLocalVtoState(msg.type == VTODT_REMOTE_OPENED, this->GetChannelId());
this->CheckForVtoWrite();
}
}
this->CheckForPhysRead();
}
示例13: LOG_BLOCK
void PhysicalLayerAsyncBase::OnOpenCallback(const boost::system::error_code& arErr)
{
if(mState.mOpening) {
mState.mOpening = false;
this->DoOpenCallback();
if(arErr) {
LOG_BLOCK(LEV_WARNING, arErr.message());
mState.CheckForClose();
this->DoOpenFailure();
if(mpHandler) mpHandler->OnOpenFailure();
}
else { // successful connection
if(this->IsClosing()) { // but the connection was closed
mState.CheckForClose();
this->DoClose();
if(mpHandler) mpHandler->OnOpenFailure();
}
else {
mState.mOpen = true;
this->DoOpenSuccess();
if(mpHandler) mpHandler->OnLowerLayerUp();
}
}
}
else {
MACRO_THROW_EXCEPTION_COMPLEX(InvalidStateException, "OnOpenCallback: " << this->ConvertStateToString());
}
}
示例14: LOG_BLOCK
void IUpperLayer::OnReceive(const apl::byte_t* apData, size_t aNumBytes)
{
if(this->LogReceive()) {
LOG_BLOCK(LEV_COMM, RecvString() << " " << toHex(apData, aNumBytes, true));
}
this->_OnReceive(apData, aNumBytes); //call the implementation
}
示例15: LOG_BLOCK
void VtoTransmitTask::ConfigureRequest(APDU& arAPDU)
{
/*
* Masters never request confirmed data. The response from the
* slave is all that's required for reliable delivery.
*/
arAPDU.Set(mUseNonStandardCode ? FC_PROPRIETARY_VTO_TRANSFER : FC_WRITE);
const size_t MAX_VTO_EVENTS = 7;
/* Get all of the data objects in the buffer. */
size_t numObjects = this->mBuffer.Select(PC_ALL_EVENTS, MAX_VTO_EVENTS);
LOG_BLOCK(LEV_INTERPRET, "VtoTransmitTask Sending: " << numObjects << " of " << this->mBuffer.Size());
/* If there are no objects to write, skip the remainder. */
if (numObjects == 0) {
return;
}
/*
* Loop through the selected data and add corresponding objects to
* the arAPDU instance.
*/
VtoDataEventIter vto = this->mBuffer.Begin();
for (size_t i = 0; i < numObjects; ++i) {
/* Insert a new object into the APDU message. */
IndexedWriteIterator itr = arAPDU.WriteIndexed(
Group112Var0::Inst(),
vto->mValue.GetSize(),
vto->mIndex
);
/*
* Check to see if the APDU fragment has enough room for the
* data segment. If the fragment is full, return out of this
* function and let the fragment send.
*/
if (itr.IsEnd()) {
return;
}
/* Set the object index */
itr.SetIndex(vto->mIndex);
/* Write the data to the APDU message */
Group112Var0::Inst()->Write(
*itr,
vto->mValue.GetSize(),
vto->mValue.mpData
);
/* Mark the data segment as being written */
vto->mWritten = true;
/* Move to the next data segment in the buffer */
++vto;
}
}