BowlerKernel
CreateSensorRequest.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.addons.irobot;
16 
17 import java.util.HashMap;
18 import java.util.Map;
19 
20 // TODO: Auto-generated Javadoc
24 public enum CreateSensorRequest {
25 
27  ALL(0x00),
28 
30  IO(0x01),
31 
33  DRIVE(0x02),
34 
36  BATTERY(0x03),
37 
39  NONE(0xFF);
40 
42  private byte value;
43 
45  private static final Map<Byte,CreateSensorRequest> lookup = new HashMap<Byte,CreateSensorRequest>();
46 
52  private CreateSensorRequest(int val) {
53  value = (byte) val;
54  }
55 
61  public byte getValue() {
62  return value;
63  }
64 
71  public static CreateSensorRequest get(byte code) {
72  return lookup.get(code);
73  }
74 
75  /* (non-Javadoc)
76  * @see java.lang.Enum#toString()
77  */
78  public String toString(){
79  switch (this){
80  case ALL:
81  return "All sensors";
82  case IO:
83  return "IO sensors sensors";
84  case DRIVE:
85  return "Drive sensors";
86  case BATTERY:
87  return "Battery sensors";
88  default:
89  return "Unknown, dont know how that would happen";
90  }
91  }
92 }