public MainPage() { InitializeComponent(); lText.Text = ""; indicatorVR.IsRunning = false; bleHandler = BLEHandler.GetHandler(); drivingHandler = DrivingHandler.GetHandler(); vrHandler = new VRHandler(lText, indicatorVR); if (!bleHandler.ble.IsOn) { DisplayAlert("", "Turn Bluetooth ON!", "Ok"); } }
private void HandleData(string command, string data) { dynamic receivedData = JsonConvert.DeserializeObject(data); switch (command) { case "chat": string directMessage = "[DM]:" + receivedData.message; Console.WriteLine("New message received: " + directMessage); break; case "broadcast": string broadcastMessage = "[BC]:" + receivedData.message; Console.WriteLine("New message received: " + broadcastMessage); break; case "course_start": string time = receivedData.time; string power = receivedData.power; string distance = receivedData.distance; BikeDataPackage package = new BikeDataPackage(time, power, "0", distance, "0"); StartCourse(package); break; case "course_stop": EndCourse(); break; case "set_power": int increment = receivedData.increment; SetPower(increment); break; case "client/id": ServerCommands.BikeID = Convert.ToInt32(receivedData.id); break; case "stop_vr": VRHandler.getInstance().ResetScene(); break; } }
static void Main(string[] args) { // The IP Address of the Server to connect to Console.WriteLine("--- Setting up VR ---"); VRHandler.getInstance().SetupScene(400, 400); Console.WriteLine("--- VR scene loaded succesfully ---"); Console.WriteLine(""); Console.WriteLine("--- Setting up Bicycle ---"); SerialDataHandler.getInstance().InitializeBike(_BIKE_MODE); VRHandler.getInstance().StartBikePoller(); Console.WriteLine("--- Bicycle setup succesful ---"); Console.WriteLine(""); Console.WriteLine("--- Connecting to Remote-Healthcare server ---"); //Connection con = new Connection("145.49.2.246", 6666); Connection con = new Connection(_SERVER_IP, 6666); Console.WriteLine("--- Connected sucesfully to Remote-Healthcare server ---"); Console.ReadLine(); }
private void EndCourse() { dataRequested = false; VRHandler.getInstance().ResetScene(); }
private void ClientGUI_Load(object sender, EventArgs e) { SerialDataHandler.getInstance().InitializeBike(1); VRHandler.getInstance().SetupScene(400, 400); }