Package org.openhab.binding.rfxcom.internal

Examples of org.openhab.binding.rfxcom.internal.RFXComException


    case COMMAND:
      if (type instanceof OnOffType) {
        command = (type == OnOffType.ON ? Commands.ON : Commands.OFF);
        dimmingLevel = 0;
      } else {
        throw new RFXComException("Can't convert " + type + " to Command");
      }
      break;

    case DIMMING_LEVEL:
      if (type instanceof OnOffType) {
        command = (type == OnOffType.ON ? Commands.ON : Commands.OFF);
        dimmingLevel = 0;
      } else if (type instanceof PercentType) {
        command = Commands.SET_LEVEL;
        dimmingLevel = (byte) getDimLevelFromPercentType((PercentType) type);

        if (dimmingLevel == 0) {
          command = Commands.OFF;
        }

      } else if (type instanceof IncreaseDecreaseType) {
        command = Commands.SET_LEVEL;
        // Evert: I do not know how to get previous object state...
        dimmingLevel = 5;

      } else {
        throw new RFXComException("Can't convert " + type + " to Command");
      }
      break;

    default:
      throw new RFXComException("Can't convert " + type + " to "
          + valueSelector);
    }
  }
View Full Code Here


      if (s.toString().equals(subType)) {
        return s;
      }
    }
   
    throw new RFXComException("Unknown sub type " + subType);
  }
View Full Code Here

      String className = messageClasses.get(packetType);
      Class<?> cl = Class.forName(classUrl + className);
      return (RFXComMessageInterface) cl.newInstance();
     
    } catch (ClassNotFoundException e) {
      throw new RFXComException("Message " + packetType + " not implemented", e);
     
    } catch (Exception e) {
      throw new RFXComException(e);
    }
  }
View Full Code Here

      Class<?> cl = Class.forName(classUrl + className);
      Constructor<?> c = cl.getConstructor(byte[].class);
      return (RFXComMessageInterface) c.newInstance(packet);
   
    } catch (ClassNotFoundException e) {
      throw new RFXComException("Message " + packetType + " not implemented", e);
     
    } catch (Exception e) {
      throw new RFXComException(e);
    }
  }
View Full Code Here

        state = new DecimalType(rainTotal);
     

      } else {
        throw new RFXComException("Can't convert "
            + valueSelector + " to NumberItem");
      }

    } else if (valueSelector.getItemClass() == StringItem.class) {

      if (valueSelector == RFXComValueSelector.RAW_DATA) {

        state = new StringType(
            DatatypeConverter.printHexBinary(rawMessage));

     
      } else {
        throw new RFXComException("Can't convert " + valueSelector + " to StringItem");
      }
    } else {

      throw new RFXComException("Can't convert " + valueSelector
          + " to " + valueSelector.getItemClass());

    }

    return state;
View Full Code Here

  @Override
  public void convertFromState(RFXComValueSelector valueSelector, String id,
      Object subType, Type type, byte seqNumber) throws RFXComException {
   
    throw new RFXComException("Not supported");
  }
View Full Code Here

      if (s.toString().equals(subType)) {
        return s;
      }
    }
   
    throw new RFXComException("Unknown sub type " + subType);
  }
View Full Code Here

      } else if (valueSelector == RFXComValueSelector.TEMPERATURE) {

        state = new DecimalType(temperature);

      } else {
        throw new RFXComException("Can't convert "
            + valueSelector + " to NumberItem");
      }

    } else if (valueSelector.getItemClass() == StringItem.class) {

      if (valueSelector == RFXComValueSelector.RAW_DATA) {

        state = new StringType(
            DatatypeConverter.printHexBinary(rawMessage));

      } else {
        throw new RFXComException("Can't convert "
            + valueSelector + " to StringItem");
      }
    } else {

      throw new RFXComException("Can't convert " + valueSelector
          + " to " + valueSelector.getItemClass());

    }

    return state;
View Full Code Here

  @Override
  public void convertFromState(RFXComValueSelector valueSelector, String id,
      Object subType, Type type, byte seqNumber) throws RFXComException {

    throw new RFXComException("Not supported");
  }
View Full Code Here

      if (s.toString().equals(subType)) {
        return s;
      }
    }
   
    throw new RFXComException("Unknown sub type " + subType);
  }
View Full Code Here

TOP

Related Classes of org.openhab.binding.rfxcom.internal.RFXComException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.