reworked and optimized device handling and check network device address, log failed device open, avoid blocking threads with sleep(), optimized shutdown

This commit is contained in:
john30
2015-02-08 10:06:03 +01:00
parent 4404202609
commit aa306d9131
17 changed files with 664 additions and 735 deletions
+5 -11
View File
@@ -38,10 +38,11 @@ public:
/**
* Construct the main loop and create network and bus handling components.
* @param opt the program options.
* @param device the @a Device instance.
* @param templates the @a DataFieldTemplates instance.
* @param messages the @a MessageMap instance.
*/
MainLoop(const struct options opt, DataFieldTemplates* templates, MessageMap* messages);
MainLoop(const struct options opt, Device *device, DataFieldTemplates* templates, MessageMap* messages);
/**
* Destructor.
@@ -59,15 +60,11 @@ public:
*/
void addMessage(NetMessage* message) { m_netQueue.add(message); }
/**
* Create a log message for a received/sent raw data byte.
* @param byte the raw data byte.
* @param received true if the byte was received, false if it was sent.
*/
static void logRaw(const unsigned char byte, bool received);
private:
/** the @a Device instance. */
Device* m_device;
/** the @a DataFieldTemplates instance. */
DataFieldTemplates* m_templates;
@@ -77,9 +74,6 @@ private:
/** the own master address for sending on the bus. */
unsigned char m_address;
/** the created @a Port instance. */
Port* m_port;
/** the created @a BusHandler instance. */
BusHandler* m_busHandler;