Package org.openhab.binding.rfxcom.internal

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


        state = new DecimalType(windSpeed);
     

      } 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

  @Override
  public State convertToState(RFXComValueSelector valueSelector)
      throws RFXComException {
   
    throw new RFXComException("Not supported");
  }
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

        default:
          break;
        }

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

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

      if (valueSelector == RFXComValueSelector.CONTACT) {

        switch (status) {
       
        case NORMAL:
          state = OpenClosedType.CLOSED;
          break;
        case NORMAL_DELAYED:
          state = OpenClosedType.CLOSED;
          break;
        case ALARM:
          state = OpenClosedType.OPEN;
          break;
        case ALARM_DELAYED:
          state = OpenClosedType.OPEN;
          break;
        default:
          break;

        }

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

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

      if (valueSelector == RFXComValueSelector.RAW_DATA) {

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

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

        state = new StringType(status.toString());

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

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

      if (valueSelector == RFXComValueSelector.SIGNAL_LEVEL) {

        state = new DecimalType(signalLevel);

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

        state = new DecimalType(batteryLevel);

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

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

      state = new DateTimeType();

    } else {

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

    return state;
View Full Code Here

    switch (valueSelector) {
    case COMMAND:
      if ((type instanceof OnOffType) && (subType == SubType.X10_SECURITY_REMOTE)) {
        status = (type == OnOffType.ON ? Status.ARM_AWAY_DELAYED : Status.DISARM);
      } else {
        throw new RFXComException("Can't convert " + type + " to Command");
      }
      break;

    case STATUS:
      if (type instanceof StringType) {
        status = Status.valueOf(type.toString());
      } else {
        throw new RFXComException("Can't convert " + type + " to Status");
      }
      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

          break;
        case MOOD5:
          state = new DecimalType(5);         
          break;
        default:
          throw new RFXComException("Unexpected mood: " + command);
        }
      } else {
        throw new RFXComException("Can't convert "
            + valueSelector + " to NumberItem");
      }

    } else if (valueSelector.getItemClass() == DimmerItem.class
        || valueSelector.getItemClass() == RollershutterItem.class) {

      if (valueSelector == RFXComValueSelector.DIMMING_LEVEL) {
        state = RFXComLighting5Message.getPercentTypeFromDimLevel(dimmingLevel);

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

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

      if (valueSelector == RFXComValueSelector.COMMAND) {

        switch (command) {
        case OFF:
        case GROUP_OFF:
          state = OnOffType.OFF;
          break;

        case ON:       
          state = OnOffType.ON;
          break;
       
        case SET_LEVEL:
        default:
          throw new RFXComException("Can't convert "
              + command + " to SwitchItem");
       
        }

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

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

      if (valueSelector == RFXComValueSelector.CONTACT) {

        switch (command) {
        case OFF:
        case GROUP_OFF:
          state = OpenClosedType.CLOSED;
          break;

        case ON:       
          state = OpenClosedType.OPEN;
          break;
       
        case SET_LEVEL:
        default:
          throw new RFXComException("Can't convert "
              + command + " to ContactItem");
        }

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

    } 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

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.