# Path: thingsboard_gateway/connectors/bacnet/bacnet_utilities/tb_gateway_bacnet_device.py
# class TBBACnetDevice(LocalDeviceObject):
#     def __init__(self, configuration):
#         assert configuration is not None
#         super().__init__(**configuration)
# 
# Path: thingsboard_gateway/connectors/connector.py
# class Connector(ABC):
#     def open(self):
#     def close(self):
#     def get_name(self):
#     def is_connected(self):
#     def on_attributes_update(self, content):
#     def server_side_rpc_handler(self, content):


from bacpypes.apdu import APDU, IAmRequest, ReadPropertyRequest, SimpleAckPDU, WhoIsRequest, WritePropertyRequest
from bacpypes.app import BIPSimpleApplication
from bacpypes.constructeddata import Any
from bacpypes.core import deferred
from bacpypes.iocb import IOCB
from bacpypes.object import get_datatype
from bacpypes.pdu import Address, GlobalBroadcast
from bacpypes.primitivedata import Null, ObjectIdentifier, Atomic, Integer, Real, Unsigned
from thingsboard_gateway.connectors.bacnet.bacnet_utilities.tb_gateway_bacnet_device import TBBACnetDevice
from thingsboard_gateway.connectors.connector import log
#     Copyright 2022. ThingsBoard
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.




class TBBACnetApplication(BIPSimpleApplication):
    def __init__(self, connector, configuration):
        try:
            self.__config = configuration
            self.__connector = connector
            assert self.__config is not None
            assert self.__config.get("general") is not None
            self.requests_in_progress = {}
            self.discovered_devices = {}

# Path: thingsboard_gateway/connectors/bacnet/bacnet_utilities/tb_gateway_bacnet_device.py
# class TBBACnetDevice(LocalDeviceObject):
#     def __init__(self, configuration):
#         assert configuration is not None
#         super().__init__(**configuration)
# 
# Path: thingsboard_gateway/connectors/connector.py
# class Connector(ABC):
#     def open(self):
#     def close(self):
#     def get_name(self):
#     def is_connected(self):
#     def on_attributes_update(self, content):
#     def server_side_rpc_handler(self, content):


# Path: thingsboard_gateway/connectors/bacnet/bacnet_utilities/tb_gateway_bacnet_application.py
from bacpypes.apdu import APDU, IAmRequest, ReadPropertyRequest, SimpleAckPDU, WhoIsRequest, WritePropertyRequest
from bacpypes.app import BIPSimpleApplication
from bacpypes.constructeddata import Any
from bacpypes.core import deferred
from bacpypes.iocb import IOCB
from bacpypes.object import get_datatype
from bacpypes.pdu import Address, GlobalBroadcast
from bacpypes.primitivedata import Null, ObjectIdentifier, Atomic, Integer, Real, Unsigned
from thingsboard_gateway.connectors.bacnet.bacnet_utilities.tb_gateway_bacnet_device import TBBACnetDevice
from thingsboard_gateway.connectors.connector import log

#     Copyright 2022. ThingsBoard
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.




class TBBACnetApplication(BIPSimpleApplication):
    def __init__(self, connector, configuration):
        try:
            self.__config = configuration
            self.__connector = connector
            assert self.__config is not None
            assert self.__config.get("general") is not None
            self.requests_in_progress = {}
            self.discovered_devices = {}

            self.__device = TBBACnetDevice(self.__config["general"])