/* Forks a process to run in background and                            *
 * 1) Listen for server broadcasting its play time                     *
 * 2) Listen for clients indicating that they are ready to run         *
 */
void OMXPlayerSync::start ( bool m_pause )
{
   // Pause movie, unpause later via tcp communication

   if ( syncType == SYNC_SERVER )
   {
    if( m_pause )
    {
	pause = true;
	printf( "%d: Pause\n", port );
	pauseMovie();
    }
    printf("%d: Connect\n", port);
    setUpConnection ();
    printf("%d: Sync\n", port);
    syncServer ();
    unpauseMovie();
    printf("%d: Broadcast\n", port);
    ServerBcast();
   }
   else
   { //Client
    printf("%d: Pause\n", port);
    pauseMovie ();
    pause = true;
    printf("%d: Connect\n", port);
    setUpConnection ();
    printf("%d: Sync\n", port);
    syncClient ( false );
    printf("%d: Unpause\n", port);
    unpauseMovie ();
   }
   printf("%d: Go\n", port);
   displayVerbose ();
}
/* Forks a process to run in background and                            *
 * 1) Listen for server broadcasting its play time                     *
 * 2) Listen for clients indicating that they are ready to run         *
 */
void OMXPlayerSync::start ()
{
   // Pause movie, unpause later via tcp communication
   pauseMovie ();
   setUpConnection ();
   syncWithServer ();
   unpauseMovie ();
   displayVerbose ();
}
/*建立PC和仪器的连接*/
bool Cnnt::setUpConnection(QString connectionType, QString strAddress)
{
    this->connectionType=connectionType;
    this->strAddress=strAddress;
    return setUpConnection();
}