BowlerKernel
SetUARTBaudrateCommand.java
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright 2010 Neuron Robotics, LLC
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  ******************************************************************************/
15 package com.neuronrobotics.sdk.commands.bcs.io;
16 
17 import com.neuronrobotics.sdk.common.BowlerAbstractCommand;
18 import com.neuronrobotics.sdk.common.BowlerDatagram;
19 import com.neuronrobotics.sdk.common.BowlerMethod;
20 import com.neuronrobotics.sdk.common.ByteList;
21 import com.neuronrobotics.sdk.common.InvalidResponseException;
22 
23 // TODO: Auto-generated Javadoc
28 
35  public SetUARTBaudrateCommand(int channel, int baudrate) {
37  setOpCode("cchn");
38  getCallingDataStorage().add(channel);
40  }
41 
42  /* (non-Javadoc)
43  * @see com.neuronrobotics.sdk.common.BowlerAbstractCommand#parseResponse(com.neuronrobotics.sdk.common.BowlerDatagram)
44  */
45  @Override
47  super.validate(data);
48 
49  if(!data.getRPC().equals("_rdy")) {
50  throw new InvalidResponseException("Could not set the UART passthough baudrate.");
51  }
52  //System.out.println("Baudrate set return: \n"+data);
53  return data;
54  }
55 }
synchronized boolean add(byte data)
Definition: ByteList.java:149
static byte[] convertTo32(int value)
Definition: ByteList.java:977