It seems that from thinkgear.py, ThinkGearProtocol is just a factory that uses ThinkGearMetaClass to generate objects whose type is the type of data that was returned. The following code is
global packet_log packet_log = [] logging.basicConfig(level=logging.DEBUG) for pkt in ThinkGearProtocol('/dev/rfcomm9').get_packets(): packet_log.append(pkt)
It looks like it is designed to stream packets to a log in a single thread. For your application, you do not have to use a registrar (this can be confusing). It may be easier for you to use something like
def PacketHandler(packet): # Send an event out to objects for obj in listeners: obj.packet_callback(packet) for pkt in ThinkGearProtocol('/dev/rfcomm9').get_packets(): PacketHandler(pkt)
As an alternative, I do not use Tkinter, but if it has some kind of event handling method, you can use the above code to post events. Now you can stick your thinkgear.py module to your StripChart class by writing something that converts the incoming packet into raw data, and then sends that raw data to the chart. First, I would start playing with StripChart to see what it takes to get it working, and then write above the listener using a dummy handler to see if you can print the data stream (with actual values, not packets). From there it is a rather specific application.
It looks like
[thinkgear.py] β [Packet Thread (procs events)] β [Parser Data Parser (gets raw data)] β [Internal model] β [StripChart].
source share