Skip to content

Commit a10f33d

Browse files
committed
adding test usage
1 parent d162fde commit a10f33d

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

src/dds.net-connector-cpp.app/test-app.cpp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
using namespace std;
1010
using namespace dds::net::connector;
1111

12+
1213
void wait_for_exit_key();
14+
void my_double_consumer(std::string& variableName, double variableValue);
15+
1316

1417
int main()
1518
{
@@ -27,20 +30,43 @@ int main()
2730
appName,
2831
serverIP, serverPort,
2932
new ConsoleLogger());
33+
34+
connector.registerDoubleConsumer("TESTX", my_double_consumer, ON_CHANGE);
35+
connector.registerDoubleConsumer("TESTY", my_double_consumer, ON_CHANGE);
36+
37+
connector.start();
38+
39+
wait_for_exit_key();
3040
}
3141
catch (exception& ex)
3242
{
3343
cout << "Error! " << ex.what() << endl;
3444
}
3545

36-
wait_for_exit_key();
37-
3846
cout << endl << endl << endl;
3947
}
4048

49+
4150
void wait_for_exit_key()
4251
{
4352
char ch;
4453
while ((ch = getc(stdin)) != 'C');
4554
}
4655

56+
57+
static double x, y;
58+
59+
void my_double_consumer(std::string& variableName, double variableValue)
60+
{
61+
if (variableName == "TESTX")
62+
{
63+
x = variableValue;
64+
}
65+
else if (variableName == "TESTY")
66+
{
67+
y = variableValue;
68+
69+
cout << "TESTX, TESTY = " << x << ", " << y << endl;
70+
}
71+
}
72+

0 commit comments

Comments
 (0)