Changeset 5:94fdd791268f in xplra
- Timestamp:
- 01/03/13 18:27:08 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/xplra
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/xplra/Makefile.am
r4 r5 37 37 Request.h \ 38 38 RequestQueue.h \ 39 Protocol.h \ 39 40 ServerThread.h \ 40 41 Task.h \ -
src/xplra/ServerThread.cc
r3 r5 32 32 33 33 #include "RequestQueue.h" 34 #include "Protocol.h" 34 35 #include "GetDataRefTask.h" 35 36 #include "TaskRequest.h" … … 109 110 // this, command); 110 111 111 if (command== CMD_GET_SINGLE) {112 if (command==Protocol::CMD_GET_SINGLE) { 112 113 string name = stream.readString(); 113 114 uint8_t type = stream.readU8(); … … 115 116 // Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: name='%s', type=0x%02x\n", 116 117 // this, name.c_str(), type); 117 if (type== TYPE_BYTE_ARRAY) {118 if (type==Protocol::TYPE_BYTE_ARRAY) { 118 119 int length = stream.readS32(); 119 120 if (!stream) continue; … … 128 129 if (requestQueue.execute(&request)) { 129 130 // Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: request executed\n"); 130 stream.writeU8( RESULT_OK);131 stream.writeU8(Protocol::RESULT_OK); 131 132 int length = task->getLength(); 132 133 stream.writeS32(length); … … 138 139 } 139 140 } else { 140 stream.writeU8( RESULT_OTHER_ERROR);141 stream.writeU8(Protocol::RESULT_OTHER_ERROR); 141 142 } 142 143 } else { 143 stream.writeU8( RESULT_INVALID_COMMAND);144 stream.writeU8(Protocol::RESULT_INVALID_COMMAND); 144 145 } 145 146 stream.flush(); -
src/xplra/ServerThread.h
r3 r5 57 57 class ServerThread : public xplcommon::Thread 58 58 { 59 public:60 /**61 * Command: get the value of a single dataref.62 */63 static const uint8_t CMD_GET_SINGLE = 0x01;64 65 /**66 * Data type: int67 */68 static const uint8_t TYPE_INT = 0x01;69 70 /**71 * Data type: float72 */73 static const uint8_t TYPE_FLOAT = 0x02;74 75 /**76 * Data type: double77 */78 static const uint8_t TYPE_DOUBLE = 0x03;79 80 /**81 * Data type: float array82 */83 static const uint8_t TYPE_FLOAT_ARRAY = 0x11;84 85 /**86 * Data type: int array87 */88 static const uint8_t TYPE_INT_ARRAY = 0x12;89 90 /**91 * Data type: byte array92 */93 static const uint8_t TYPE_BYTE_ARRAY = 0x13;94 95 /**96 * Result code: no error, everything is OK.97 */98 static const uint8_t RESULT_OK = 0x00;99 100 /**101 * Result code: invalid command102 */103 static const uint8_t RESULT_INVALID_COMMAND = 0x01;104 105 /**106 * Result code: unknown dataref107 */108 static const uint8_t RESULT_UNKNOWN_DATAREF = 0x02;109 110 /**111 * Result code: invalid type112 */113 static const uint8_t RESULT_INVALID_TYPE = 0x03;114 115 /**116 * Result code: other error117 */118 static const uint8_t RESULT_OTHER_ERROR = 0xff;119 120 59 private: 121 60 /**
Note:
See TracChangeset
for help on using the changeset viewer.