MyStreamManager.cs 568 B

123456789101112131415161718
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using ArduinoBluetoothAPI;
  5. class MyStreamManager : StreamManager
  6. {
  7. public override byte[] formatDataToSend(byte[] buff)
  8. {
  9. Debug.Log("Formatting data before sending " + System.Text.Encoding.ASCII.GetString(buff));
  10. return buff;
  11. }
  12. public override void handleReceivedData(byte[] buff)
  13. {
  14. Debug.Log("Received data " + System.Text.Encoding.ASCII.GetString(buff));
  15. this.OnDataReceived.Invoke(buff); //Invoke the OnDataReceived method
  16. }
  17. }