beep.h
Go to the documentation of this file.
1 #ifndef BEEP_H
2 #define BEEP_H
3 
4 void init_beep();
5 void start_beep(int freq, int length=50);
6 void stop_beep();
7 void quit_beep();
8 
10 
11 // Beep client to send command to BeeperRTC
12 #include <rtm/idl/BasicDataTypeSkel.h>
14 {
15  private:
17  int freq, length;
18  public:
19  BeepClient () : is_start_beep(false), prev_is_start_beep(false) {};
20  ~BeepClient () {};
21  int get_num_beep_info () const { return NUM_BEEP_INFO; };
22  void startBeep (const int _freq, const int _length = 50)
23  {
24  prev_is_start_beep = is_start_beep;
25  is_start_beep = true;
26  freq = _freq;
27  length = _length;
28  };
29  void stopBeep ()
30  {
31  prev_is_start_beep = is_start_beep;
32  is_start_beep = false;
33  freq = 1; // dummy
34  length = 0; // dummy
35  };
36  bool isWritable () const
37  {
38  // Write data port to overwrite and pass through between client RTCs.
39  // If currently "start" or changed to "stop", write data port.
40  // If keep "stop", do not write data port.
41  return (is_start_beep || prev_is_start_beep);
42  };
43  void setDataPort (RTC::TimedLongSeq& out_data)
44  {
45  out_data.data[BEEP_INFO_START] = (is_start_beep?1:0);
46  out_data.data[BEEP_INFO_FREQ] = freq;
47  out_data.data[BEEP_INFO_LENGTH] = length;
48  };
49 };
50 #endif // BEEP_H
bool is_start_beep
Definition: beep.h:16
void start_beep(int freq, int length=50)
Definition: beep.cpp:16
beep_info
Definition: beep.h:9
void quit_beep()
Definition: beep.cpp:28
bool prev_is_start_beep
Definition: beep.h:16
bool isWritable() const
Definition: beep.h:36
void setDataPort(RTC::TimedLongSeq &out_data)
Definition: beep.h:43
void startBeep(const int _freq, const int _length=50)
Definition: beep.h:22
void init_beep()
Definition: beep.cpp:6
int length
Definition: beep.h:17
void stopBeep()
Definition: beep.h:29
~BeepClient()
Definition: beep.h:20
int get_num_beep_info() const
Definition: beep.h:21
void stop_beep()
Definition: beep.cpp:22
int freq
Definition: beep.h:17
BeepClient()
Definition: beep.h:19


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:49