31 "implementation_id",
"Beeper",
32 "type_name",
"Beeper",
33 "description",
"beeper",
34 "version", HRPSYS_PACKAGE_VERSION,
36 "category",
"example",
37 "activity_type",
"DataFlowComponent",
40 "lang_type",
"compile",
42 "conf.default.debugLevel",
"0",
51 bool wait_for_initialized =
true;
52 while (wait_for_initialized) {
59 bool prev_beep_start=
false;
60 int prev_beep_length = 1000;
76 }
else if (prev_beep_start) {
91 m_beepCommandIn(
"beepCommand", m_beepCommand),
106 std::cerr <<
"[" <<
m_profile.instance_name <<
"] : onInitialize()" << std::endl;
131 std::cerr <<
"[" <<
m_profile.instance_name <<
"] : Beep thread dt = " <<
m_dt <<
"[s]" << std::endl;
159 std::cerr <<
"[" <<
m_profile.instance_name <<
"] : onActivated(" << ec_id <<
")" << std::endl;
165 std::cerr <<
"[" <<
m_profile.instance_name <<
"] : onDeactivated(" << ec_id <<
")" << std::endl;
169 #define DEBUGP ((m_debugLevel==1 && m_loop%200==0) || m_debugLevel > 1 ) 183 size_t max_buffer_length = 10;
184 if (pthread_mutex_trylock( &
beep_mutex ) == 0) {
189 std::cerr <<
"[" <<
m_profile.instance_name<<
"] Mutex trylock failed (loop=" <<
m_loop <<
")" << std::endl;
196 std::cerr <<
"[" <<
m_profile.instance_name<<
"] isNew : beep stop (loop=" <<
m_loop <<
")" << std::endl;
252 RTC::Delete<Beeper>);
ComponentProfile m_profile
png_infop png_charpp int png_charpp profile
bool stringTo(To &val, const char *str)
virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
unsigned int m_debugLevel
virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)
InPort< TimedLongSeq > m_beepCommandIn
virtual ~Beeper()
Destructor.
coil::Properties & getProperties()
pthread_mutex_t beep_mutex
TimedLongSeq m_beepCommand
ExecutionContextHandle_t UniqueId
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
void BeeperInit(RTC::Manager *manager)
Beeper(RTC::Manager *manager)
Constructor.
virtual RTC::ReturnCode_t onInitialize()
static const char * beeper_spec[]
bool addInPort(const char *name, InPortBase &inport)
std::deque< BeepData > beep_command_buffer
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
void start_beep(int freq, int length)
void * call_beep(void *args)
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
int usleep(useconds_t usec)