Usage ===== see L{DPTXlatorBoolean} @author: Frédéric Mantegazza @author: B. Malinowsky @copyright: (C) 2013-2015 Frédéric Mantegazza @copyright: (C) 2006, 2011 B. Malinowsky @license: GPL """ import struct from pyknyx.services.logger import logging; logger = logging.getLogger(__name__) from pyknyx.core.dptXlator.dptId import DPTID from pyknyx.core.dptXlator.dpt import DPT from pyknyx.core.dptXlator.dptXlatorBase import DPTXlatorBase, DPTXlatorValueError class DPTXlator4ByteUnsigned(DPTXlatorBase): """ DPTXlator class for 4-Byte-Unsigned (U32) KNX Datapoint Type - 4 Byte Unsigned: UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU - U: Bytes [0:4294967295] . """ DPT_Generic = DPT("12.xxx", "Generic", (0, 4294967295))
Implements ========== - B{GroupSocketListen} @author: Frédéric Mantegazza @copyright: (C) 2013-2015 Frédéric Mantegazza @license: GPL """ import os import sys from pyknyx.services.logger import logging logger = logging.getLogger(__name__) from pyknyx.stack.backends.eibd.eibConnection import EIBConnection, EIBBuffer, EIBAddr class EIBAddress(EIBAddr): def toGroup(self): return "%d/%d/%d" % ((self.data >> 11) & 0x1f, (self.data >> 8) & 0x07, (self.data) & 0xff) def toIndividual(self): return "%d.%d.%d" % ((self.data >> 12) & 0x0f, (self.data >> 8) & 0x0f, (self.data) & 0xff) class GroupSocketListen(object): """
# -*- coding: utf-8 -*- from pyknyx.core.dptXlator.dptXlator2ByteSigned import * import unittest # Mute logger from pyknyx.services.logger import logging logger = logging.getLogger(__name__) logging.getLogger("pyknyx").setLevel(logging.ERROR) class DPT2ByteSignedTestCase(unittest.TestCase): def setUp(self): self.testTable = ( (-32768, 0x8000, b"\x80\x00"), (-4, 0xfffc, b"\xff\xfc"), (-1, 0xffff, b"\xff\xff"), (0, 0x0000, b"\x00\x00"), (1, 0x0001, b"\x00\x01"), (32767, 0x7fff, b"\x7f\xff"), ) self.dptXlator = DPTXlator2ByteSigned("8.xxx") def tearDown(self): pass #def test_constructor(self): #print self.dptXlator.handledDPT def test_typeSize(self):