You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python newbie question: I try to wrap the xBee connection into a class. But the callback gets never called if it is a class method. If it is not in a class it works fine. What can I do?
It's hard to say what is wrong since your comment doesn't have any indentation, but try adding self to def handlePackets(self, data):.
Questions like this are better asked on a site like stackoverflow.com. GitHub Issues are generally meant for reporting issues with the code in this repository, not with individual issues with using it.
Python newbie question: I try to wrap the xBee connection into a class. But the callback gets never called if it is a class method. If it is not in a class it works fine. What can I do?
class Receiver:
def enter(self):
self.serial_port = serial.Serial('/dev/ttyUSB0', 115200)
self.xbee = ZigBee(self.serial_port, escaped=True, callback=self.handlePackets)
Logger.info('Receiver: enter')
return self
def exit(self ,type, value, traceback):
Logger.info('Receiver: exit')
self.serial_port.close()
def handlePackets(data):
Logger.info('Receiver: packet incoming')
The text was updated successfully, but these errors were encountered: