[DEV] add callback of connection IO

This commit is contained in:
Edouard DUPIN 2015-03-17 22:48:59 +01:00
parent e534be9bc3
commit 4b704287b0
2 changed files with 11 additions and 2 deletions

View File

@ -27,7 +27,10 @@ class InterfaceInput {
InterfaceInput(std11::shared_ptr<river::Manager> _manager, const std::string& _input="microphone", const std::string& _publisher="microphone", bool _feedback=false) : InterfaceInput(std11::shared_ptr<river::Manager> _manager, const std::string& _input="microphone", const std::string& _publisher="microphone", bool _feedback=false) :
m_manager(_manager) { m_manager(_manager) {
ros::NodeHandle nodeHandlePrivate("~"); ros::NodeHandle nodeHandlePrivate("~");
m_stream = nodeHandlePrivate.advertise<audio_msg::AudioBuffer>(_publisher, 100); m_stream = nodeHandlePrivate.advertise<audio_msg::AudioBuffer>(_publisher,
100,
boost::bind(&InterfaceInput::onConnect, this, _1),
boost::bind(&InterfaceInput::onDisConnect, this, _1));
//Set stereo output: //Set stereo output:
std::vector<audio::channel> channelMap; std::vector<audio::channel> channelMap;
channelMap.push_back(audio::channel_frontLeft); channelMap.push_back(audio::channel_frontLeft);
@ -66,6 +69,12 @@ class InterfaceInput {
m_interface->stop(); m_interface->stop();
m_interface.reset(); m_interface.reset();
} }
void onConnect(const ros::SingleSubscriberPublisher& _pub) {
APPL_ERROR("on connect ... " << _pub.getSubscriberName());
}
void onDisConnect(const ros::SingleSubscriberPublisher& _pub) {
APPL_ERROR("on dis-connect ... " << _pub.getSubscriberName());
}
void onDataReceived(const void* _data, void onDataReceived(const void* _data,
const std11::chrono::system_clock::time_point& _time, const std11::chrono::system_clock::time_point& _time,
size_t _nbChunk, size_t _nbChunk,

View File

@ -34,7 +34,7 @@ uint8 FORMAT_DOUBLE=10
# timestanp the audio buffer # timestanp the audio buffer
Header header Header header
# source # source
String sourceName string sourceName
# source id # source id
uint32 sourceId uint32 sourceId
# current frequency of the audio interface # current frequency of the audio interface