private void printRFPacket(RFPacket <byte> packet) { Debug.Log(packet.Address); for (int i = 0; i < packet.data.Length; i++) { Debug.Log(packet.data[i]); } }
private RFPacket <T> setupPacket(T[] data) { RFPacket <T> packet = new RFPacket <T>(); packet.data = data; packet.Address = this.address; return(packet); }
public virtual void transmit(uint destination, T[] data) { for (int i = 0; i < others.Count; i++) { if (others[i].address == destination) { RFPacket <T> packet = setupPacket(data); others[i].receivedData(packet); return; } } Debug.Log(string.Format("Can't send RF data from {0} to {1}", this.address, destination)); }
public virtual void broadcast(T[] data) { if (others.Count == 0) { return; } RFPacket <T> packet = setupPacket(data); for (int i = 0; i < others.Count; i++) { others[i].receivedData(packet); } }
public void receivedData(RFPacket <T> packet) { receivedDataEvent(packet); }