1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00
bacpypes/samples/Tutorial/ClientAndServer.py
Christian Tremblay ebe2ba5abe Following along the documentation was hard because samples and tutorial files were lost among all samples. I created two folders : Tutorial and HandsOnLab. Tutorial is the folder with the first file someone will look at. The documentation invite the reader to start $python Tutorial/WhoIsIAm.py for example.
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>
2016-11-17 23:46:52 -05:00

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')