yngwievanhendrix
8th December 2011, 12:57
Hello,
i am currently writing a software which has 2 classes "Robot" and "Camera" each of them represent a real physical devices, i control them each of them with through their own QTcpSocket connection. For example:
The Robot accepts a set of predefined commands like:
command: "SetJointsPositiona1 a2 ..a6" returns "true/false"
command: "GetJointsPosition" returns "a1 .. a6"
And many many more.
So since every Response must be handeled differently i have to create for each Command response an own slot. From my MainWindow (where the classes are defined) i emit a signal with "SetJointsPosition..." -> The Robot has a Slot: onSetJointsPositionSlot(QString) where the command is sent to the device. After receiving the answer the robot emits GotJointsPositionSignal(QString) which is connected to the GotJointsPositionSlot(Qstring) in Mainwindow.
But now come another two classes "Calibration" and "FollowMe".
In "Calibration" i send a signal to the robot to take some position, after the position is taken i send a signal to camera to check if the position is visible. If it is visible i send again a signal to the camera to acquire the position from camera perspective, and then back to the robot to acquire its position. And i repeat it for like 10 times. The thing is the command sent to the "Robot" or "Camera"
So you can see that the number of Signals and Slots that i have to write is enormous.
So here comes my question. How anyone manage this big number of Signals/Slots? How do you handle this kind of class-communication?
Thanks.
i am currently writing a software which has 2 classes "Robot" and "Camera" each of them represent a real physical devices, i control them each of them with through their own QTcpSocket connection. For example:
The Robot accepts a set of predefined commands like:
command: "SetJointsPositiona1 a2 ..a6" returns "true/false"
command: "GetJointsPosition" returns "a1 .. a6"
And many many more.
So since every Response must be handeled differently i have to create for each Command response an own slot. From my MainWindow (where the classes are defined) i emit a signal with "SetJointsPosition..." -> The Robot has a Slot: onSetJointsPositionSlot(QString) where the command is sent to the device. After receiving the answer the robot emits GotJointsPositionSignal(QString) which is connected to the GotJointsPositionSlot(Qstring) in Mainwindow.
But now come another two classes "Calibration" and "FollowMe".
In "Calibration" i send a signal to the robot to take some position, after the position is taken i send a signal to camera to check if the position is visible. If it is visible i send again a signal to the camera to acquire the position from camera perspective, and then back to the robot to acquire its position. And i repeat it for like 10 times. The thing is the command sent to the "Robot" or "Camera"
So you can see that the number of Signals and Slots that i have to write is enormous.
So here comes my question. How anyone manage this big number of Signals/Slots? How do you handle this kind of class-communication?
Thanks.