Rev 1688 | Rev 1690 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1688 | Rev 1689 | ||
---|---|---|---|
Line 37... | Line 37... | ||
37 | void writeByte(int b) throws IOException { |
37 | void writeByte(int b) throws IOException { |
38 | if(inbufptr == inbuf.length) flush(); |
38 | if(inbufptr == inbuf.length) flush(); |
39 | inbuf[inbufptr++] = b; |
39 | inbuf[inbufptr++] = b; |
40 | } |
40 | } |
Line -... | Line 41... | ||
- | 41 | ||
- | 42 | void writeSignedByte(int b) throws IOException { |
|
- | 43 | if (b<0) b+= 256; |
|
- | 44 | writeByte(b); |
|
- | 45 | } |
|
41 | 46 | ||
42 | public void writeBytes(int[] bs) throws IOException { |
47 | public void writeBytes(int[] bs) throws IOException { |
43 | for (int i=0; i<bs.length; i++) |
48 | for (int i=0; i<bs.length; i++) |
44 | writeByte(bs[i]); |
49 | writeByte(bs[i]); |
Line 169... | Line 174... | ||
169 | writeByte('n'); |
174 | writeByte('n'); |
170 | } |
175 | } |
Line 171... | Line 176... | ||
171 | 176 | ||
172 | public void visit(WriteMotorMixerRequestFrame f) throws IOException { |
177 | public void visit(WriteMotorMixerRequestFrame f) throws IOException { |
173 | writeByte('m'); |
178 | writeByte('m'); |
174 | writeByte(f.getConfigurationVersion()); |
179 | base64OutputStream.writeByte(f.getMotorMixerVersionNumber()); |
- | 180 | base64OutputStream.writeByte(f.getDataLength()); |
|
175 | writeByte(f.getDataLength()); |
181 | base64OutputStream.writeChars(f.getName()); |
176 | for(int i=0; i<f.getMatrix().length; i++) { |
182 | for(int i=0; i<f.getMatrix().length; i++) { |
177 | int[] row = f.getMatrix()[i]; |
183 | int[] row = f.getMatrix()[i]; |
178 | for(int j=0; j<row.length; j++) { |
184 | for(int j=0; j<row.length; j++) { |
- | 185 | base64OutputStream.writeSignedByte(row[j]); |
|
179 | base64OutputStream.writeByte(row[j]); |
186 | //System.out.print(row[j] + " "); |
- | 187 | } |
|
180 | } |
188 | //System.out.println(); |
181 | } |
189 | } |
182 | /* |
190 | /* |
183 | for(int i=0; i<f.getOppositeMotors().length; i++) { |
191 | for(int i=0; i<f.getOppositeMotors().length; i++) { |
184 | base64OutputStream.writeByte(f.getOppositeMotors()[i]); |
192 | base64OutputStream.writeByte(f.getOppositeMotors()[i]); |