# Path: cbus/common.py
# class Application(IntEnum):
#     TEMPERATURE = 0x19
#     LIGHTING_FIRST = LIGHTING_30 = 0x30
#     LIGHTING_31 = 0x31
#     LIGHTING_32 = 0x32
#     LIGHTING_33 = 0x33
#     LIGHTING_34 = 0x34
#     LIGHTING_35 = 0x35
#     LIGHTING_36 = 0x36
#     LIGHTING_37 = 0x37
#     LIGHTING = LIGHTING_38 = 0x38
#     LIGHTING_39 = 0x39
#     LIGHTING_3a = 0x3a
#     LIGHTING_3b = 0x3b
#     LIGHTING_3c = 0x3c
#     LIGHTING_3d = 0x3d
#     LIGHTING_3e = 0x3e
#     LIGHTING_3f = 0x3f
#     LIGHTING_40 = 0x40
#     LIGHTING_41 = 0x41
#     LIGHTING_42 = 0x42
#     LIGHTING_43 = 0x43
#     LIGHTING_44 = 0x44
#     LIGHTING_45 = 0x45
#     LIGHTING_46 = 0x46
#     LIGHTING_47 = 0x47
#     LIGHTING_48 = 0x48
#     LIGHTING_49 = 0x49
#     LIGHTING_4a = 0x4a
#     LIGHTING_4b = 0x4b
#     LIGHTING_4c = 0x4c
#     LIGHTING_4d = 0x4d
#     LIGHTING_4e = 0x4e
#     LIGHTING_4f = 0x4f
#     LIGHTING_50 = 0x50
#     LIGHTING_51 = 0x51
#     LIGHTING_52 = 0x52
#     LIGHTING_53 = 0x53
#     LIGHTING_54 = 0x54
#     LIGHTING_55 = 0x55
#     LIGHTING_56 = 0x56
#     LIGHTING_57 = 0x57
#     LIGHTING_58 = 0x58
#     LIGHTING_59 = 0x59
#     LIGHTING_5a = 0x5a
#     LIGHTING_5b = 0x5b
#     LIGHTING_5c = 0x5c
#     LIGHTING_5d = 0x5d
#     LIGHTING_5e = 0x5e
#     LIGHTING_LAST = LIGHTING_5f = 0x5f
#     CLOCK = 0xDF
#     ENABLE = 0xCB
#     MASTER_APPLICATION = STATUS_REQUEST = 0xff
# 
# class ClockAttribute(IntEnum):
#     TIME = 0x01
#     DATE = 0x02
# 
# class ClockCommand(IntEnum):
#     UPDATE_NETWORK_VARIABLE = 0x08
#     REQUEST_REFRESH = 0x11
# 
# Path: cbus/protocol/application/sal.py
# class BaseApplication(abc.ABC):
#     """
#     Describes an decoder for all commands sent to an application.
#     """
# 
#     @staticmethod
#     @abc.abstractmethod
#     def supported_applications() -> FrozenSet[Union[int, Application]]:
#         """
#         Gets a list of supported Application IDs for the application.
# 
#         All application IDs must be in the range 0x00 - 0xff.
#         """
#         raise NotImplementedError('supported_applications')
# 
#     @staticmethod
#     @abc.abstractmethod
#     def decode_sals(data: bytes) -> Sequence[SAL]:
#         """
#         Decodes a SAL message
# 
#         """
#         raise NotImplementedError('decode_sals')
# 
# class SAL(abc.ABC):
#     """
#     Describes an decoder/encoder
# 
#     """
#     @abc.abstractmethod
#     def encode(self) -> bytes:
#         return bytes()
# 
#     @property
#     @abc.abstractmethod
#     def application(self) -> Union[int, Application]:
#         raise NotImplementedError('application')


import abc
import warnings
from datetime import date, time, datetime
from struct import unpack, pack
from typing import Union, Set, Sequence, Tuple, Optional
from six import byte2int
from cbus.common import Application, ClockAttribute, ClockCommand
from cbus.protocol.application.sal import BaseApplication, SAL
        """
        Decodes a clock broadcast application packet and returns it's SAL(s).

        :param data: SAL data to be parsed.
        :returns: The SAL messages contained within the given data.
        :rtype: list of cbus.protocol.application.clock.ClockSAL

        """
        output = []

        while data:
            # parse the data
            command_code = data[0]
            data = data[1:]

            if (command_code & 0x80) == 0x80:
                warnings.warn(
                    'Got unknown clock command {:x}; long form is not '
                    'used.'.format(command_code), UserWarning)
                break

            if (command_code & 0xE0) != 0:
                warnings.warn(
                    'Got unknown clock command {:x}; don\'t know how to '
                    'process the other bits.'.format(command_code),
                    UserWarning)
                break

            if (command_code & 0xf8) == ClockCommand.UPDATE_NETWORK_VARIABLE:
                sal, data = ClockUpdateSAL.decode(data, command_code)

