Collaboration diagram for In Depth:
ReachinMicoleApplication * ama = ReachinMicoleApplication::getInstance(); ama->startNetwork();
This is all you need to launch network system. By default, startNetwork use host "127.0.0.1" and port "33843", you can specify different hosts, port with
ama->startNetwork("192.168.0.23",6453);
If you host is "127.0.0.1" and a server do not respond, your program will launch a server agent. Keep in mind that the first agent who need to connect to 127.0.0.1 and if nothing respond, will create his own server on this port.
To broacast your message on "distant bus", you need to prefix your message by "Net: ". This prefix is necessary to prevent overwhelm of ininteressting messages on other bus. Due to TCP/IP asynchronous mode, it's preferable to avoid using networkAgent for low message.
This is a sample of code of FF3DDeviceSenderAgent
Display * dis = ReachinMicoleApplication::getInstance()->getDisplay();
As you can see, a ReachinMicoleApplication can be instanciate before you own first instanciation. Here FF3DDeviceSenderAgent need the Display object of Reachin API.
This Agent can register several parameters for you. There's some "defined" vars that you can set to change some force model.
sendMessage("Set stiffness = 1.5;"); sendMessage("Set d = 0.02;");
You can retrieve your vars with getVar and getFloatVar methods
_stiffness = ReachinMicoleApplication::getFloatVar("stiffness"); _d = ReachinMicoleApplication::getFloatVar("d");
Warning ! If you want to set variable on a distant network you need to send
sendMessage("Net: Set stiffness = 1.5;");