# Path: BAC0/core/io/IOExceptions.py
# class OutOfServiceNotSet(Exception):
#     """
#     This exception is used when trying to simulate a point and the out of service property is false.
#     """
# 
#     pass
# 
# class OutOfServiceSet(Exception):
#     """
#     This exception is used when trying to set the out of service property to
#     false to release the simulation...and it doesn't work.
#     """
# 
#     pass
# 
# class NoResponseFromController(Exception):
#     """
#     This exception is used when trying to read or write and there is not answer.
#     """
# 
#     pass
# 
# class ApplicationNotStarted(Exception):
#     """
#     Application not started, no communication available.
#     """
# 
#     pass


from .IOExceptions import (
    OutOfServiceNotSet,
    OutOfServiceSet,
    NoResponseFromController,
    ApplicationNotStarted,
)

#
# Copyright (C) 2015 by Christian Tremblay, P.Eng <christian.tremblay@servisys.com>
# Licensed under LGPLv3, see file LICENSE in this source tree.
#
"""
Simulate.py - simulate the value of controller I/O values
"""

# --- standard Python modules ---
# --- 3rd party modules ---
# --- this application's modules ---


# ------------------------------------------------------------------------------


class Simulation:
    """
    Global informations regarding simulation
    """

    def sim(self, args):
        """
        Simulate I/O points by setting the Out_Of_Service property, then doing a
        WriteProperty to the point's Present_Value.

        :param args: String with <addr> <type> <inst> <prop> <value> [ <indx> ] [ <priority> ]

        """
        if not self._started:

# Path: BAC0/core/io/IOExceptions.py
# class OutOfServiceNotSet(Exception):
#     """
#     This exception is used when trying to simulate a point and the out of service property is false.
#     """
# 
#     pass
# 
# class OutOfServiceSet(Exception):
#     """
#     This exception is used when trying to set the out of service property to
#     false to release the simulation...and it doesn't work.
#     """
# 
#     pass
# 
# class NoResponseFromController(Exception):
#     """
#     This exception is used when trying to read or write and there is not answer.
#     """
# 
#     pass
# 
# class ApplicationNotStarted(Exception):
#     """
#     Application not started, no communication available.
#     """
# 
#     pass


# Path: BAC0/core/io/Simulate.py
from .IOExceptions import (
    OutOfServiceNotSet,
    OutOfServiceSet,
    NoResponseFromController,
    ApplicationNotStarted,
)

#
# Copyright (C) 2015 by Christian Tremblay, P.Eng <christian.tremblay@servisys.com>
# Licensed under LGPLv3, see file LICENSE in this source tree.
#
"""
Simulate.py - simulate the value of controller I/O values
"""

# --- standard Python modules ---
# --- 3rd party modules ---
# --- this application's modules ---


# ------------------------------------------------------------------------------


class Simulation:
    """
    Global informations regarding simulation
    """

    def sim(self, args):
        """
        Simulate I/O points by setting the Out_Of_Service property, then doing a
        WriteProperty to the point's Present_Value.

        :param args: String with <addr> <type> <inst> <prop> <value> [ <indx> ] [ <priority> ]

        """
        if not self._started:

            raise ApplicationNotStarted("BACnet stack not running - use startApp()")
