State.java
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 Google Inc.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
00005  * use this file except in compliance with the License. You may obtain a copy of
00006  * the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
00013  * License for the specific language governing permissions and limitations under
00014  * the License.
00015  */
00016 
00017 package com.github.rosjava.rosjava_extras.hokuyo.scip20;
00018 
00019 import com.google.common.base.Preconditions;
00020 
00024 public class State {
00025 
00026   private String model;
00027   private String laserIlluminationState;
00028   private String motorSpeed;
00029   private String measurementMode;
00030   private String bitRate;
00031   private String timestamp;
00032   private String sensorDiagnostic;
00033 
00034   public static class Builder {
00035 
00036     private State state;
00037 
00038     public Builder() {
00039       state = new State();
00040     }
00041 
00042     public State build() {
00043       return state;
00044     }
00045 
00046     private String parseStringValue(String tag, String buffer) {
00047       Preconditions.checkArgument(buffer.startsWith(tag + ":"));
00048       return buffer.substring(5, buffer.length());
00049     }
00050 
00051     public Builder parseModel(String buffer) {
00052       state.model = parseStringValue("MODL", buffer);
00053       return this;
00054     }
00055 
00056     public Builder parseLaserIlluminationState(String buffer) {
00057       state.laserIlluminationState = parseStringValue("LASR", buffer);
00058       return this;
00059     }
00060 
00061     public Builder parseMotorSpeed(String buffer) {
00062       state.motorSpeed = parseStringValue("SCSP", buffer);
00063       return this;
00064     }
00065 
00066     public Builder parseMeasurementMode(String buffer) {
00067       state.measurementMode = parseStringValue("MESM", buffer);
00068       return this;
00069     }
00070 
00071     public Builder parseBitRate(String buffer) {
00072       state.bitRate = parseStringValue("SBPS", buffer);
00073       return this;
00074     }
00075 
00076     public Builder parseTimeStamp(String buffer) {
00077       state.timestamp = parseStringValue("TIME", buffer);
00078       return this;
00079     }
00080 
00081     public Builder parseSensorDiagnostic(String buffer) {
00082       state.sensorDiagnostic = parseStringValue("STAT", buffer);
00083       return this;
00084     }
00085   }
00086 
00087   private State() {
00088     // Use the State.Builder to construct a Configuration object.
00089   }
00090 
00094   public String getModel() {
00095     return model;
00096   }
00097 
00101   public String getLaserIlluminationState() {
00102     return laserIlluminationState;
00103   }
00104 
00108   public String getMotorSpeed() {
00109     return motorSpeed;
00110   }
00111 
00115   public String getMeasurementMode() {
00116     return measurementMode;
00117   }
00118 
00122   public String getBitRate() {
00123     return bitRate;
00124   }
00125 
00129   public String getTimestamp() {
00130     return timestamp;
00131   }
00132 
00136   public String getSensorDiagnostic() {
00137     return sensorDiagnostic;
00138   }
00139 }


rosjava_extras
Author(s): Damon Kohler
autogenerated on Thu Aug 27 2015 14:53:42