CANpie FD
CAN programming interface environment - Version 3.08
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Modules Pages
Signals | Public Member Functions
QCanNetworkSettings Class Reference

Detailed Description

The QCanNetworkSettings provides the functionality to access parameters of a QCanNetwork.

Inherits QObject.

Signals

void objectReceived (const CAN_Channel_e teChannelV, QJsonObject clNetworkSettingsV)
 

Public Member Functions

 QCanNetworkSettings (const CAN_Channel_e teChannelV=eCAN_CHANNEL_1, QObject *pclParentV=Q_NULLPTR)
 
void connectToServer (const QHostAddress clServerAddressV=QHostAddress::LocalHost, const uint16_t uwPortV=QCAN_WEB_SOCKET_DEFAULT_PORT, const QString &clOriginR="", const uint32_t flags=0)
 
void closeConnection (void)
 
int32_t dataBitrate (void)
 
QString dataBitrateString (void)
 
int32_t errorCount (void)
 
int32_t frameCount (void)
 
bool isValid (void)
 
QString name (void)
 
int32_t nominalBitrate (void)
 
QString nominalBitrateString (void)
 
void reset (void)
 
void setBitrate (int32_t slNomBitRateV, int32_t slDatBitRateV=eCAN_BITRATE_NONE)
 
void setMode (const CAN_Mode_e teModeV)
 
CAN_State_e state (void)
 
QString stateString (void)
 

Constructor & Destructor Documentation

◆ QCanNetworkSettings()

QCanNetworkSettings::QCanNetworkSettings ( const CAN_Channel_e  teChannelV = eCAN_CHANNEL_1,
QObject *  pclParentV = Q_NULLPTR 
)
Parameters
[in]teChannelV- CAN channel
[in]pclParentV- Pointer to QObject parent class

Construct a QCanNetworkSettings object for the channel teChannelV.

Member Function Documentation

◆ closeConnection()

void QCanNetworkSettings::closeConnection ( void  )
See also
connectToServer()

The method closes a WebSocket connection to a QCanNetwork class.

◆ 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  )
Returns
Data bit-rate
See also
dataBitrateString()

Return the current data 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. The result of this function is equivalent to QCanNetwork::dataBitrate().

◆ 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()

int32_t QCanNetworkSettings::errorCount ( 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".

◆ frameCount()

int32_t QCanNetworkSettings::frameCount ( 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".

◆ 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 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  )

Reset the network.

◆ setBitrate()

void QCanNetworkSettings::setBitrate ( int32_t  slNomBitRateV,
int32_t  slDatBitRateV = eCAN_BITRATE_NONE 
)
Parameters
[in]slNomBitRateVNominal bit-rate
[in]slDatBitRateVData bit-rate

Set the bit-rate of the network.

◆ setMode()

void QCanNetworkSettings::setMode ( const CAN_Mode_e  teModeV)
Parameters
[in]teModeVRequested CAN mode

Set the CAN mode of the network.

◆ state()

CAN_State_e QCanNetworkSettings::state ( void  )
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.