Fawkes API  Fawkes Development Version
qa_remote_beep.cpp
1 
2 /***************************************************************************
3  * qa_beep.cpp - Order beep via remote b
4  *
5  * Created: Sun Apr 11 22:21:58 2010
6  * Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 
25 /// @cond QA
26 
27 #include <blackboard/remote.h>
28 #include <interfaces/SwitchInterface.h>
29 #include <utils/system/argparser.h>
30 
31 #include <cstdio>
32 
33 using namespace fawkes;
34 
35 int
36 main(int argc, char **argv)
37 {
38  ArgumentParser argp(argc, argv, "01f:d:");
39 
40  BlackBoard *rbb = new RemoteBlackBoard("localhost", 1910);
42 
43  if (argp.has_arg("1")) {
45  } else if (argp.has_arg("0")) {
47  } else if (argp.has_arg("d")) {
48  if ( ! argp.has_arg("f") ) {
49  printf("Argument -d requires to have -f as well\n");
50  } else {
51  float d = argp.parse_float("d");
52  float f = argp.parse_float("f");
54  }
55  } else if (argp.has_arg("f")) {
56  float f = argp.parse_float("f");
57  si->msgq_enqueue(new SwitchInterface::SetMessage(true, f));
58  }
59 
60  rbb->close(si);
61  delete rbb;
62 }
63 
64 
65 /// @endcond
SetMessage Fawkes BlackBoard Interface Message.
Fawkes library namespace.
Parse command line arguments.
Definition: argparser.h:66
SwitchInterface Fawkes BlackBoard Interface.
DisableSwitchMessage Fawkes BlackBoard Interface Message.
unsigned int msgq_enqueue(Message *message)
Enqueue message at end of queue.
Definition: interface.cpp:903
EnableSwitchMessage Fawkes BlackBoard Interface Message.
Remote BlackBoard.
Definition: remote.h:48
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for reading.
EnableDurationMessage Fawkes BlackBoard Interface Message.
The BlackBoard abstract class.
Definition: blackboard.h:48
virtual void close(Interface *interface)=0
Close interface.