Hi Karl,
The handling of the message is done in runConcurrentThread. It retrieves a response off the queue in the statement:
- Code: Select all
self.process = pluginGlobal['queues']['returnedResponse'].get()
and processes it in the statement
- Code: Select all
self.handleSqueezeboxServerResponse(indigo.devices[self.process[0]], self.process[1], self.process[2])
If I get an action that needs doing then I just dd it to the queue and it will be processed - look at any of the actions to see how this is done.
The Squeezebox Plugin has two threads that communicate with the Squeezebox server. The first is to send commands and receive responses and the second is just to listen for unsolicited messages that the Squeezebox server emits from time to time.
If you look at the plugin startup and Device startup routines you will see examples of setting up Queues.
It is Saturday evening here in the UK and so I will be away from my Mac until tomorrow now otherwise SWIMBO will get upset