The QCanNetworkSettings provides the functionality to access parameters of a QCanNetwork.
#include <qcan_network_settings.hpp>
Inherits QObject.
◆ QCanNetworkSettings()
- Parameters
-
| [in] | teChannelV | - CAN channel |
| [in] | pclParentV | - Pointer to QObject parent class |
Construct a QCanNetworkSettings object for the channel teChannelV.
◆ closeConnection()
| void QCanNetworkSettings::closeConnection |
( |
void | | ) |
|
◆ connectToServer()
| void QCanNetworkSettings::connectToServer |
( |
const QHostAddress | clServerAddressV = QHostAddress::LocalHost, |
|
|
const uint16_t | uwPortV = QCAN_WEB_SOCKET_DEFAULT_PORT, |
|
|
const QString & | clOriginR = "", |
|
|
const uint32_t | flags = 0 ) |
- Parameters
-
| [in] | clServerAddressV | - IPv4 or IPv6 address of QCanNetwork class |
| [in] | uwPortV | - port number of QCanNetwork class |
| [in] | clOriginR | - origin of the client |
| [in] | flags | - reserved |
- See also
- closeConnection()
The method opens a WebSocket connection to a QCanNetwork class defined by clServerAddressV and uwPortV.
The origin of the client defined by clOriginR is as specified in RFC 6454. The origin is not required for non-web browser clients (see RFC 6455). The origin may not contain new line characters, otherwise the connection will be aborted immediately during the handshake phase.
◆ dataBitrate()
| int32_t QCanNetworkSettings::dataBitrate |
( |
void | | ) |
|
◆ dataBitrateString()
| QString QCanNetworkSettings::dataBitrateString |
( |
void | | ) |
|
- Returns
- Data bit-rate
- See also
- dataBitrate()
Return the current data bit-rate of the selected network as string object. If the bit-rate value is not valid (not configured) the function returns "None".
◆ errorCount()
| uint32_t QCanNetworkSettings::errorCount |
( |
void | | ) |
|
- Returns
- Error counter value
- See also
- frameCount()
Return the number of errors in this network.
◆ frameCount()
| uint32_t QCanNetworkSettings::frameCount |
( |
void | | ) |
|
- Returns
- Frame counter value
- See also
- errorCount()
Return the number of frames transmitted in this network.
◆ isValid()
| bool QCanNetworkSettings::isValid |
( |
void | | ) |
|
- Returns
True if valid data available
The function returns True if a connection has been established to a QCanNetwork and the received JSON data has a vaild format.
◆ name()
| QString QCanNetworkSettings::name |
( |
void | | ) |
|
- Returns
- Network name
Return the name of the selected network as string object. If a CAN interface is attached to the network the function also returns the name of the CAN interface.
◆ nominalBitrate()
| int32_t QCanNetworkSettings::nominalBitrate |
( |
void | | ) |
|
- Returns
- Nominal bit-rate
- See also
- nominalBitrateString()
Return the current nominal bit-rate of the selected network in [bits/s]. If the bit-rate value is not valid (not configured) the function returns QCan::eCAN_BITRATE_NONE.
◆ nominalBitrateString()
| QString QCanNetworkSettings::nominalBitrateString |
( |
void | | ) |
|
- Returns
- Nominal bit-rate
- See also
- nominalBitrate()
Return the current nominal bit-rate of the selected network as string object. If the bit-rate value is not valid (not configured) the function returns "None".
◆ objectReceived
| void QCanNetworkSettings::objectReceived |
( |
const QCan::CAN_Channel_e | teChannelV, |
|
|
QJsonObject | clNetworkSettingsV ) |
|
signal |
- Parameters
-
| [in] | teChannelV | - CAN channel |
| [in] | clNetworkSettingsV | - JSON data |
This signal is emitted after a new object was received from a QCanNetwork instance. The JSON data has the following format:
{
"apiVersion": "1.0",
"bitrateData": 1000000,
"bitrateNominal": 500000,
"channel": 8,
"enabled": true,
"errorFrameEnabled": false,
"errorFrameSupport": true,
"flexibleDataEnabled": true,
"flexibleDataSupport": true,
"frameCount": 0,
"frameCountError": 0,
"listenOnlyEnabled": false,
"listenOnlySupport": false,
"name": "CAN 8",
"state": 2
}
◆ reset()
| void QCanNetworkSettings::reset |
( |
void | | ) |
|
◆ setBitrate()
- Parameters
-
| [in] | slNomBitRateV | Nominal bit-rate |
| [in] | slDatBitRateV | Data bit-rate |
Set the bit-rate of the network.
◆ setMode()
- Parameters
-
| [in] | teModeV | Requested CAN mode |
Set the CAN mode of the network.
◆ state()
- Returns
- CAN state
- See also
- stateString()
Return the current CAN state of the selected network.
◆ stateString()
| QString QCanNetworkSettings::stateString |
( |
void | | ) |
|
- Returns
- CAN state
- See also
- state()
Return the current CAN state of the selected network as string object.