Permalink
Browse files

Updates Igor Pelesic

  • Loading branch information...
dschachinger committed Dec 12, 2016
1 parent e766a64 commit 4369f47ca71372065d7fc57a5163b6819e132f01
@@ -335,6 +335,47 @@ void write(GroupAddress dst, boolean value) throws KNXTimeoutException,
*/
void write(GroupAddress dst, float value) throws KNXException;
/**
* Reads a 4 byte KNX unsigned int datapoint value from a group destination.
* <p>
*
* @param dst
* group destination to read from
* @return the read value of type float
* @throws KNXTimeoutException
* on a timeout during send or no read response was received
* @throws KNXInvalidResponseException
* on invalid read response message
* @throws KNXLinkClosedException
* if network link to KNX network is closed
* @throws KNXFormatException
* on translation problem of the response data
* @throws KNXException
* on other read problems
*/
long readUint(GroupAddress dst) throws KNXException;
/**
* Writes a 4 byte KNX unsigned int datapoint value to a group destination.
* <p>
*
* @param dst
* group destination to write to
* @param value
* float value to write
* @throws KNXTimeoutException
* on a timeout during send
* @throws KNXFormatException
* on translation problem of the supplied datapoint value
* @throws KNXLinkClosedException
* if network link to KNX network is closed
* @throws KNXException
* on other write problems
*/
void write(GroupAddress dst, long value) throws KNXException;
/**
* Reads a string datapoint value from a group destination.
* <p>
@@ -34,6 +34,7 @@
import at.ac.tuwien.auto.calimero.dptxlator.DPTXlator;
import at.ac.tuwien.auto.calimero.dptxlator.DPTXlator2ByteFloat;
import at.ac.tuwien.auto.calimero.dptxlator.DPTXlator3BitControlled;
import at.ac.tuwien.auto.calimero.dptxlator.DPTXlator4ByteUnsigned;
import at.ac.tuwien.auto.calimero.dptxlator.DPTXlator8BitUnsigned;
import at.ac.tuwien.auto.calimero.dptxlator.DPTXlatorBoolean;
import at.ac.tuwien.auto.calimero.dptxlator.DPTXlatorString;
@@ -322,8 +323,38 @@ public void write(GroupAddress dst, float value) throws KNXTimeoutException,
t.setValue(value);
write(dst, priority, t);
}
/*
* (non-Javadoc)
*
* @see tuwien.auto.calimero.process.ProcessCommunicator#readUInt
* (tuwien.auto.calimero.GroupAddress)
*/
public long readUint(GroupAddress dst)
throws KNXTimeoutException, KNXRemoteException, KNXLinkClosedException, KNXFormatException {
final byte[] apdu = readFromGroup(dst, priority, 4, 4);
final DPTXlator4ByteUnsigned t = new DPTXlator4ByteUnsigned(DPTXlator4ByteUnsigned.DPT_VALUE_4_UCOUNT);
extractGroupASDU(apdu, t);
return t.getValueUnsigned();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see tuwien.auto.calimero.process.ProcessCommunicator#write
* (tuwien.auto.calimero.GroupAddress, long)
*/
public void write(GroupAddress dst, long value)
throws KNXTimeoutException, KNXFormatException, KNXLinkClosedException {
final DPTXlator4ByteUnsigned t = new DPTXlator4ByteUnsigned(DPTXlator4ByteUnsigned.DPT_VALUE_4_UCOUNT);
t.setValue(value);
write(dst, priority, t);
}
/*
* (non-Javadoc)
*
* @see tuwien.auto.calimero.process.ProcessCommunicator#readString
* (tuwien.auto.calimero.GroupAddress)
*/
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2013, Automation Systems Group, TU Wien.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the IoTSyS project.
******************************************************************************/
package at.ac.tuwien.auto.iotsys.commons.obix.objects.general.datapoint;
public interface DPST_12_1 extends DPT_12
{
public static final String CONTRACT = "knx:DPST-12-1";
}
@@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright (c) 2013, Automation Systems Group, TU Wien.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the IoTSyS project.
******************************************************************************/
package at.ac.tuwien.auto.iotsys.commons.obix.objects.general.datapoint;
import obix.Int;
public interface DPT_12 extends DataPoint
{
public static final String CONTRACT = "knx:DPT-12";
public Int value();
}
@@ -0,0 +1,56 @@
/*******************************************************************************
* Copyright (c) 2013
* Institute of Computer Aided Automation, Automation Systems Group, TU Wien.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the IoTSyS project.
******************************************************************************/
package at.ac.tuwien.auto.iotsys.commons.obix.objects.general.datapoint.impl;
import obix.Contract;
import obix.Obj;
import at.ac.tuwien.auto.iotsys.commons.obix.objects.general.datapoint.DPST_12_1;
public abstract class DPST_12_1_Impl extends DPT_12_Impl implements DPST_12_1
{
public DPST_12_1_Impl(String name, String displayName, String display, boolean writable, boolean readable)
{
// constructor)
super(name, displayName, display, writable, readable);
// contract
this.addIs(new Contract(DPST_12_1.CONTRACT));
}
@Override
public void writeObject(Obj input)
{
super.writeObject(input);
}
}
@@ -0,0 +1,108 @@
/*******************************************************************************
* Copyright (c) 2013
* Institute of Computer Aided Automation, Automation Systems Group, TU Wien.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the IoTSyS project.
******************************************************************************/
package at.ac.tuwien.auto.iotsys.commons.obix.objects.general.datapoint.impl;
import java.util.logging.Logger;
import obix.Bool;
import obix.Contract;
import obix.Int;
import obix.Obj;
import obix.Real;
import obix.Uri;
import at.ac.tuwien.auto.iotsys.commons.obix.objects.general.datapoint.DPT_12;
public abstract class DPT_12_Impl extends DatapointImpl implements DPT_12
{
private static final Logger log = Logger.getLogger(DPT_9_Impl.class.getName());
private Int value = new Int();
public DPT_12_Impl(String name, String displayName, String display, boolean writable, boolean readable)
{
super(name, displayName, display, writable, readable);
this.addIs(new Contract(DPT_12.CONTRACT));
this.value.setName("value");
this.value.setHref(new Uri("value"));
this.value.setWritable(writable);
this.value.setReadable(readable);
this.value.setNull(true);
this.add(value);
}
@Override
public boolean isValueWritable()
{
return value.isWritable();
}
@Override
public boolean isValueReadable()
{
return value.isReadable();
}
@Override
public Int value()
{
return value;
}
@Override
public void writeObject(Obj input)
{
if (this.value.isWritable())
{
if (input instanceof DPT_12)
{
DPT_12 in = (DPT_12) input;
log.info("Writing on data point.");
this.value.set(in.value().get());
}
else if (input instanceof Bool)
{
this.value.set(((Bool) input).get());
}
else if (input instanceof Real)
{
this.value.set(((Real) input).get());
}
else if (input instanceof Int)
{
this.value.set(((Int) input).get());
}
}
}
}
Oops, something went wrong.

0 comments on commit 4369f47

Please sign in to comment.