startServer() public static method

public static startServer ( ) : string
return string
Ejemplo n.º 1
0
    // System Startup and Shutdown

    public IEnumerator startServerAndAllClients()
    {
        updateStatus = true;         // show status in loading screen
                #if UNITY_ANDROID && !UNITY_EDITOR
        //Start Server
        logStatus("Server opstarten...");
        Debug.Log("Started: " + FieldtripServicesControlerInterface.startServer());
        yield return(new WaitForSeconds(4));                //These waits are for the Services to have time to pass around their intents. Used to be 10.

        //Start Clients
        logStatus("Client opstarten...");
        Debug.Log("Started: " + FieldtripServicesControlerInterface.startClients());
        yield return(new WaitForSeconds(2));

        for (int i = 0; i < Config.bufferClientThreadList.Length; i++)
        {
            string clientname = Config.bufferClientThreadList[i];
            logStatus(clientname + "\nopstarten");
            FieldtripServicesControlerInterface.startThread(clientname);
            yield return(new WaitForSeconds(1));                    //These waits are for the Services to have time to pass around their intents.
        }
                #endif
        //Start Buffer
        logStatus("Verbinden met buffer...");
        bool inited = false;
        while (!inited)
        {
            inited = initializeBuffer();
            if (!inited)
            {
                yield return(new WaitForSeconds(1));
            }
        }

        logStatus("Wachten...");
        yield return(new WaitForSeconds(1));

        logStatus("Gereed!");
        updateStatus = false;
        LoadingButton.SetActive(true);
    }
Ejemplo n.º 2
0
	// System Startup and Shutdown

	public IEnumerator startServerAndAllClients(){
		#if !NOSERVICESCONTROLLER && UNITY_ANDROID && !UNITY_EDITOR
			//Start Server
			logStatus ("starting server...");
			Debug.Log ("Started: " + FieldtripServicesControlerInterface.startServer ());
			ServerStatusIcon.color = themeRed;
			yield return new WaitForSeconds (4);//These waits are for the Services to have time to pass around their intents. Used to be 10.
			updateServer = true;


			//Start Clients
			logStatus ("starting client...");
			Debug.Log ("Started: " + FieldtripServicesControlerInterface.startClients ());
			yield return new WaitForSeconds (1);

			//Start Threads
			logStatus ("loading threads...");
			bool museIsAvailable = false;
			string[] result = FieldtripServicesControlerInterface.getAllThreadsNamesAndIDs ();
			while (result.Length==0) {//Wait until the ClientsService updates the controller with all the available threads
				yield return new WaitForSeconds (1);
				result = FieldtripServicesControlerInterface.getAllThreadsNamesAndIDs ();
			}
			for (int i=0; i<result.Length; ++i) {
				if (result [i].Split (':') [1].Contains ("Muse")) {
					logStatus ("connecting to muse...");
					museIsAvailable = true;
					MuseStatusIcon.color = themeRed;
					museThreadID = int.Parse (result [i].Split (':') [0]);
					if (verbose) {
						Debug.Log ("Starting MuseConnection @ thread: " + museThreadID.ToString ());
					}
					FieldtripServicesControlerInterface.startThread (museThreadID);
				}
			}

			if (museIsAvailable) {
				//Start Buffer
				logStatus ("creating buffer...");
				initializeBuffer ();

				//Check Muse connection
				logStatus ("waiting for muse...");
				int museClientID = 0;
				int currentSamples = FieldtripServicesControlerInterface.getClientSamplesPut (museClientID);
				int samplesPut = currentSamples;
				while (samplesPut < 100) {//Wait for Muse to put some samples in the buffer
					yield return new WaitForSeconds (1);
					samplesPut = FieldtripServicesControlerInterface.getClientSamplesPut (museClientID);
				}
				MuseStatusIcon.color = themeGreen;

				logStatus ("sending events to buffer...");
				for (int i=0; i<result.Length; ++i) {
					if (result [i].Split (':') [1].Contains ("AlphaLat")) {
						ccThreadID = int.Parse (result [i].Split (':') [0]);
						Debug.Log ("Starting ContinuousClassifier @ thread: " + ccThreadID.ToString ());
						FieldtripServicesControlerInterface.startThread (ccThreadID);
					}
				}
				while (!clientIsConnected) {
					yield return new WaitForSeconds(0.5f);
				}

				logStatus ("check signal quality...");
				yield return new WaitForSeconds (2f);
			J

		#else
			//Start Buffer
			logStatus ("Connecting to buffer...");
			while ( ! bufferIsOn ){
				initializeBuffer ();
				if ( ! bufferIsOn ){
					//logStatus ("Couldnt connect, waiting");
					yield return new WaitForSeconds(1);
				}
			}
			logStatus ("Connected!");
			yield return new WaitForSeconds(1);
      #endif
		buttonColors.normalColor = themeGreen;
		buttonColors.highlightedColor = themeGreen;
		StatusButton.colors = buttonColors;
		logStatus ("beginnen");
		systemIsReady = true;
	}