23 #include "remote_bb_poster.h" 25 #include <blackboard/remote.h> 26 #include <logging/logger.h> 27 #include <interfaces/JoystickInterface.h> 42 unsigned short int port,
49 __warning_printed =
false;
55 __bb->
close(__joystick_if);
65 __logger->
log_info(
"Joystick",
"Connection re-established, writing data");
66 __warning_printed =
false;
72 __joystick_if->
set_axis(axis_values);
73 __joystick_if->
write();
75 if ( ! __warning_printed ) {
77 __logger->
log_warn(
"Joystick",
"Lost connection to BlackBoard, " 78 "will try to re-establish");
79 __warning_printed =
true;
89 __joystick_if->
write();
97 __joystick_if->
write();
virtual void joystick_unplugged()
The joystick has been unplugged and is no longer available.
virtual void log_info(const char *component, const char *format,...)=0
Log informational message.
JoystickInterface Fawkes BlackBoard Interface.
Fawkes library namespace.
virtual void joystick_changed(unsigned int pressed_buttons, float *axis_values)
Joystick data changed.
void set_pressed_buttons(const uint32_t new_pressed_buttons)
Set pressed_buttons value.
virtual bool try_aliveness_restore()=0
Try to restore the aliveness of the BlackBoard instance.
void write()
Write from local copy into BlackBoard memory.
void set_num_axes(const uint8_t new_num_axes)
Set num_axes value.
virtual void joystick_plugged(char num_axes, char num_buttons)
A (new) joystick has been plugged in.
Base class for exceptions in Fawkes.
virtual bool is_alive() const =0
Check if the BlackBoard is still alive.
virtual void log_warn(const char *component, const char *format,...)=0
Log warning message.
void print_trace()
Prints trace to stderr.
void set_axis(unsigned int index, const float new_axis)
Set axis value at given index.
~JoystickRemoteBlackBoardPoster()
Destructor.
virtual Interface * open_for_writing(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for writing.
void set_num_buttons(const uint8_t new_num_buttons)
Set num_buttons value.
JoystickRemoteBlackBoardPoster(const char *host, unsigned short int port, fawkes::Logger *logger)
Constructor.
virtual void close(Interface *interface)=0
Close interface.