// TMessage ctor from WONException
BadMsgException::BadMsgException(const BaseMessage& theMsgR, int theLine,
                                 const char* theFileP, const char* addTextP) throw() :
	WONException(WONCommon::ExBadTitanMessage, theLine, theFileP)
{
	WTRACE("BadMsgException::ctor(TMessage)");

	// Add header type info or header corrupt message
	if (theMsgR.GetDataLen() >= theMsgR.GetHeaderLength())
	{
		WDBG_LL("BadMsgException::ctor(TMessage) Add header info.");
		GetStream() << "MessageClass=" << (int)theMsgR.GetMessageClass()
		            << "  MessageType="  << theMsgR.GetMessageType()
		            << "  ServiceType=" << theMsgR.GetServiceType();
	}
	else
	{
		WDBG_LH("BadMsgException::ctor(TMessage) Corrupt header!");
		GetStream() << HDRCORRUPT_MSG;
	}

	// Add message length and data length
	WDBG_LL("BadMsgException::ctor(TMessage) Add length info.");
	GetStream() << "  DataLength="    << theMsgR.GetDataLen();

	// Add additional text if defined
	if (addTextP) GetStream() << "  " << addTextP;
}
// Send Titan message to Observation Server
Error 
ObservationClientBase::SendMMsgToServer(BaseMessage& theMsgR, const CompletionContainerBase* theCompletionP, const void* theReplyResultP)
{
	ReplyCompletionData aReplyCompletionData;
	aReplyCompletionData.mReplyId = GetReplyMsgType(theMsgR.GetMessageType());
	aReplyCompletionData.mCompletionP = const_cast<CompletionContainerBase*>(theCompletionP);
	aReplyCompletionData.mReplyResultP = const_cast<void*>(theReplyResultP);

	mCriticalSection.Enter();
	mReplyCompletionList.push_back(aReplyCompletionData);
	mCriticalSection.Leave();
	return mSocketMgrP->SendMMsgToServer(theMsgR);
}