mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:30:05 +00:00 
			
		
		
		
	Parse Performance/Maintenance Data (Message Type 3)
This commit is contained in:
		
							parent
							
								
									e440d8c657
								
							
						
					
					
						commit
						2fc12d44db
					
				
					 10 changed files with 2854 additions and 86 deletions
				
			
		|  | @ -1,7 +1,5 @@ | |||
| #include <scwx/wsr88d/rda/message.hpp> | ||||
| 
 | ||||
| #include <istream> | ||||
| 
 | ||||
| #include <boost/log/trivial.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
|  | @ -28,12 +26,23 @@ Message::~Message() = default; | |||
| Message::Message(Message&&) noexcept = default; | ||||
| Message& Message::operator=(Message&&) noexcept = default; | ||||
| 
 | ||||
| bool Message::ValidateSize(std::istream& is, size_t bytesRead) const | ||||
| bool Message::ValidateMessage(std::istream& is, size_t bytesRead) const | ||||
| { | ||||
|    bool   messageValid = true; | ||||
|    size_t dataSize     = header().message_size() * 2 - header().SIZE; | ||||
| 
 | ||||
|    if (bytesRead != dataSize) | ||||
|    if (is.eof()) | ||||
|    { | ||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Reached end of file"; | ||||
|       messageValid = false; | ||||
|    } | ||||
|    else if (is.fail()) | ||||
|    { | ||||
|       BOOST_LOG_TRIVIAL(warning) | ||||
|          << logPrefix_ << "Could not read from input stream"; | ||||
|       messageValid = false; | ||||
|    } | ||||
|    else if (bytesRead != dataSize) | ||||
|    { | ||||
|       is.seekg(static_cast<std::streamoff>(dataSize) - | ||||
|                   static_cast<std::streamoff>(bytesRead), | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat