1 | #include <SamgarMainClass.h>
|
---|
2 | using namespace std;
|
---|
3 |
|
---|
4 | list<ModuleStruct>::iterator ItMod;
|
---|
5 | list<string> ::iterator ItPlat;
|
---|
6 |
|
---|
7 |
|
---|
8 | int main() {
|
---|
9 |
|
---|
10 | int ccc =0;
|
---|
11 | Network yarp;
|
---|
12 | SamgarModule MyFirstTest("Module2","behaviour","happy",run); // Cant have spaces or underscores
|
---|
13 | MyFirstTest.AddPortS("num100");
|
---|
14 | MyFirstTest.AddPortS("num200");
|
---|
15 | MyFirstTest.TurnOnModuleListener(); // this allows it to accept messages about the status of other modules and platforms
|
---|
16 | MyFirstTest.GetAvailPlatforms(); // send out a msg to the network to get other places that can be migrated to
|
---|
17 | // have to carefull with this command, use it rapidly and it could bring the whole network down
|
---|
18 | while(1)
|
---|
19 | {
|
---|
20 |
|
---|
21 | yarp::os::Time::delay(8); // a small delay
|
---|
22 |
|
---|
23 | // this will list out all the modules available to it
|
---|
24 | printf(" \n \n The available modules are : \n");
|
---|
25 | // the ListOfKnownModules is updated everytime the GUI finds or loses a module, although there can be a small delay.
|
---|
26 | for ( ItMod=MyFirstTest.ListOfKnownModules.begin() ; ItMod != MyFirstTest.ListOfKnownModules.end(); ItMod++ )
|
---|
27 | {
|
---|
28 | string name = ItMod->name;
|
---|
29 | string cat1 = ItMod->catagory;
|
---|
30 | string cat2 = ItMod->subcatagory;
|
---|
31 | string Combi = name + " " + cat1 + " " + cat2 + "\n";
|
---|
32 | printf(Combi.c_str());
|
---|
33 | }
|
---|
34 |
|
---|
35 | printf(" \n \n The available platforms are : \n");
|
---|
36 | // this command sends a message to the GUI to ask for new data to which companion shells there are to migrate to
|
---|
37 | MyFirstTest.GetAvailPlatforms();
|
---|
38 | for ( ItPlat=MyFirstTest.ListOfKnownPlatforms.begin() ; ItPlat != MyFirstTest.ListOfKnownPlatforms.end(); ItPlat++ )
|
---|
39 | {
|
---|
40 | string name = ItPlat->c_str();// + "\n";
|
---|
41 | name = name +"\n";
|
---|
42 | printf(name.c_str());
|
---|
43 | }
|
---|
44 | MyFirstTest.SucceedFail(true,888);
|
---|
45 | }
|
---|
46 | return 0;
|
---|
47 | } |
---|