Exemple #1
0
        public void Connect(string application = "", string user = "", string site = "")
        {
            if (IsConnected)
            {
                return;
            }

            var streams = _bluetoothService.Connect(_device);

            Unpaired = false;

            phx42 = new Phx42(streams.InputStream,
                              streams.OutputStream,
                              _fileManager,
                              _device.Name, TimeMongerService, application, user, site);

            IsConnected = true;

            phx42.Error                  += Phx42OnError;
            phx42.CommandError           += Phx42OnCommandError;
            phx42.WriteFlashProgress     += Phx42OnWriteFlashProgress;
            phx42.ReadFlashProgress      += Phx42OnReadFlashProgress;
            phx42.UpdateFirmwareProgress += Phx42OnUpdateFirmwareProgress;
            phx42.GetLogsProgress        += Phx42OnGetLogsProgress;
            phx42.DataPolled             += Phx42OnDataPolled;
            Status = "Connected";
            OnConnected(new DeviceEventArgs(this));
        }