Rev 1578 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1578 | Rev 1601 | ||
---|---|---|---|
Line 256... | Line 256... | ||
256 | 256 | ||
257 | public List<Section> getDeclaredSections() { |
257 | public List<Section> getDeclaredSections() { |
258 | return declaredSections; |
258 | return declaredSections; |
Line 259... | Line 259... | ||
259 | } |
259 | } |
260 | 260 | ||
- | 261 | public void setData(int[] data) throws IOException { |
|
- | 262 | int offset = 0; |
|
- | 263 | int dataLength = data.length - 12; |
|
- | 264 | if (dataLength != getByteCount()) { |
|
- | 265 | throw new IOException("The received number of databytes (" + dataLength + ") was not equal to the length of the declared parameter set(" + getByteCount()+")."); |
|
261 | public void setData(int[] data) { |
266 | } |
262 | int offset = 0; |
267 | |
263 | for (ConfigEntry entry : entries) { |
268 | for (ConfigEntry entry : entries) { |
264 | offset += entry.setValue(data, offset); |
269 | offset += entry.setValue(data, offset); |
265 | } |
270 | } |
Line 321... | Line 326... | ||
321 | 326 | ||
322 | String s_eepromVersion = xpath.evaluate( |
327 | String s_eepromVersion = xpath.evaluate( |
323 | "/parametertemplate/@eepromVersion", doc); |
328 | "/parametertemplate/@eepromVersion", doc); |
Line -... | Line 329... | ||
- | 329 | int eepromVersion = Integer.parseInt(s_eepromVersion); |
|
- | 330 | ||
- | 331 | String s_declaredLength = xpath.evaluate( |
|
- | 332 | "/parametertemplate/@length", doc); |
|
324 | int eepromVersion = Integer.parseInt(s_eepromVersion); |
333 | int declaredLength = Integer.parseInt(s_declaredLength); |
325 | 334 | ||
326 | if (eepromVersion != version) { |
335 | if (eepromVersion != version) { |
327 | throw new IOException( |
336 | throw new IOException( |
328 | "Version mismatch between file name (" |
337 | "Version mismatch between file name (" |
Line 404... | Line 413... | ||
404 | result.entries.add(entry); |
413 | result.entries.add(entry); |
405 | section.addConfigEntry(entry); |
414 | section.addConfigEntry(entry); |
406 | } |
415 | } |
407 | } |
416 | } |
408 | result.name = "" + version; |
417 | result.name = "" + version; |
- | 418 | if (result.getByteCount() != declaredLength) { |
|
- | 419 | throw new IOException("The number of parameters in the set (" + result.getEntries().size() + ") was not equal to the declared length (" + declaredLength + ")."); |
|
- | 420 | } |
|
409 | return result; |
421 | return result; |
410 | } catch (IOException ex) { |
422 | } catch (IOException ex) { |
411 | throw ex; |
423 | throw ex; |
412 | } catch (XPathExpressionException ex) { |
424 | } catch (XPathExpressionException ex) { |
413 | throw new IOException(ex); |
425 | throw new IOException(ex); |