I have implemented four functions. It's a master slave configuration, in which master sends two functions cyclically and slave receives it. After receiving those two messages, slave responds with one more message and master responds to the slave's message. These messages should be exchanged between master and slave cyclically for 10ms. The first iteration starts at 10ms, but from second iteration, there should be a offset introduced [Offset : 0 to 10ms] and jitter from 0 to 1ms. How to implement this logic? I have tried doing it but couldn't really achieve it.
handleMasterSyncStateMachine(sockfd, client_address, idleStateStartTime, startTime, Offset, masterCycleTime);
handleSlaveSyncStateMachine(sockfd, client_address, idleStateStartTime, startTime, Offset, slaveCycleTime);
handleSlaveDelayStateMachine(sockfd, client_address, idleStateStartTime, startTime, Offset);
handleMasterDelayStateMachine(sockfd, client_address, idleStateStartTime, startTime, Offset);
I inserted a while loop which ran for 15 iterations. But I want the described logic to implement