Home > Back-end >  C application architecture to solve
C application architecture to solve

Time:11-23

C + + master of all stripes are good, ask a question, I want to be a c + + program, for example, the separation of interface and the underlying is, with Qt interface, the underlying using standard c + +
Specific functions include:
1. Using HTTP or websocket access to server data
2. Complex calculations, use floating point, by prescribing
3. The display waveform, want to smooth, not caton
4. Store data saved to the hard disk, CSV format time-stamped
5. A serial port communication, control other equipment
Embedded C, I do now to this project, whether to use multithreading framework, network data volume is a little big, about 10 ms update data at a time, computing is also want to use a lot of floating point such as prescribing, if use the standard C + + 11 multi-threaded, architecture don't know what to do, open five threads directly, and then use a communication between threads, could you recommend a good architecture can, thank you

CodePudding user response:

Network receives generally use the child thread,
If the business is very time-consuming, also YaoZi thread,

CodePudding user response:

Assessment is going to run the project equipment hardware conditions, choosing the appropriate architecture scheme,

CodePudding user response:

reference 1st floor smwhotjay response:
network receives the general with the child thread,
Business if very time consuming and YaoZi threads,

Is, open multiple threads, each thread to run their own task, use global variables communication is

CodePudding user response:

Bosses, give some recommendations on architecture, a good architecture is half the success, thank you

CodePudding user response:

This says to not be clear about one or two sentences, in short:
1, IO thread and thread work
2, the separation of data and interface
3, according to some principles, because some can not have a
4, it is suggested that the overall design follow some basic design principles, there are a lot of

CodePudding user response:

1, use a single thread server data reception
2, data computing single-threaded
3, can show the UI qt main thread, adopt the model/view mode
4, data storage can also open a separate thread
5, a serial port communication can do a thread
Communication between threads using qt, then use signal channel, c + + has a similar signal trough callback mechanism, do not use global variables, will make the code becomes complicated,

CodePudding user response:

Using multithreading there's nothing wrong in the functional module in a thread with a server communication thread do equipment control a serial port can also open a separate thread to make interaction with main interface (and even can also through the network interaction, so that your interface module can be placed in a single console on the machine)

CodePudding user response:

Using QT is very convenient, there seems to be a direct on QT libraries can support serial, but drawing is a little trouble, QT has a control can be used directly, but want to charge (not pay) there will be a watermark,
This use multithreading is not difficult to design, design reasonable, feeling how many threads in less than the communication,
  • Related