34#include <NDEVR/SoftwareService.h>
35#include <NDEVR/Device.h>
36#include <NDEVR/String.h>
37#include <NDEVR/TimeSpan.h>
44class QBluetoothSocket;
45class QBluetoothServiceInfo;
46class QBluetoothDeviceInfo;
47class QBluetoothAddress;
217 [[nodiscard]]
virtual bool isOpen()
const;
218 [[nodiscard]]
virtual const String&
address()
const {
return m_connection_info.address; }
219 [[nodiscard]]
virtual const String&
type()
const {
return m_connection_info.type; }
223 [[nodiscard]]
virtual bool canReadLine(
char deliminator =
'\n')
const;
235 [[nodiscard]]
virtual bool ping()
const;
269 bool m_log_tx =
true;
270 bool m_log_rx =
true;
271 bool m_show_errors =
false;
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Provides the unseen backend logic for setting up, tearing down, and sending data over a specific type...
Definition Connection.h:153
void connectionStateChangedSignal(ConnectionState state)
virtual bool waitForReadyRead(const TimeSpan &span)=0
virtual String threadID() const
Definition Connection.h:166
void dataAvailableSignal()
virtual bool open(const ConnectionInfo &request)=0
virtual uint04 bytesAvailable() const =0
ConnectionBackend(ProgressInfo *log)
virtual void tx(const String &command)=0
ProgressInfo * m_log
Definition Connection.h:171
virtual uint04 rx(char *s, uint04 max_size=Constant< uint04 >::Max)=0
virtual uint04 peek(char *s, uint04 size=Constant< uint04 >::Max) const =0
virtual bool isOpen() const =0
virtual TranslatedString lastError() const =0
Stores factories that can be registered for creating Connections of various types.
Definition Connection.h:177
static Buffer< ConnectionFactory * > s_registered_factories
Definition Connection.h:190
static Buffer< ConnectionCategory > AvailableConnectionCatagories()
virtual bool handlesType(const String &request) const =0
static void RegisterConnectionFactory(ConnectionFactory *factory)
static ConnectionBackend * CreateConnection(const ConnectionInfo &request)
virtual ConnectionBackend * createConnection(const ConnectionInfo &request)=0
static Buffer< ConnectionInfo > AvailableConnections(const ConnectionSearchParamaters ¶ms)
virtual Buffer< ConnectionInfo > availableConnections(const ConnectionSearchParamaters ¶ms)=0
virtual Buffer< ConnectionCategory > availableConnectionCatagories()=0
virtual bool canConnectTo(const ConnectionInfo &request) const
A standard interface for all types of connections that allow transmitting and recieving of data betwe...
Definition Connection.h:198
void connectionStateChangedSignal(ConnectionState state)
virtual String threadID() const
virtual const String & address() const
Definition Connection.h:218
virtual void setBackend(ConnectionBackend *device)
String m_connection_rx_buffer
Definition Connection.h:258
void dataAvailableSignal()
ProgressInfo * rawNetworkLog()
Definition Connection.h:225
const ProgressInfo * rawNetworkLog() const
Definition Connection.h:228
void setRawDataLog(ProgressInfo *raw_network_log)
virtual bool waitForReadyRead(const TimeSpan &span)
virtual void clearConnectionInfo()
virtual void tx(const String &data)
virtual void setConnectionInfo(const ConnectionInfo &request)
virtual void setDefaultRxBufferSize(uint04 default_rx_buffer_size)
void handleErrorString(const TranslatedString &error)
const String & peek(uint04 size=Constant< uint04 >::Invalid) const
Connection(const ConnectionInfo &connection, const Model &model, ProgressInfo *raw_network_log=nullptr, ProgressInfo *command_log=nullptr, QObject *parent=nullptr)
Connection(const Model &model, ProgressInfo *raw_network_log=nullptr, ProgressInfo *command_log=nullptr, QObject *parent=nullptr)
Buffer< std::function< void(const String &)> > m_rx_callback
Definition Connection.h:257
Buffer< String > rx(char deliminator, uint04 size=Constant< uint04 >::Invalid)
virtual void setConnectionState(ConnectionState state)
ConnectionState connectionState() const
virtual void setTXDelay(const TimeSpan &tx_delay)
Definition Connection.h:224
virtual bool open(const ConnectionInfo &request)
void setRawLoggingMode(RawConnectionLoggingMode mode)
Definition Connection.h:234
const ConnectionInfo & connectionInfo() const
Definition Connection.h:229
const String & rx(uint04 size=Constant< uint04 >::Invalid)
virtual bool canReadLine(char deliminator='\n') const
const String & rxLine(TimeSpan wait_time, char delimeter='\n', uint04 size=Constant< uint04 >::Invalid)
ConnectionInfo m_connection_info
Definition Connection.h:255
Buffer< std::function< void(const String &)> > m_tx_callback
Definition Connection.h:256
bool openBackend(ConnectionBackend *io_device, const ConnectionInfo &request)
const String & rx(TimeSpan wait_time, uint04 size=Constant< uint04 >::Invalid)
virtual bool isOpen() const
virtual bool ping() const
Buffer< String > rx(char deliminator, const String &end_sequence, uint04 size=Constant< uint04 >::Invalid)
ConnectionBackend * ioDevice() const
virtual const String & type() const
Definition Connection.h:219
Time lastRxTime() const
Definition Connection.h:226
Time lastTxTime() const
Definition Connection.h:227
static bool Ping(const String &address, String &response, ProgressInfo *log=nullptr)
static bool Ping(const String &address, ProgressInfo *log=nullptr)
static bool LogNetworkInfo(ProgressInfo *log)
static bool LogIPInfo(ProgressInfo *log)
void writeConnectionLogMessage(const TranslatedString &message)
A root class which describes some physical object, such as a Motor, Sensor, or Connection....
Definition Device.h:52
A core class that represents a node on model heirarchy. This node may contain a Geometry or one or mo...
Definition Model.h:58
A light-weight base class for Log that allows processes to update, without the need for additional in...
Definition ProgressInfo.hpp:48
Software Services provide an interface for adding to or changing the software behavior via functional...
Definition SoftwareService.h:9
Software Service Managers take a Software service to modify the behavior of the software.
Definition SoftwareService.h:15
The core String class for the NDEVR API.
Definition String.h:69
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
RawConnectionLoggingMode
Definition Connection.h:89
ConnectionState
Describes the state of the connection.
Definition Connection.h:57
@ e_attempting_connection
@ e_access_to_port_denied
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
@ e_initializing
Definition OrientationSensor.h:47
ConnectionOpenType
Describes how to open a connection.
Definition Connection.h:76
A category represents the type of connection. For example Bluetooth, Serial Port, TCP,...
Definition Connection.h:127
String icon
Definition Connection.h:130
TranslatedString name
Definition Connection.h:128
String id
Definition Connection.h:129
A structure designed to store information about a specific Connection.
Definition Connection.h:97
void setID(const String &id)
String type
Definition Connection.h:99
bool operator!=(const ConnectionInfo &other) const
Definition Connection.h:115
String thread_id
Definition Connection.h:104
ProgressInfo * log
Definition Connection.h:103
void autoSetName()
Definition Connection.h:110
TranslatedString name
Definition Connection.h:98
ConnectionOpenType connect_mode
Definition Connection.h:101
String address
Definition Connection.h:100
String id() const
Definition Connection.h:106
TimeSpan max_timeout
Definition Connection.h:102
Describes settings for performing a Connection search.
Definition Connection.h:136
std::function< SearchReturn(const ConnectionInfo &)> on_service_found
Definition Connection.h:144
std::function< SearchReturn(const ConnectionInfo &)> on_device_found
Definition Connection.h:143
ProgressInfo * log
Definition Connection.h:145
SearchReturn
Definition Connection.h:138
@ e_continue_searching
Definition Connection.h:139
@ e_stop_searching
Definition Connection.h:140
Buffer< ConnectionCategory > allowed_categories
Definition Connection.h:142
TimeSpan timeout
Definition Connection.h:146
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233