formatting

This commit is contained in:
john30
2021-01-10 15:36:02 +01:00
parent a1b289edac
commit 5c07889801
4 changed files with 115 additions and 104 deletions
+3 -3
View File
@@ -692,11 +692,11 @@ result_t NetworkDevice::open() {
ret = setsockopt(m_fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<void*>(&value), sizeof(value));
value = 1;
setsockopt(m_fd, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast<void*>(&value), sizeof(value));
value = 3; // send keepalive after 3 seconds of silence
value = 3; // send keepalive after 3 seconds of silence
setsockopt(m_fd, IPPROTO_TCP, TCP_KEEPIDLE, reinterpret_cast<void*>(&value), sizeof(value));
value = 2; // send keepalive in interval of 2 seconds
value = 2; // send keepalive in interval of 2 seconds
setsockopt(m_fd, IPPROTO_TCP, TCP_KEEPINTVL, reinterpret_cast<void*>(&value), sizeof(value));
value = 2; // drop connection after 2 failed keep alive sends
value = 2; // drop connection after 2 failed keep alive sends
setsockopt(m_fd, IPPROTO_TCP, TCP_KEEPCNT, reinterpret_cast<void*>(&value), sizeof(value));
}
if (ret >= 0) {
+13 -12
View File
@@ -52,12 +52,12 @@ namespace ebusd {
/** the arbitration state handled by @a Device. */
enum ArbitrationState {
as_none, //!< no arbitration in process
as_start, //!< arbitration start requested
as_error, //!< error while sending master address
as_running, //!< arbitration currently running (master address sent, waiting for reception)
as_lost, //!< arbitration lost
as_won, //!< arbitration won
as_none, //!< no arbitration in process
as_start, //!< arbitration start requested
as_error, //!< error while sending master address
as_running, //!< arbitration currently running (master address sent, waiting for reception)
as_lost, //!< arbitration lost
as_won, //!< arbitration won
};
/**
@@ -101,7 +101,7 @@ class Device {
* @param enhancedProto whether to use the ebusd enhanced protocol.
*/
Device(const char* name, bool checkDevice, unsigned int latency, bool readOnly, bool initialSend,
bool enhancedProto=false);
bool enhancedProto = false);
public:
/**
@@ -174,7 +174,7 @@ class Device {
* Return whether the device is currently in arbitration.
* @return true when the device is currently in arbitration.
*/
bool isArbitrating() const { return m_arbitrationMaster != SYN; };
bool isArbitrating() const { return m_arbitrationMaster != SYN; }
/**
* Return the device name.
@@ -220,7 +220,7 @@ class Device {
* @param startArbitration true to start arbitration.
* @return true on success, false on error.
*/
virtual bool write(symbol_t value, bool startArbitration=false);
virtual bool write(symbol_t value, bool startArbitration = false);
/**
* Check whether a symbol is available for reading immediately (without waiting).
@@ -236,7 +236,8 @@ class Device {
* @param incomplete the variable in which to store when a partial transfer needs another poll.
* @return true on success, false on error.
*/
virtual bool read(symbol_t* value, bool isAvailable, ArbitrationState* arbitrationState=nullptr, bool* incomplete=nullptr);
virtual bool read(symbol_t* value, bool isAvailable, ArbitrationState* arbitrationState = nullptr,
bool* incomplete = nullptr);
/** the device name (e.g. "/dev/ttyUSB0" for serial, "127.0.0.1:1234" for network). */
const char* m_name;
@@ -299,7 +300,7 @@ class SerialDevice : public Device {
* @param enhancedProto whether to use the ebusd enhanced protocol.
*/
SerialDevice(const char* name, bool checkDevice, unsigned int extraLatency, bool readOnly, bool initialSend,
bool enhancedProto=false)
bool enhancedProto = false)
: Device(name, checkDevice, extraLatency, readOnly, initialSend, enhancedProto) {}
// @copydoc
@@ -337,7 +338,7 @@ class NetworkDevice : public Device {
* @param enhancedProto whether to use the ebusd enhanced protocol.
*/
NetworkDevice(const char* name, const char* hostOrIp, uint16_t port, unsigned int extraLatency, bool readOnly,
bool initialSend, bool udp, bool enhancedProto=false)
bool initialSend, bool udp, bool enhancedProto = false)
: Device(name, true, NETWORK_LATENCY_MS+extraLatency, readOnly, initialSend, enhancedProto),
m_hostOrIp(hostOrIp), m_port(port), m_udp(udp) {}