The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
MHA Framework listening on TCP port for commands. More...
Classes | |
class | tcp_server_t |
Public Member Functions | |
mhaserver_t (const std::string &ao, const std::string &af, const std::string &lf, bool b_interactive_) | |
~mhaserver_t () | |
virtual std::string | on_received_line (const std::string &line) |
A line of text was received from network client. More... | |
virtual void | acceptor_started () |
Notification: "TCP port is open". More... | |
virtual void | send_port_announcement () |
sends an announcement which port this MHA is listening on to the creator of the process. More... | |
virtual void | start_stdin_thread () |
Starts a separate thread that reads lines from stdin and forwards these lines over TCP to the MHA configuration thread which multiplexes multiple TCP connections. More... | |
virtual void | set_announce_port (unsigned short announce_port) |
If set to nonzero, the spawning process has asked to be notified of the TCP port used by this process. More... | |
void | logstring (const std::string &) |
Log a message to log file. More... | |
int | run (unsigned short port, const std::string &_interface) |
Accept network connections and act on commands. More... | |
Public Member Functions inherited from fw_t | |
fw_t () | |
~fw_t () | |
bool | exit_request () const |
Public Member Functions inherited from MHAParser::parser_t | |
parser_t (const std::string &help_text="") | |
Construct detached node to be used in the configuration tree. More... | |
~parser_t () | |
void | insert_item (const std::string &, base_t *) |
Register a parser item into this sub-parser. More... | |
void | remove_item (const std::string &) |
Remove an item by name. More... | |
void | force_remove_item (const std::string &) |
Remove an item by name. More... | |
void | remove_item (const base_t *) |
Remove an item by address. More... | |
Public Member Functions inherited from MHAParser::base_t | |
base_t (const std::string &) | |
Constructor for base class of all parser nodes. More... | |
base_t (const base_t &) | |
Copy constructor for base_t. More... | |
base_t & | operator= (const base_t &)=default |
base_t (base_t &&)=delete | |
base_t & | operator= (base_t &&)=delete |
virtual | ~base_t () |
virtual std::string | parse (const std::string &) |
Causes this node to process a command in the openMHA configuration language. More... | |
virtual void | parse (const char *, char *, unsigned int) |
This function parses a command and writes the parsing result into a C character array. More... | |
virtual void | parse (const std::vector< std::string > &, std::vector< std::string > &) |
virtual std::string | query_perm (const std::string &) |
virtual std::string | query_range (const std::string &) |
std::string | query_version (const std::string &) |
std::string | query_id (const std::string &) |
std::string | query_subst (const std::string &) |
std::string | query_addsubst (const std::string &) |
std::string | query_help (const std::string &) |
std::string | query_cmds (const std::string &) |
void | set_node_id (const std::string &) |
Set the identification string of this parser node. More... | |
void | set_help (const std::string &) |
Set the help comment of a variable or parser. More... | |
void | add_parent_on_insert (parser_t *, std::string) |
void | rm_parent_on_remove (parser_t *) |
const std::string & | fullname () const |
Return the full dot-separated path name of this parser node in the openMHA configuration tree. More... | |
Public Attributes | |
MHAParser::int_t | port |
Public Attributes inherited from MHAParser::base_t | |
MHAEvents::emitter_t | writeaccess |
Event emitted on write access. More... | |
MHAEvents::emitter_t | valuechanged |
Event emitted if the value has changed. More... | |
MHAEvents::emitter_t | readaccess |
Event emitted on read access. More... | |
MHAEvents::emitter_t | prereadaccess |
Event emitted on read access, before the data field is accessed. More... | |
Private Attributes | |
std::shared_ptr< tcp_server_t > | tcpserver |
std::string | ack_ok |
std::string | ack_fail |
std::string | logfile |
unsigned short | announce_port |
bool | b_interactive |
MHAParser::int_mon_t | pid_mon |
Additional Inherited Members | |
Protected Member Functions inherited from MHAParser::parser_t | |
std::string | op_subparse (expression_t &) |
std::string | op_setval (expression_t &) |
std::string | op_query (expression_t &) |
std::string | query_type (const std::string &) |
std::string | query_dump (const std::string &) |
std::string | query_entries (const std::string &) |
std::string | query_readfile (const std::string &) |
std::string | query_savefile (const std::string &) |
std::string | query_savefile_compact (const std::string &) |
std::string | query_savemons (const std::string &) |
std::string | query_val (const std::string &) |
std::string | query_listids (const std::string &) |
void | set_id_string (const std::string &) |
bool | has_entry (const std::string &) |
Protected Member Functions inherited from MHAParser::base_t | |
void | activate_query (const std::string &, query_t) |
void | notify () |
Protected Attributes inherited from fw_t | |
io_lib_t * | io_lib |
int | proc_error |
int | io_error |
Protected Attributes inherited from MHAParser::base_t | |
query_map_t | queries |
bool | data_is_initialized |
MHA Framework listening on TCP port for commands.
mhaserver_t::mhaserver_t | ( | const std::string & | ao, |
const std::string & | af, | ||
const std::string & | lf, | ||
bool | b_interactive_ | ||
) |
ao | Acknowledgement string at end of successful command responses |
af | Acknowledgement string at end of failed command responses |
lf | File system path of file to use as log file. MHA appends. |
mhaserver_t::~mhaserver_t | ( | ) |
|
virtual |
A line of text was received from network client.
|
virtual |
Notification: "TCP port is open".
|
virtual |
sends an announcement which port this MHA is listening on to the creator of the process.
See command line option –announce
|
virtual |
Starts a separate thread that reads lines from stdin and forwards these lines over TCP to the MHA configuration thread which multiplexes multiple TCP connections.
Enables users to type mha configuration language commands directly into the terminal where MHA was started, without the need to use third-party tools like nc or putty.
|
virtual |
If set to nonzero, the spawning process has asked to be notified of the TCP port used by this process.
|
inline |
Log a message to log file.
int mhaserver_t::run | ( | unsigned short | port, |
const std::string & | _interface | ||
) |
Accept network connections and act on commands.
Calls acceptor_started() when the TCP port is opened. Calls on_received_line for every line received.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
MHAParser::int_t mhaserver_t::port |