Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
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);
41
SwitchInterface
*si = rbb->
open_for_reading
<
SwitchInterface
>(
"Beep"
);
42
43
if
(argp.has_arg(
"1"
)) {
44
si->
msgq_enqueue
(
new
SwitchInterface::EnableSwitchMessage
());
45
}
else
if
(argp.has_arg(
"0"
)) {
46
si->
msgq_enqueue
(
new
SwitchInterface::DisableSwitchMessage
());
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"
);
53
si->
msgq_enqueue
(
new
SwitchInterface::EnableDurationMessage
(d, 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
src
tools
beep_daemon
qa
qa_remote_beep.cpp
Generated by
1.8.1.1