Set up JUCE project with asio library - where to put my I/O communication class

Hi,

I’ve got a very basic question:
I want to have a app that interacts with a microcontroller, connected via a virtual Com port. As JUCE has no own implementation of a serial interface, I found the asio library to be a good option.

In fact this is my first “real” JUCE app and my first GUI app after playing around with the examples, so I’m unsure where to put certain code.

I will build a wrapper class handling I/O with async operations. This class is always listening for new data through

async_read_some

Incoming data invokes a callback function that somehow sets certain parameters controlling some audio processing and updates the corresponding sliders on the GUI. There will also be the possibility of sending parameters the other way round, so some buttons and sliders will call a member function of my I/O class, which then will invoke async_write.

Now I’m not sure where to put the instance of my I/O class. My first idea is to let it be a private member of the MainContentComponent. But I’m not completely sure if this is the way it should be done.

So in the end my question is fairly simple: How is it done correct?