Beispiel #1
0
 public void OnPong(
     sbyte link_id,
     ref Protonet.Header header,
     ref Protonet.Pong rx_msg,
     Protonet.Node node)
 {
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            /*Create a protonet node at specified node id (2)*/
            Protonet.Node UgvNode = new Protonet.Node(2);

            /*Construct class to hold all callbacks and behaviors*/
            ProtonetCallbacks UgvCallbacks = new ProtonetCallbacks();

            /*Create a link id variable to reference a created datalink*/
            sbyte link_id = 0;

            /*
             * Register the methods of the callback class with Protonet
             * Note that this is not a HARDWARE register. It passes the callback
             * so the handler can execute it when the respective message is received
             */
            UgvNode.RegisterPingEvent(UgvCallbacks.OnPing);
            UgvNode.RegisterPongEvent(UgvCallbacks.OnPong);


            /*Add a new datalink to the Protonet session and establish an endpoint*/
            UgvNode.AddUDPDatalink(out link_id, 1337);
            UgvNode.EstablishUDPEndpoint(link_id, 2, 1337, "127.0.0.1");


            /*Loop forever*/
            while (true)
            {
                System.Threading.Thread.Sleep(1000);
                UgvNode.SendPing(2, 0);
            }
        }
Beispiel #3
0
 public void OnPing(
     sbyte link_id,
     ref Protonet.Header header,
     ref Protonet.Ping rx_msg,
     Protonet.Node node)
 {
     Console.WriteLine("Output stuff");
 }