public async void SearchDevices() { Btc.State = ConnectionState.Enumerating; await Btc.LookForBluetoothDevices(); Btc.State = ConnectionState.Enumerated; }
public async void ConnectToBluetooth(DeviceInformation device) { Debugger.ReportToDebugger(this, "Connecting to Device ...", Debugger.Device.Pc); await Btc.ConnectToDevice(device); Btc.SendCommand(Command.ArduinoCommand(CommandName.Connected)); }
public void SetAllTiles(Color color) { Table.SetAllTiles(color); Btc.SendCommand(Command.ArduinoCommand(CommandName.SetAllPixel, new List <string>() { color.R.ToString(), color.G.ToString(), color.B.ToString() })); }
public void GameUserInput(Game.GameUserInput direction) { byte directionCommand = 0; switch (direction) { case Game.GameUserInput.Right: directionCommand = 0; if (CurrentGame.Name == "Snake" && CurrentGameUserInput == Game.GameUserInput.Left) { return; } CurrentGameUserInput = Game.GameUserInput.Right; break; case Game.GameUserInput.Up: directionCommand = 1; if (CurrentGame.Name == "Snake" && CurrentGameUserInput == Game.GameUserInput.Down) { return; } CurrentGameUserInput = Game.GameUserInput.Up; break; case Game.GameUserInput.Left: directionCommand = 2; if (CurrentGame.Name == "Snake" && CurrentGameUserInput == Game.GameUserInput.Right) { return; } CurrentGameUserInput = Game.GameUserInput.Left; break; case Game.GameUserInput.Down: directionCommand = 3; if (CurrentGame.Name == "Snake" && CurrentGameUserInput == Game.GameUserInput.Up) { return; } CurrentGameUserInput = Game.GameUserInput.Down; break; case Game.GameUserInput.Action: directionCommand = 4; if (CurrentGame.Name == "Snake") { return; } CurrentGameUserInput = Game.GameUserInput.Action; break; } Btc.SendCommand(Command.ArduinoCommand(CommandName.MoveDirection, new List <string>() { directionCommand.ToString() })); }
/*private static void OnFinishedFileTask(object sender, PortableLibrary1.TestModule.FileTaskEventArgs e) * { * * }*/ public void StartGame(Game g) { if (g != null) { ModiIsPlaying = true; CurrentGameUserInput = Game.GameUserInput.Right; CurrentGame = g; Btc.SendCommand(Command.ArduinoCommand(g.CommandName)); } }
public void PlayMusic(Track track) { if (track != null) { MusicIsPlaying = true; Btc.SendCommand(Command.ArduinoCommand(CommandName.PlayMusic, new List <string>() { track.StorageName })); } }
public void Disconnect() { if (ModiIsPlaying) { StopModi(); } if (MusicIsPlaying) { StopMusic(); } Btc.SendCommand(Command.ArduinoCommand(CommandName.Disconnect)); Btc.Disconnect(); }
public void StartModi(Model.Modi modi) { /*var fileManager = new PortableLibrary1.TestModule.FileTask(); * fileManager.TaskCompletedEvent += new EventHandler<PortableLibrary1.TestModule.FileTaskEventArgs>(OnFinishedFileTask);*/ /*******************************************************************/ /*if(modi.CommandName == "9") * { * Controller.Modi.RandomHsvModi rndHsv = new Controller.Modi.RandomHsvModi(this); * rndHsv.Start(); * return; * }*/ if (modi != null) { ModiIsPlaying = true; Btc.SendCommand(Command.ArduinoCommand(modi.CommandName)); } }
public void SetTile(int column, int row, Color color) { Table.SetTile(column, row, color); int startPixel; if (row % 2 != 0) { startPixel = row * Columns + column; } else { startPixel = row * Columns + Columns - 1 - (column); } startPixel = startPixel * 3; Btc.SendCommand(Command.ArduinoCommand(CommandName.SetTile, new List <string>() { startPixel.ToString(), color.R.ToString(), color.G.ToString(), color.B.ToString() })); }
public void Create(Btc btc) { context.Btcs.Add(btc); context.SaveChanges(); }
public override int GetHashCode() { return(17 + 31 * Btc.GetHashCode() + 31 * Ltc.GetHashCode() + 31 * Nmc.GetHashCode() + 31 * Nvc.GetHashCode() + 31 * Trc.GetHashCode() + 31 * Ppc.GetHashCode() + 31 * Ftc.GetHashCode() + 31 * Usd.GetHashCode() + 31 * Eur.GetHashCode()); }
public void ReportFreeRam() { Btc.SendCommand(Command.ArduinoCommand(CommandName.FreeRam)); }
public void StopMusic() { MusicIsPlaying = false; Btc.SendCommand(Command.ArduinoCommand(CommandName.StopMusic)); }
public void StopModi() { Btc.SendCommand(Command.ArduinoCommand(CommandName.StopModi)); ModiIsPlaying = false; }