MdmsException.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 
00023 public class MdmsException extends RuntimeException {
00024 
00025   public MdmsException(String status) {
00026     super(getMessage(status));
00027   }
00028 
00029   private static String getMessage(String status) {
00030     if (status.equals("0A")) {
00031       return "Unable to create transmission data or reply command internally.";
00032     }
00033     if (status.equals("0B")) {
00034       return "Buffer shortage or command repeated that is already processed.";
00035     }
00036     if (status.equals("0C")) {
00037       return "Command with insufficient parameters 1.";
00038     }
00039     if (status.equals("0D")) {
00040       return "Undefined command 1.";
00041     }
00042     if (status.equals("0E")) {
00043       return "Undefined command 2.";
00044     }
00045     if (status.equals("0F")) {
00046       return "Command with insufficient parameters 2.";
00047     }
00048     if (status.equals("0G")) {
00049       return "String Character in command exceeds 16 letters.";
00050     }
00051     if (status.equals("0H")) {
00052       return "String Character has invalid letters.";
00053     }
00054     if (status.equals("0I")) {
00055       return "Sensor is now in firmware update mode.";
00056     }
00057     if (status.equals("01")) {
00058       return "Sensor is now in firmware update mode.";
00059     }
00060     if (status.equals("01")) {
00061       return "Starting step has non-numeric value.";
00062     }
00063     if (status.equals("02")) {
00064       return "End step has non-numeric value.";
00065     }
00066     if (status.equals("03")) {
00067       return "Cluster count has non-numeric value.";
00068     }
00069     if (status.equals("04")) {
00070       return "End step is out of range.";
00071     }
00072     if (status.equals("05")) {
00073       return "End step is smaller than starting step.";
00074     }
00075     if (status.equals("06")) {
00076       return "Scan interval has non-numeric value.";
00077     }
00078     if (status.equals("07")) {
00079       return "Number of scan has non-numeric value.";
00080     }
00081     if (status.equals("98")) {
00082       return "Resumption of process after confirming normal laser operation.";
00083     }
00084 
00085     int value = Integer.valueOf(status);
00086     if (value > 20 && value < 50) {
00087       return "Processing stopped to verify the error.";
00088     }
00089     if (value > 49 && value < 98) {
00090       return "Hardware trouble (such as laser, motor malfunctions etc.).";
00091     }
00092 
00093     return "Unknown status code: " + status;
00094   }
00095 
00096 }


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