private void transmitRF(MSG message) { if(message is DATA_MSG) ((DATA_MSG)message).data += "\n" + NodeAddress + " -> "; NodeuC Dest; if(NeighborsTable.Contains(message.to)) Dest = Program.GetNode(message.to); //Send directly else Dest = Program.GetNode(RouteTable[message.to][0]); //Send by gateway Dest.SendMessage(message); }
//This method is used to send a message to THIS node public void SendMessage(MSG message) { if (message is DATA_MSG) { DATA_MSG msgCopy = new DATA_MSG(); msgCopy.raw_bytes = ((DATA_MSG)message).raw_bytes; dataInputBuffer.Add(msgCopy); } else { ROUTE_MSG msgCopy = new ROUTE_MSG(); msgCopy.raw_bytes = ((ROUTE_MSG)message).raw_bytes; routeBuffer.Add(msgCopy); } }