|
CAN programming interface environment
Version 3.10
|
This class represents a CAN server, which incorporates up to QCAN_NETWORK_MAX number of CAN networks (QCanNetwork). It is only possible to run one instance of a QCanServer on a machine. In order to avoid multiple instances, the QCanServer class initialises a shared memory region.
Access to the CAN server is granted via a WebSocket interface running on the default port QCAN_WEB_SOCKET_DEFAULT_PORT. By default, access is granted only to processes running on the local machine. Remote access can be granted by calling setServerAddress(QHostAddress::AnyIPv4).
#include <qcan_server.hpp>
Inherits QObject.
Public Types | |
| enum | Error_e { eERROR_NONE = 0 , eERROR_CRASHED , eERROR_ACTIVE } |
Public Member Functions | |
| QCanServer (QObject *pclParentV=nullptr, uint16_t uwPortNumberV=QCAN_WEB_SOCKET_DEFAULT_PORT, uint8_t ubNetworkNumV=QCAN_NETWORK_MAX, bool btClearServerV=false) | |
| void | allowBitrateChange (bool btEnabledV=true) |
| QCanNetwork * | network (uint8_t ubNetworkIndexV) |
| uint8_t | maximumNetwork (void) const |
| QHostAddress | serverAddress (void) |
| void | setServerAddress (const QHostAddress clHostAddressV, const uint16_t uwPortV=QCAN_WEB_SOCKET_DEFAULT_PORT) |
| enum QCanServer::Error_e |
| QCanServer::QCanServer | ( | QObject * | pclParentV = nullptr, |
| uint16_t | uwPortNumberV = QCAN_WEB_SOCKET_DEFAULT_PORT, | ||
| uint8_t | ubNetworkNumV = QCAN_NETWORK_MAX, | ||
| bool | btClearServerV = false ) |
| [in] | pclParentV | Pointer to QObject parent class |
| [in] | uwPortNumberV | Port number for WebSocket access |
| [in] | ubNetworkNumV | Number of supported CAN networks |
| [in] | btClearServerV | Clear process memory |
Create new QCanServer object. The parameter ubNetworkNumV defines the maximum number of CAN networks (class QCanNetwork).
| void QCanServer::allowBitrateChange | ( | bool | btEnabledV = true | ) |
| [in] | btEnabledV | - Enable / disable bit rate change via application |
This function enables the setting of bit rate via any application if btEnable is true, it is disabled on false.
| uint8_t QCanServer::maximumNetwork | ( | void | ) | const |
The function returns the number of networks.
| QCanNetwork * QCanServer::network | ( | uint8_t | ubNetworkIndexV | ) |
| [in] | ubNetworkIndexV | - Network index |
The function returns a pointer to a QCanNetwork class stored at index ubNetworkIndexV. The first network is stored at index value 0.
|
inline |
The function returns the host address of the server.
| void QCanServer::setServerAddress | ( | const QHostAddress | clHostAddressV, |
| const uint16_t | uwPortV = QCAN_WEB_SOCKET_DEFAULT_PORT ) |
| [in] | clHostAddressV | - Host address |
| [in] | uwPortV | - Port number for WebSocket access |
The function configures the host address of the server.