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

When the tutorial is over, the reader will continue with HandsOnLab which contains Samples1,2,3,4 Samples 5 and 14 were removed from the official table of content as they are not completed yet. All code is tested, files were moved from samples to their folder. Signed-off-by: Christian Tremblay <christian.tremblay@servisys.com>
23 lines
475 B
Python
23 lines
475 B
Python
#!/usr/bin/env python
|
|
|
|
"""
|
|
Simple implementation of a Client and Server
|
|
"""
|
|
|
|
from bacpypes.comm import Client, Server, bind
|
|
|
|
|
|
class MyServer(Server):
|
|
def indication(self, arg):
|
|
print('working on', arg)
|
|
self.response(arg.upper())
|
|
|
|
class MyClient(Client):
|
|
def confirmation(self, pdu):
|
|
print('thanks for the ', pdu)
|
|
|
|
if __name__ == '__main__':
|
|
c = MyClient()
|
|
s = MyServer()
|
|
bind(c, s)
|
|
c.request('hi') |