CAX25Socket

CAX25Socket realises a AX25 connection socket.

Header: #inlcude „cax25socket.h“

qmake: qt += core

Inherits: QIODevice

Inhalt

Detailed Description

CAX25Socket realises a AX25 connection socket. There are two ways to start an AX25 connection. The connection could be established by an external peer by connecting a listeing server or it can be established by creating a CAX25Socket object and connecting an external peer.

If the connection is established by an external peer connecting a listening server the CAX25Socket object is created by the server. A pointer to the socket object can be gotten by CAX25Server::nextPendingConnection().

For an active connection a CAX25Socket object has to be created. The constructor needs a pointer to a frame scheduler which can be gotten by CAx25L1Socket::GetScheduler() of an layer 1 socket object. After the socket object is created thesocket has to be bound to a local callsign with CAX25Socket::bind( const QString &SLocalCall). Then the connection process can be started by CAX25Socket::connectToHost(const QString &SPeerCall, const QStringList &contL2Digis ). SPeerCall is the callsign of the peer. contL2Digis is a string list of callsigns of digipeater that will be used for layer 2 digipeating. When the connection is established a connected() signal is emitted.

If the connection process is not successful a disconnected() signal is emitted.

For data transfer the user has access to the socket connection like on any other QIODevice.

For sutting down the connection one can use CAX25Socket::disconnectFromHost( void ). After the connection is closed a disconnected() signal is emitted.

Member Type Documentation

enum CAX25Socket::TSocketState

There are four socket states implemented:

  • UnconnectedState
  • ConnectingState
  • ConnectedState
  • ListeningState

Member Function Documentation

Constructors and Destructors

CAX25Socket( QObject *ptParent = NULL )

ptParent is a pointer to a parent object. This constructor is also used as default constructor.

CAX25Socket( CAX25FrameSchedule *ptSchedule, QObject *ptParent = NULL )

Constructor used for outgoing connections. ptSchedule is a pointer to a frame scheduler object. ptParent is a pointer to a parent object.

CAX25Socket( const CAX25Socket &skSource )

Copy constructor

CAX25Socket( CAX25FrameSchedule *ptSchedule, CAX25Connection *ptCon, QObject *ptParent = NULL )

Constructor internally used in CAX25Server

~CAX25Socket( void )

Destructor

Signals

Four signals inherited from QIODevice.

void connected( void )

This signal is emitted when a new connected could be established.

void disconnected( void )

This signal is emitted when a connection was disconnected.

void stateChanged( TSocketState enNewState )

This signal is emitted when the connection state is changed. enNewState is the new socket state.

Public Member Functions

36 public member function inherited from QIODevice.

CAX25Socket& operator=( const CAX25Socket &skSource )

Assignation operator

bool atEnd( void ) const

returns whether the data stream is at the end.

qint64 bytesAvailable( void ) const

returns the number of bytes in the socket buffer that could be read.

qint64 bytesToWrite( void ) const

returns the number of bytes that still have to be transmitted.

bool canReadLine( void ) const

returns true.

void close( void )

Closes the connection.

bool isSequential( void ) const

returns true

TSocketState state( void ) const

returns the current socket state.

void setScheduler( CAX25FrameSchedule *ptSchedule )

set a new frame scheduler for the socket. ptSchedule is a pointer to a frame scheduler object.

bool bind( const QString &SLocalCallsign )

bind the socket to a local callsign. SLocalCallsign is the callsignstring. If the binding was successful bind returns true, otherwise false.

void connectToHost( const QString &SPeerCallsign, const QStringList &contL2Digis )

connectToHost starts the connection process. SPeerCallsign is the callsign of the peer station and contL2Digis a string list of callsigns of digipeater should be used for layer 2 digipeating.

The socket state is changed to CAX25Socket::ConnectingState. When the connecting was successful a connected() signal is emitted and the socket changes to CAX25Scocket::ConnectedState. If the retry counter exceeded a disconnected() signal is emitted and the state changes to CAX25Socket::UnconnectedState.

void disconnectFromHost( void )

The socket starts disconnecting the connection. After disconnection a disconnected() signal is emitted. Then the socket changes to CAX25Socket::UnconnectedState.

QString localAddress( void ) const

returns the local callsign.

QString peerName( void ) const

returns the callsign of the peer.

QStringList l2Digipeater( void ) const

returns a stringlist of callsigns of layer 2 digipeater.

 

 

0 0 votes
Article Rating
Subscribe
Benachrichtige mich zu:
0 Comments
älteste
neuste beste Bewertung
Inline Feedbacks
View all comments