# Path: cbus/common.py
# class Application(IntEnum):
#     TEMPERATURE = 0x19
#     LIGHTING_FIRST = LIGHTING_30 = 0x30
#     LIGHTING_31 = 0x31
#     LIGHTING_32 = 0x32
#     LIGHTING_33 = 0x33
#     LIGHTING_34 = 0x34
#     LIGHTING_35 = 0x35
#     LIGHTING_36 = 0x36
#     LIGHTING_37 = 0x37
#     LIGHTING = LIGHTING_38 = 0x38
#     LIGHTING_39 = 0x39
#     LIGHTING_3a = 0x3a
#     LIGHTING_3b = 0x3b
#     LIGHTING_3c = 0x3c
#     LIGHTING_3d = 0x3d
#     LIGHTING_3e = 0x3e
#     LIGHTING_3f = 0x3f
#     LIGHTING_40 = 0x40
#     LIGHTING_41 = 0x41
#     LIGHTING_42 = 0x42
#     LIGHTING_43 = 0x43
#     LIGHTING_44 = 0x44
#     LIGHTING_45 = 0x45
#     LIGHTING_46 = 0x46
#     LIGHTING_47 = 0x47
#     LIGHTING_48 = 0x48
#     LIGHTING_49 = 0x49
#     LIGHTING_4a = 0x4a
#     LIGHTING_4b = 0x4b
#     LIGHTING_4c = 0x4c
#     LIGHTING_4d = 0x4d
#     LIGHTING_4e = 0x4e
#     LIGHTING_4f = 0x4f
#     LIGHTING_50 = 0x50
#     LIGHTING_51 = 0x51
#     LIGHTING_52 = 0x52
#     LIGHTING_53 = 0x53
#     LIGHTING_54 = 0x54
#     LIGHTING_55 = 0x55
#     LIGHTING_56 = 0x56
#     LIGHTING_57 = 0x57
#     LIGHTING_58 = 0x58
#     LIGHTING_59 = 0x59
#     LIGHTING_5a = 0x5a
#     LIGHTING_5b = 0x5b
#     LIGHTING_5c = 0x5c
#     LIGHTING_5d = 0x5d
#     LIGHTING_5e = 0x5e
#     LIGHTING_LAST = LIGHTING_5f = 0x5f
#     CLOCK = 0xDF
#     ENABLE = 0xCB
#     MASTER_APPLICATION = STATUS_REQUEST = 0xff
# 
# class ClockAttribute(IntEnum):
#     TIME = 0x01
#     DATE = 0x02
# 
# class ClockCommand(IntEnum):
#     UPDATE_NETWORK_VARIABLE = 0x08
#     REQUEST_REFRESH = 0x11
# 
# Path: cbus/protocol/application/sal.py
# class BaseApplication(abc.ABC):
#     """
#     Describes an decoder for all commands sent to an application.
#     """
# 
#     @staticmethod
#     @abc.abstractmethod
#     def supported_applications() -> FrozenSet[Union[int, Application]]:
#         """
#         Gets a list of supported Application IDs for the application.
# 
#         All application IDs must be in the range 0x00 - 0xff.
#         """
#         raise NotImplementedError('supported_applications')
# 
#     @staticmethod
#     @abc.abstractmethod
#     def decode_sals(data: bytes) -> Sequence[SAL]:
#         """
#         Decodes a SAL message
# 
#         """
#         raise NotImplementedError('decode_sals')
# 
# class SAL(abc.ABC):
#     """
#     Describes an decoder/encoder
# 
#     """
#     @abc.abstractmethod
#     def encode(self) -> bytes:
#         return bytes()
# 
#     @property
#     @abc.abstractmethod
#     def application(self) -> Union[int, Application]:
#         raise NotImplementedError('application')


# Path: cbus/protocol/application/clock.py
import abc
import warnings
from datetime import date, time, datetime
from struct import unpack, pack
from typing import Union, Set, Sequence, Tuple, Optional
from six import byte2int
from cbus.common import Application, ClockAttribute, ClockCommand
from cbus.protocol.application.sal import BaseApplication, SAL

        """
        Decodes a clock broadcast application packet and returns it's SAL(s).

        :param data: SAL data to be parsed.
        :returns: The SAL messages contained within the given data.
        :rtype: list of cbus.protocol.application.clock.ClockSAL

        """
        output = []

        while data:
            # parse the data
            command_code = data[0]
            data = data[1:]

            if (command_code & 0x80) == 0x80:
                warnings.warn(
                    'Got unknown clock command {:x}; long form is not '
                    'used.'.format(command_code), UserWarning)
                break

            if (command_code & 0xE0) != 0:
                warnings.warn(
                    'Got unknown clock command {:x}; don\'t know how to '
                    'process the other bits.'.format(command_code),
                    UserWarning)
                break

            if (command_code & 0xf8) == ClockCommand.UPDATE_NETWORK_VARIABLE:
                sal, data = ClockUpdateSAL.decode(data, command_code)

            elif command_code == ClockCommand.REQUEST_REFRESH: