Пример #1
0
        public static string PreRegisterHub(string addr)
        {
            string errmsg = "";

            InternalStuff.initYoctopuceLibrary(ref errmsg, true);

            InternalStuff.log("Pre-registering Hub (" + addr + ") ...");
            if (YAPI.PreregisterHub(addr, ref errmsg) != YAPI.SUCCESS)
            {
                string msg = addr + " Hub  asynch registering failed (" + errmsg + ")";
                return(msg);
            }

            try { YAPI.UpdateDeviceList(ref errmsg); } catch (Exception) { }
            return("");
        }
Пример #2
0
        private void AddrTimer_Tick(object sender, EventArgs e)
        {
            string errmsg = "";

            AddrTimer.Enabled = false;
            ClearPreviousRegister();
            CurrentConnectionAddr = DeviceAddr.Text;
            if (CurrentConnectionAddr != "")
            {
                LogManager.Log("registering " + CurrentConnectionAddr);
                if (YAPI.PreregisterHub(CurrentConnectionAddr, ref errmsg) != YAPI.SUCCESS)
                {
                    ChooseSensorErrorLabel.Text = "cannot connect to " + CurrentConnectionAddr + " : " + errmsg;
                    LogManager.Log(ChooseSensorErrorLabel.Text);
                    return;
                }
            }
        }
Пример #3
0
        private void RadioBtVirtualHub_Click(object sender, EventArgs e)
        {
            string errmsg = "";

            if (currentConnectionType == ConnectionType.LOCALVIRTUALHUB)
            {
                return;
            }
            NextButton.Enabled          = false;
            ChooseSensorErrorLabel.Text = "";
            ClearPreviousRegister();
            currentConnectionType = ConnectionType.LOCALVIRTUALHUB;
            LogManager.Log("registering 127.0.0.1");
            if (YAPI.PreregisterHub("127.0.0.1", ref errmsg) != YAPI.SUCCESS)
            {
                ChooseSensorErrorLabel.Text = "Cannot use Local VirtualHub: " + errmsg;
                LogManager.Log(ChooseSensorErrorLabel.Text);
                return;
            }
            ChooseSensorTitle.Text = "Please wait...";
        }
Пример #4
0
        private void RadioBtRemote_Click(object sender, EventArgs e)
        {
            NextButton.Enabled = false;
            string errmsg = "";

            if (currentConnectionType == ConnectionType.IP)
            {
                return;
            }
            NextButton.Enabled          = false;
            ChooseSensorErrorLabel.Text = "";
            ClearPreviousRegister();
            currentConnectionType = ConnectionType.IP;
            if (CurrentConnectionAddr != "")
            {
                if (YAPI.PreregisterHub(DeviceAddr.Text, ref errmsg) != YAPI.SUCCESS)
                {
                    CurrentConnectionAddr       = "";
                    ChooseSensorErrorLabel.Text = "Cannot use this IP address: " + errmsg; return;
                }
                ChooseSensorTitle.Text = "Please wait...";
            }
        }