public async Task <bool> Send(byte[] sentBytes, byte[] waitBytes, CancellationToken token) { try { var sendDexFile = new SendDexFile(MainActivity, this); ReceiveBytes = new byte[0]; WaitForBytes = new byte[0]; //if(WaitForBytes?.Length > 0) Arrays.Fill(WaitForBytes, 0); WaitForBytes = waitBytes; Log.Info(TAG + Operation, $"Waiting for {waitBytes.ToListOfByte()}"); LogMessage2($"Sending => {sentBytes.ToListOfByte()}", false); sendDexFile.SendDexBytes(sentBytes, token); await Task.Delay(200, token); return(true); } catch (Exception e) { Console.WriteLine(e); return(false); } }
private void sendFile() { if (ConnectedGatt != null) { SendDexFile sendDex = new SendDexFile(MainActivity, this); Thread sendFileThread = new Thread(sendDex.senddexfile); sendFileThread.Start(); } }