Esempio n. 1
0
        private void SetButton_Click(object sender, EventArgs e)
        {
            PacketBicycleCommand pw = new PacketBicycleCommand($"PW {PowerTB.Text}", panel.id.Id);

            connection.writePacket(pw);
            Hide();
        }
Esempio n. 2
0
        private void sendButton_Click(object sender, EventArgs e)
        {
            foreach (var series in panel.returnChart().Series)
            {
                series.Points.Clear();
            }

            if (radioButton_Time.Checked)
            {
                //creating packets
                //Resetting Bike to set time and distance
                PacketBicycleCommand RS = new PacketBicycleCommand("RS", panel.id.Id);
                connection.writePacket(RS);
                //Waiting 5 secs to let bike reboot
                Thread.Sleep(5000);
                //Entering command mode to insert P- Commands
                PacketBicycleCommand CM = new PacketBicycleCommand("CM", panel.id.Id);
                connection.writePacket(CM);
                //Set required Time
                PacketBicycleCommand PT = new PacketBicycleCommand($"PT {this.timeTextBox.Text}", panel.id.Id);
                connection.writePacket(PT);
                //Set power level
                PacketBicycleCommand PW = new PacketBicycleCommand($"PW {this.PowerTextBox.Text}", panel.id.Id);
                connection.writePacket(PW);
                //Start handling Thread
                Thread thread = new Thread(new ThreadStart(SessionHandler));
                thread.Start();
            }
            else if (radioButton_Distance.Checked)
            {
                //creating packets
                //Resetting Bike to set time and distance
                PacketBicycleCommand RS = new PacketBicycleCommand("RS", panel.id.Id);
                connection.writePacket(RS);
                //Waiting 5 secs to let bike reboot
                Thread.Sleep(5000);
                //Entering command mode to insert P- Commands
                PacketBicycleCommand CM = new PacketBicycleCommand("CM", panel.id.Id);
                connection.writePacket(CM);
                //Set required Distance
                PacketBicycleCommand PD = new PacketBicycleCommand($"PD {this.distanceTextBox.Text}", panel.id.Id);
                connection.writePacket(PD);
                //Set power level
                PacketBicycleCommand PW = new PacketBicycleCommand($"PW {this.PowerTextBox.Text}", panel.id.Id);
                connection.writePacket(PW);
                //Start handling Thread
                Thread thread = new Thread(new ThreadStart(SessionHandler));
                thread.Start();
            }
            else
            {
                MessageBox.Show("Select the session type first!");
            }
            Hide();
        }
 public void receivePacketBicycleCommand(PacketBicycleCommand packetBicycleCommand)
 {
     _server.sendPacketToClient(packetBicycleCommand, packetBicycleCommand.destinationID);
     Console.WriteLine("Sent Command Pack to client");
 }
 public void recievePacketBicycleCommand(PacketBicycleCommand command)
 {
     //N.V.T in de monitor
     //this.client.sendCommand(command.command);
 }
 public void recievePacketBicycleCommand(PacketBicycleCommand command)
 {
     this.client.reader.sendCommand(command.command);
 }