Ejemplo n.º 1
0
    static void Main()
    {
        // initialize eCAL API
        Util.Initialize("minimal_rcv");

        // print version info
        System.Console.WriteLine(String.Format("eCAL {0} ({1})\n", Util.GetVersion(), Util.GetDate()));

        // create a subscriber (topic name "Hello", type "base:std::string")
        Subscriber subscriber = new Subscriber("Hello", "base:std::string", "");

        // idle main thread
        while (Util.Ok())
        {
            // receive content with 100 ms timeout
            Subscriber.ReceiveCallbackData message = subscriber.Receive(100);

            // print message
            if (message != null)
            {
                System.Console.WriteLine(String.Format("Received:  {0}", message.data));
            }
        }

        // dispose subscriber
        subscriber.Dispose();

        // finalize eCAL API
        Util.Terminate();
    }
Ejemplo n.º 2
0
 static void MyCallback(String topic, Subscriber.ReceiveCallbackData data)
 {
     System.Console.WriteLine("Topic name " + topic);
     System.Console.WriteLine("Topic content " + data.data);
 }