1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00

Merge branch 'issue-3'

This commit is contained in:
Joel Bender 2015-07-23 02:51:19 -04:00
commit f7da4242a9
3 changed files with 18 additions and 12 deletions

View File

@ -267,6 +267,8 @@ class Client:
bind(self, server)
def request(self, *args, **kwargs):
if _debug: Client._debug("request %r %r", args, kwargs)
if not self.clientPeer:
raise ConfigurationError("unbound client")
self.clientPeer.indication(*args, **kwargs)
@ -304,6 +306,8 @@ class Server:
raise NotImplementedError("indication must be overridden")
def response(self, *args, **kwargs):
if _debug: Server._debug("response %r %r", args, kwargs)
if not self.serverPeer:
raise ConfigurationError("unbound server")
self.serverPeer.confirmation(*args, **kwargs)
@ -370,14 +374,12 @@ class Echo(Client, Server):
def confirmation(self, *args, **kwargs):
if _debug: Echo._debug("confirmation %r %r", args, kwargs)
if self.serverPeer:
self.request(*args, **kwargs)
self.request(*args, **kwargs)
def indication(self, *args, **kwargs):
if _debug: Echo._debug("indication %r %r", args, kwargs)
if self.clientPeer:
self.response(*args, **kwargs)
self.response(*args, **kwargs)
bacpypes_debugging(Echo)

View File

@ -265,6 +265,8 @@ class Client:
bind(self, server)
def request(self, *args, **kwargs):
if _debug: Client._debug("request %r %r", args, kwargs)
if not self.clientPeer:
raise ConfigurationError("unbound client")
self.clientPeer.indication(*args, **kwargs)
@ -301,6 +303,8 @@ class Server:
raise NotImplementedError("indication must be overridden")
def response(self, *args, **kwargs):
if _debug: Server._debug("response %r %r", args, kwargs)
if not self.serverPeer:
raise ConfigurationError("unbound server")
self.serverPeer.confirmation(*args, **kwargs)
@ -365,14 +369,12 @@ class Echo(Client, Server):
def confirmation(self, *args, **kwargs):
if _debug: Echo._debug("confirmation %r %r", args, kwargs)
if self.serverPeer:
self.request(*args, **kwargs)
self.request(*args, **kwargs)
def indication(self, *args, **kwargs):
if _debug: Echo._debug("indication %r %r", args, kwargs)
if self.clientPeer:
self.response(*args, **kwargs)
self.response(*args, **kwargs)
#
# ServiceAccessPoint

View File

@ -275,6 +275,8 @@ class Client:
bind(self, server)
def request(self, *args, **kwargs):
if _debug: Client._debug("request %r %r", args, kwargs)
if not self.clientPeer:
raise ConfigurationError("unbound client")
self.clientPeer.indication(*args, **kwargs)
@ -311,6 +313,8 @@ class Server:
raise NotImplementedError("indication must be overridden")
def response(self, *args, **kwargs):
if _debug: Server._debug("response %r %r", args, kwargs)
if not self.serverPeer:
raise ConfigurationError("unbound server")
self.serverPeer.confirmation(*args, **kwargs)
@ -375,14 +379,12 @@ class Echo(Client, Server):
def confirmation(self, *args, **kwargs):
if _debug: Echo._debug("confirmation %r %r", args, kwargs)
if self.serverPeer:
self.request(*args, **kwargs)
self.request(*args, **kwargs)
def indication(self, *args, **kwargs):
if _debug: Echo._debug("indication %r %r", args, kwargs)
if self.clientPeer:
self.response(*args, **kwargs)
self.response(*args, **kwargs)
#
# ServiceAccessPoint