For the last time, use CODE tags when posting source code. See my signature if you do not know how to do that. I am tired of editing your posts to make them readable.

runCommands()
You cannot make this a single function. You need to break it up into multiple functions:

1. run first command
2. wait for response
3. run next command
4. wait for response
5. etc.

The way you implement this is to either have a queue of commands and you pop each command off the queue when it is time to run it, or you keep some kind of status variable that keeps track of which command is currently running and which one to run next. (Like your "command id").

You use signals and slots. In your parsedReceivedData method, if the previous command executed successfully, you emit a signal to "runNextCommand". In the slot that is connected to this signal, you assemble the command string and then send it to writeData. The serialReadyRead slot will be called when the command has finished, you parse the results, then go on to the next command or stop if there is an error.