Changeset 40:ec5dde8a6ff6 in xplra for src/client/c/hu/varadiistvan/xplra/XPlane.cc
- Timestamp:
- 02/14/13 18:21:47 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/client/c/hu/varadiistvan/xplra/XPlane.cc
r36 r40 73 73 //------------------------------------------------------------------------------ 74 74 75 void XPlane::checkResult(uint8_t result) throw(ProtocolException) 75 void XPlane::checkResult(uint8_t result, bool hasParameter, long parameter) 76 throw(ProtocolException) 76 77 { 77 78 switch(result) { … … 79 80 return; 80 81 case Protocol::RESULT_INVALID_COMMAND: 81 throw ProtocolException(ProtocolException::INVALID_COMMAND); 82 throw ProtocolException(ProtocolException::INVALID_COMMAND, 83 hasParameter, parameter); 82 84 case Protocol::RESULT_UNKNOWN_DATAREF: 83 throw ProtocolException(ProtocolException::UNKNOWN_DATAREF); 85 throw ProtocolException(ProtocolException::UNKNOWN_DATAREF, 86 hasParameter, parameter); 84 87 case Protocol::RESULT_INVALID_TYPE: 85 throw ProtocolException(ProtocolException::INVALID_TYPE); 88 throw ProtocolException(ProtocolException::INVALID_TYPE, 89 hasParameter, parameter); 86 90 case Protocol::RESULT_INVALID_LENGTH: 87 throw ProtocolException(ProtocolException::INVALID_LENGTH); 91 throw ProtocolException(ProtocolException::INVALID_LENGTH, 92 hasParameter, parameter); 88 93 case Protocol::RESULT_INVALID_OFFSET: 89 throw ProtocolException(ProtocolException::INVALID_OFFSET); 94 throw ProtocolException(ProtocolException::INVALID_OFFSET, 95 hasParameter, parameter); 90 96 case Protocol::RESULT_INVALID_COUNT: 91 throw ProtocolException(ProtocolException::INVALID_COUNT); 97 throw ProtocolException(ProtocolException::INVALID_COUNT, 98 hasParameter, parameter); 92 99 case Protocol::RESULT_INVALID_ID: 93 throw ProtocolException(ProtocolException::INVALID_ID); 100 throw ProtocolException(ProtocolException::INVALID_ID, 101 hasParameter, parameter); 102 case Protocol::RESULT_INVALID_DURATION: 103 throw ProtocolException(ProtocolException::INVALID_DURATION, 104 hasParameter, parameter); 94 105 case Protocol::RESULT_OTHER_ERROR: 95 106 default: 96 throw ProtocolException(ProtocolException::OTHER); 107 throw ProtocolException(ProtocolException::OTHER, 108 hasParameter, parameter); 97 109 } 98 110 } … … 100 112 //------------------------------------------------------------------------------ 101 113 102 void XPlane::checkResult( ) throw(ProtocolException, IOException)114 void XPlane::checkResult(bool multi) throw(ProtocolException, IOException) 103 115 { 104 116 uint8_t result = stream->readU8(); 105 checkStream(); 106 checkResult(result); 117 bool hasParameter = false; 118 long parameter = 0; 119 if (multi) { 120 if (result==Protocol::RESULT_UNKNOWN_DATAREF) { 121 parameter = stream->readU32(); 122 hasParameter = true; 123 } 124 } 125 checkStream(); 126 checkResult(result, hasParameter, parameter); 107 127 } 108 128 … … 205 225 206 226 checkStream(); 227 } 228 229 //------------------------------------------------------------------------------ 230 231 void XPlane::reloadPlugins() throw(Exception) 232 { 233 stream->writeU8(Protocol::COMMAND_RELOAD_PLUGINS); 234 stream->flush(); 235 checkResult(); 207 236 } 208 237 … … 457 486 } 458 487 } 488 489 //------------------------------------------------------------------------------ 490 491 void XPlane::showMessage(const char* message, float duration) throw(Exception) 492 { 493 stream->writeU8(Protocol::COMMAND_SHOW_MESSAGE); 494 stream->writeString(message); 495 stream->writeFloat(duration); 496 stream->flush(); 497 checkResult(); 498 } 499 459 500 //------------------------------------------------------------------------------ 460 501
Note:
See TracChangeset
for help on using the changeset viewer.