Merge remote-tracking branch 'origin/master' into enhanced_device
# Conflicts: # src/lib/ebus/device.cpp # src/lib/ebus/device.h
This commit is contained in:
+14
-5
@@ -302,19 +302,25 @@ class NetworkDevice : public Device {
|
||||
* Construct a new instance.
|
||||
* @param name the device name (e.g. "/dev/ttyUSB0" for serial, "127.0.0.1:1234" for network).
|
||||
* @param address the socket address of the device.
|
||||
* @param hostOrIp the host name or IP address of the device.
|
||||
* @param port the TCP or UDP port of the device.
|
||||
* @param readOnly whether to allow read access to the device only.
|
||||
* @param initialSend whether to send an initial @a ESC symbol in @a open().
|
||||
* @param udp true for UDP, false to TCP.
|
||||
* @param enhancedProto whether to use the ebusd enhanced protocol.
|
||||
*/
|
||||
NetworkDevice(const char* name, const struct sockaddr_in& address, bool readOnly, bool initialSend,
|
||||
NetworkDevice(const char* name, const char* hostOrIp, uint16_t port, bool readOnly, bool initialSend,
|
||||
bool udp, bool enhancedProto=false)
|
||||
: Device(name, true, readOnly, initialSend, enhancedProto), m_address(address), m_udp(udp) {}
|
||||
: Device(name, true, readOnly, initialSend, enhancedProto), m_hostOrIp(hostOrIp), m_port(port), m_udp(udp) {}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~NetworkDevice() override {}
|
||||
~NetworkDevice() override {
|
||||
if (m_hostOrIp) {
|
||||
free((void*)m_hostOrIp);
|
||||
}
|
||||
}
|
||||
|
||||
// @copydoc
|
||||
unsigned int getLatency() const override { return 10000; }
|
||||
@@ -329,8 +335,11 @@ class NetworkDevice : public Device {
|
||||
|
||||
|
||||
private:
|
||||
/** the socket address of the device. */
|
||||
const struct sockaddr_in m_address;
|
||||
/** the host name or IP address of the device. */
|
||||
const char* m_hostOrIp;
|
||||
|
||||
/** the TCP or UDP port of the device. */
|
||||
const uint16_t m_port;
|
||||
|
||||
/** true for UDP, false to TCP. */
|
||||
const bool m_udp;
|
||||
|
||||
Reference in New Issue
Block a user