コード例 #1
0
  /**
   * Constuctor of the device.
   *
   * @param deviceId
   * @throws SupportedMethodsException
   */
  public TellstickDevice(int deviceId) throws SupportedMethodsException {
    supportedMethodsCheck();
    this.deviceId = deviceId;

    // Get name
    this.name = JNA.getPointerValue(JNA.CLibrary.INSTANCE.tdGetName(deviceId));
    //	JNA.CLibrary.INSTANCE.tdReleaseString(name);

    // Get model
    this.model = JNA.getPointerValue(JNA.CLibrary.INSTANCE.tdGetModel(deviceId));
    //	JNA.CLibrary.INSTANCE.tdReleaseString(model);

    // Get protocol
    this.protocol = JNA.getPointerValue(JNA.CLibrary.INSTANCE.tdGetProtocol(deviceId));
    //	JNA.CLibrary.INSTANCE.tdReleaseString(protocol);

    // Get the device type.
    this.deviceType = DeviceType.getDeviceTypeById(JNA.CLibrary.INSTANCE.tdGetDeviceType(deviceId));
  }
コード例 #2
0
 /**
  * Gets parameter from device.
  *
  * @param attribute
  * @param defaultVal
  * @return
  */
 public String getParameter(String attribute, String defaultVal) {
   return JNA.getPointerValue(
       JNA.CLibrary.INSTANCE.tdGetDeviceParameter(getId(), attribute, defaultVal));
 }