Changeset 33:080fa73274f8 in xplra for src/client/c/hu
- Timestamp:
- 02/09/13 11:19:09 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/client/c/hu/varadiistvan/xplra
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/client/c/hu/varadiistvan/xplra/MultiBuffer.cc
r26 r33 339 339 xplane.checkStream(); 340 340 341 xplane.stream->writeU8(registerCommand); 342 xplane.stream->writeU32(dataRefs.size()); 343 344 for(vector<DataRef>::const_iterator i = dataRefs.begin(); 345 i!=dataRefs.end(); ++i) 346 { 347 const DataRef& dataRef = *i; 348 xplane.stream->writeString(dataRef.name); 349 xplane.stream->writeU8(dataRef.type); 350 if (dataRef.isArray()) { 351 xplane.stream->writeS32(dataRef.length); 352 xplane.stream->writeS32(dataRef.offset); 353 } 354 } 355 356 xplane.stream->flush(); 357 358 uint8_t result = xplane.stream->readU8(); 341 writeSpec(registerCommand); 342 359 343 uint32_t id = xplane.stream->readU32(); 360 344 xplane.checkStream(); 361 xplane.checkResult(result);362 345 363 346 registeredID = static_cast<int>(id); … … 609 592 //------------------------------------------------------------------------------ 610 593 594 void MultiBuffer::writeSpec(uint8_t command) const throw(Exception) 595 { 596 xplane.stream->writeU8(command); 597 xplane.stream->writeU32(dataRefs.size()); 598 599 for(vector<DataRef>::const_iterator i = dataRefs.begin(); 600 i!=dataRefs.end(); ++i) 601 { 602 const DataRef& dataRef = *i; 603 xplane.stream->writeString(dataRef.name); 604 xplane.stream->writeU8(dataRef.type); 605 if (dataRef.isArray()) { 606 xplane.stream->writeS32(dataRef.length); 607 xplane.stream->writeS32(dataRef.offset); 608 } 609 } 610 611 xplane.stream->flush(); 612 xplane.checkResult(); 613 } 614 615 //------------------------------------------------------------------------------ 616 611 617 // Local Variables: 612 618 // mode: C++ -
src/client/c/hu/varadiistvan/xplra/MultiBuffer.h
r29 r33 475 475 virtual void doExecuteUnregistered() throw(Exception) = 0; 476 476 477 /** 478 * Write the data specification with the given command. It also 479 * checks the result 480 */ 481 void writeSpec(uint8_t command) const throw(Exception); 482 477 483 private: 478 484 /** -
src/client/c/hu/varadiistvan/xplra/MultiGetter.cc
r22 r33 99 99 xplane.checkResult(); 100 100 101 for(vector<DataRef>::const_iterator i = dataRefs.begin(); 102 i!=dataRefs.end(); ++i) 103 { 104 xplane.checkStream(); 105 const DataRef& dataRef = *i; 106 read(dataRef); 107 } 101 readValues(); 108 102 } 109 103 … … 113 107 void MultiGetter::doExecuteUnregistered() throw(Exception) 114 108 { 109 writeSpec(Protocol::COMMAND_GET_MULTI); 110 111 readValues(); 112 } 113 114 //------------------------------------------------------------------------------ 115 116 void MultiGetter::readValues() throw(Exception) 117 { 115 118 for(vector<DataRef>::const_iterator i = dataRefs.begin(); 116 119 i!=dataRefs.end(); ++i) 117 120 { 121 xplane.checkStream(); 118 122 const DataRef& dataRef = *i; 119 xplane.stream->writeU8(Protocol::COMMAND_GET_SINGLE);120 xplane.stream->writeString(dataRef.name);121 xplane.stream->writeU8(dataRef.type);122 if (dataRef.isArray()) {123 xplane.stream->writeS32(dataRef.length);124 xplane.stream->writeS32(dataRef.offset);125 }126 xplane.stream->flush();127 xplane.checkResult();128 123 read(dataRef); 129 124 } -
src/client/c/hu/varadiistvan/xplra/MultiGetter.h
r26 r33 68 68 void read(const DataRef& dataRef) throw(Exception); 69 69 70 /** 71 * Read all the values. 72 */ 73 void readValues() throw(Exception); 74 70 75 friend class XPlane; 71 76 }; -
src/client/c/hu/varadiistvan/xplra/MultiSetter.cc
r22 r33 106 106 void MultiSetter::doExecuteUnregistered() throw(Exception) 107 107 { 108 xplane.stream->writeU8(Protocol::COMMAND_SET_MULTI); 109 xplane.stream->writeU32(dataRefs.size()); 108 110 for(vector<DataRef>::const_iterator i = dataRefs.begin(); 109 111 i!=dataRefs.end(); ++i) 110 112 { 111 113 const DataRef& dataRef = *i; 112 xplane.stream->writeU8(Protocol::COMMAND_SET_SINGLE);113 114 xplane.stream->writeString(dataRef.name); 114 115 xplane.stream->writeU8(dataRef.type); … … 118 119 } 119 120 write(dataRef); 120 xplane.stream->flush();121 xplane.checkResult();122 121 } 122 xplane.stream->flush(); 123 xplane.checkResult(); 123 124 } 124 125
Note:
See TracChangeset
for help on using the changeset viewer.