24 #include <blackboard/remote.h>
25 #include <core/threading/thread.h>
26 #include <interfaces/TestInterface.h>
27 #include <netcomm/fawkes/client.h>
28 #include <netcomm/fawkes/client_handler.h>
29 #include <readline/history.h>
30 #include <readline/readline.h>
31 #include <utils/system/argparser.h>
32 #include <utils/system/signal.h>
44 print_usage(
const char *program_name)
46 printf(
"Usage: %s [-h] [-r host[:port]]\n"
47 " -h This help message\n"
48 " -r host[:port] Remote host (and optionally port) to connect to\n",
75 just_connected =
true;
76 connection_died_recently =
false;
81 rl_event_hook = event_hook;
83 char * host = (
char *)
"localhost";
84 unsigned short int port = 1910;
92 c->register_handler(
this, FAWKES_CID_SKILLER_PLUGIN);
99 printf(
"Finalizing\n");
110 c->deregister_handler(FAWKES_CID_SKILLER_PLUGIN);
118 if (c->connected()) {
119 if (just_connected) {
120 just_connected =
false;
123 testif = rbb->open_for_reading<
TestInterface>(
"eclipse_clp_skillexec");
131 if (argp->num_items() > 0) {
132 const std::vector<const char *> &items = argp->items();
134 std::vector<const char *>::const_iterator i = items.begin();
135 std::string sks = *i;
137 for (; i != items.end(); ++i) {
144 testif->msgq_enqueue(tsm);
149 char *line = readline(prompt);
151 if (strcmp(line,
"") != 0) {
154 testif->msgq_enqueue(tsm);
158 if (!connection_died_recently) {
164 if (connection_died_recently) {
165 connection_died_recently =
false;
166 printf(
"Connection died\n");
180 deregistered(
unsigned int id)
throw()
190 connection_died(
unsigned int id)
throw()
199 connection_died_recently =
true;
207 connection_established(
unsigned int id)
throw()
209 printf(
"Connection established\n");
210 just_connected =
true;
221 bool connection_died_recently;
229 main(
int argc,
char **argv)
233 if (argp.has_arg(
"h")) {
234 print_usage(argv[0]);