BowlerKernel
ProgramSectionCommand.java
Go to the documentation of this file.
1 package com.neuronrobotics.sdk.commands.neuronrobotics.bootloader;
2 
3 import com.neuronrobotics.sdk.common.BowlerAbstractCommand;
4 import com.neuronrobotics.sdk.common.BowlerDatagram;
5 import com.neuronrobotics.sdk.common.BowlerMethod;
6 import com.neuronrobotics.sdk.common.ByteList;
7 import com.neuronrobotics.sdk.common.InvalidResponseException;
8 
9 // TODO: Auto-generated Javadoc
14 
21  public static String hex(long n) {
22  // call toUpperCase() if that's required
23  return String.format("0x%8s", Long.toHexString(n)).replace(' ', '0');
24  }
25 
33  public ProgramSectionCommand(int channel, int address, ByteList byteData) {
34  setOpCode("prog");
35  System.out.println("Sending to address "+hex(address)+" size = "+byteData.size());
37  getCallingDataStorage().add(channel);
38  getCallingDataStorage().addAs32(address);
39  for (byte b:byteData){
41  }
42  }
43 
44  /* (non-Javadoc)
45  * @see com.neuronrobotics.sdk.common.BowlerAbstractCommand#validate(com.neuronrobotics.sdk.common.BowlerDatagram)
46  */
47  @Override
49  super.validate(data);
50 
51  if(!data.getRPC().equals("_rdy")) {
52  throw new InvalidResponseException("Program Command did not return '_rdy'.");
53  }
54 
55  return data;
56  }
57 }
synchronized boolean add(byte data)
Definition: ByteList.java:149