示例#1
0
        /* Nicolò:
         * used to stop the automatic setup thread
         */
        public static void StopSetup()
        {
            //----- check for existing auto-setup -----
            if (status != Lead.setting_up)
            {
                Console.WriteLine("There are not running auto-setup: request ignored");
                return;
            }

            //----- actually stop the C++ automatic setup -----
            stop_setup();

            //----- switch-off WiFi access point -----
            hotspot.stop();

            //----- remove the assigned delegate -----
            // autopresentation handling
            guiSetupCallback = null;
            // error handling
            ErrorHandlingCallback = null;
            errorNotified         = false;

            //----- update the status -----
            status = Lead.alt;
        }
示例#2
0
        /* Nicolò:
         * used to start the automatic setup (by DLL)
         */
        public static void StartSetup(GuiSetupCallback configurationListenedDelegate, GuiErrorCallback errorHandlingDelegate)
        {
            //----- check for existing auto-setup -----
            if (status == Lead.setting_up)
            {
                Console.WriteLine("Auto-setup already running: request ignored");
                return;
            }

            //----- set the DLL callback -----
            // autopresentation handling
            //dllSetupCallback = (string list_boards) => DllSetupPublish(list_boards);
            // error handling
            //dllErrorCallback = (string type, string message) => DllErrorPublish(type, message);
            Synchronizer.error_handling(dllErrorCallback);  //set in the C++

            //----- set the GUI callback -----
            // autopresentation handling
            Synchronizer.guiSetupCallback = configurationListenedDelegate;
            // error handling
            Synchronizer.guiErrorCallback = errorHandlingDelegate;
            Configuration fake_conf = new Configuration("Auto-setup");

            Log.InsertLog(fake_conf, Log.MessageType.configuration_update, "Changed the delegate that handles the errors");

            //----- update the target and status -----
            targetConfiguration = fake_conf;
            status = Lead.setting_up;

            //----- activate WiFi access point -----
            hotspot.start();

            //----- actually start the C++ automatic setup -----
            start_setup(dllSetupCallback, dllErrorCallback);
        }