naoqidriver
audio.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Aldebaran
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef AUDIO_EVENT_CONVERTER_HPP
19 #define AUDIO_EVENT_CONVERTER_HPP
20 
21 /*
22 * LOCAL includes
23 */
24 #include "converter_base.hpp"
26 
27 /*
28 * ROS includes
29 */
30 #include <naoqi_bridge_msgs/AudioBuffer.h>
31 
32 /*
33 * ALDEBARAN includes
34 */
35 #include <qi/anymodule.hpp>
36 
37 namespace naoqi{
38 
39 namespace converter{
40 
41 class AudioEventConverter : public BaseConverter<AudioEventConverter>
42 {
43 
44  typedef boost::function<void(naoqi_bridge_msgs::AudioBuffer&) > Callback_t;
45 
46 public:
47  AudioEventConverter(const std::string& name, const float& frequency, const qi::SessionPtr& session);
48 
50 
51  virtual void reset();
52 
53  void registerCallback( const message_actions::MessageAction action, Callback_t cb );
54 
55  void callAll(const std::vector<message_actions::MessageAction>& actions, naoqi_bridge_msgs::AudioBuffer& msg);
56 
57 private:
59  std::map<message_actions::MessageAction, Callback_t> callbacks_;
60  naoqi_bridge_msgs::AudioBuffer msg_;
61 };
62 
63 }
64 
65 }
66 
67 #endif // AUDIO_CONVERTER_HPP
std::string name() const
Definition: converter_base.hpp:54
float frequency() const
Definition: converter_base.hpp:59
boost::function< void(naoqi_bridge_msgs::AudioBuffer &) > Callback_t
Definition: audio.hpp:44
MessageAction
Definition: message_actions.h:9
Definition: audio.cpp:29
std::map< message_actions::MessageAction, Callback_t > callbacks_
Definition: audio.hpp:59
naoqi_bridge_msgs::AudioBuffer msg_
Definition: audio.hpp:60
~AudioEventConverter()
Definition: audio.cpp:38
Definition: converter_base.hpp:40
AudioEventConverter(const std::string &name, const float &frequency, const qi::SessionPtr &session)
Definition: audio.cpp:33
virtual void reset()
Definition: audio.cpp:41
void registerCallback(const message_actions::MessageAction action, Callback_t cb)
Definition: audio.cpp:45
void callAll(const std::vector< message_actions::MessageAction > &actions, naoqi_bridge_msgs::AudioBuffer &msg)
Definition: audio.cpp:50