TwiceAsNice  2019-02-18
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Connection::Interface Class Referenceabstract

The Interface class class is the base class for all INDI connection plugins. More...

#include <connectioninterface.h>

Inheritance diagram for Connection::Interface:
Inheritance graph
Collaboration diagram for Connection::Interface:
Collaboration graph

Public Types

enum  Type {
  CONNECTION_NONE = 1 << 0, CONNECTION_SERIAL = 1 << 1, CONNECTION_TCP = 1 << 2, CONNECTION_USB = 1 << 3,
  CONNECTION_CUSTOM = 1 << 15, CONNECTION_NONE = 1 << 0, CONNECTION_SERIAL = 1 << 1, CONNECTION_TCP = 1 << 2,
  CONNECTION_USB = 1 << 3, CONNECTION_CUSTOM = 1 << 15
}
 
enum  Type {
  CONNECTION_NONE = 1 << 0, CONNECTION_SERIAL = 1 << 1, CONNECTION_TCP = 1 << 2, CONNECTION_USB = 1 << 3,
  CONNECTION_CUSTOM = 1 << 15, CONNECTION_NONE = 1 << 0, CONNECTION_SERIAL = 1 << 1, CONNECTION_TCP = 1 << 2,
  CONNECTION_USB = 1 << 3, CONNECTION_CUSTOM = 1 << 15
}
 

Public Member Functions

virtual bool Connect ()=0
 Connect Connect to device via the implemented communication medium. More...
 
virtual bool Disconnect ()=0
 Disconnect Disconnect from device. More...
 
virtual void Activated ()=0
 Activated Function called by the framework when the plugin is activated (i.e. More...
 
virtual void Deactivated ()=0
 Deactivated Function called by the framework when the plugin is deactivated. More...
 
virtual std::string name ()=0
 
virtual std::string label ()=0
 
virtual Type type ()
 type Return connection type More...
 
virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 
virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
 
virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
 
virtual bool saveConfigItems (FILE *fp)
 
void registerHandshake (std::function< bool()> callback)
 registerHandshake Register a handshake function to be called once the intial connection to the device is established. More...
 
virtual bool Connect ()=0
 Connect Connect to device via the implemented communication medium. More...
 
virtual bool Disconnect ()=0
 Disconnect Disconnect from device. More...
 
virtual void Activated ()=0
 Activated Function called by the framework when the plugin is activated (i.e. More...
 
virtual void Deactivated ()=0
 Deactivated Function called by the framework when the plugin is deactivated. More...
 
virtual std::string name ()=0
 
virtual std::string label ()=0
 
virtual Type type ()
 type Return connection type More...
 
virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 
virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
 
virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
 
virtual bool saveConfigItems (FILE *fp)
 
void registerHandshake (std::function< bool()> callback)
 registerHandshake Register a handshake function to be called once the intial connection to the device is established. More...
 

Protected Member Functions

 Interface (INDI::DefaultDevice *dev, Type type=CONNECTION_NONE)
 
virtual ~Interface ()
 
const char * getDeviceName ()
 
 Interface (INDI::DefaultDevice *dev, Type type=CONNECTION_NONE)
 
virtual ~Interface ()
 
const char * getDeviceName ()
 

Protected Attributes

std::function< bool()> Handshake
 
INDI::DefaultDevicem_Device { nullptr }
 
Type m_Type { CONNECTION_NONE }
 

Detailed Description

The Interface class class is the base class for all INDI connection plugins.

Each plugin implements the connection details specific to a particular medium (e.g. serial). After the connection to the medium is successful, a handshake is initialted to make sure the device is online and responding to commands. The child class employing the plugin must register the handshake to perform the actual low-level communication with the device.

See also
Connection::Serial
Connection::TCP
INDI::Telescope utilizes both serial and tcp plugins to communicate with mounts.

Member Enumeration Documentation

◆ Type [1/2]

Enumerator
CONNECTION_NONE 
CONNECTION_SERIAL 

Do not use any connection plugin.

CONNECTION_TCP 

For regular serial and bluetooth connections.

CONNECTION_USB 

For Wired and WiFI connections.

CONNECTION_CUSTOM 

For USB-based connections.

CONNECTION_NONE 
CONNECTION_SERIAL 

Do not use any connection plugin.

CONNECTION_TCP 

For regular serial and bluetooth connections.

CONNECTION_USB 

For Wired and WiFI connections.

CONNECTION_CUSTOM 

For USB-based connections.

◆ Type [2/2]

Enumerator
CONNECTION_NONE 
CONNECTION_SERIAL 

Do not use any connection plugin.

CONNECTION_TCP 

For regular serial and bluetooth connections.

CONNECTION_USB 

For Wired and WiFI connections.

CONNECTION_CUSTOM 

For USB-based connections.

CONNECTION_NONE 
CONNECTION_SERIAL 

Do not use any connection plugin.

CONNECTION_TCP 

For regular serial and bluetooth connections.

CONNECTION_USB 

For Wired and WiFI connections.

CONNECTION_CUSTOM 

For USB-based connections.

Constructor & Destructor Documentation

◆ Interface() [1/2]

Connection::Interface::Interface ( INDI::DefaultDevice dev,
Type  type = CONNECTION_NONE 
)
protected

◆ ~Interface() [1/2]

Connection::Interface::~Interface ( )
protectedvirtual

◆ Interface() [2/2]

Connection::Interface::Interface ( INDI::DefaultDevice dev,
Type  type = CONNECTION_NONE 
)
protected

◆ ~Interface() [2/2]

virtual Connection::Interface::~Interface ( )
protectedvirtual

Member Function Documentation

◆ Activated() [1/2]

virtual void Connection::Interface::Activated ( )
pure virtual

Activated Function called by the framework when the plugin is activated (i.e.

selected by the user). It is usually used to define properties pertaining to the specific plugin functionalities.

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ Activated() [2/2]

virtual void Connection::Interface::Activated ( )
pure virtual

Activated Function called by the framework when the plugin is activated (i.e.

selected by the user). It is usually used to define properties pertaining to the specific plugin functionalities.

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ Connect() [1/2]

virtual bool Connection::Interface::Connect ( )
pure virtual

Connect Connect to device via the implemented communication medium.

Do not perform any handshakes.

Returns
True if successful, false otherwise.

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ Connect() [2/2]

virtual bool Connection::Interface::Connect ( )
pure virtual

Connect Connect to device via the implemented communication medium.

Do not perform any handshakes.

Returns
True if successful, false otherwise.

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ Deactivated() [1/2]

virtual void Connection::Interface::Deactivated ( )
pure virtual

Deactivated Function called by the framework when the plugin is deactivated.

It is usually used to delete properties by were defined previously since the plugin is no longer active.

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ Deactivated() [2/2]

virtual void Connection::Interface::Deactivated ( )
pure virtual

Deactivated Function called by the framework when the plugin is deactivated.

It is usually used to delete properties by were defined previously since the plugin is no longer active.

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ Disconnect() [1/2]

virtual bool Connection::Interface::Disconnect ( )
pure virtual

Disconnect Disconnect from device.

Returns
True if successful, false otherwise.

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ Disconnect() [2/2]

virtual bool Connection::Interface::Disconnect ( )
pure virtual

Disconnect Disconnect from device.

Returns
True if successful, false otherwise.

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ getDeviceName() [1/2]

const char * Connection::Interface::getDeviceName ( )
protected

◆ getDeviceName() [2/2]

const char* Connection::Interface::getDeviceName ( )
protected

◆ ISNewNumber() [1/2]

bool Connection::Interface::ISNewNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)
virtual

◆ ISNewNumber() [2/2]

virtual bool Connection::Interface::ISNewNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)
virtual

◆ ISNewSwitch() [1/2]

bool Connection::Interface::ISNewSwitch ( const char *  dev,
const char *  name,
ISState states,
char *  names[],
int  n 
)
virtual

◆ ISNewSwitch() [2/2]

virtual bool Connection::Interface::ISNewSwitch ( const char *  dev,
const char *  name,
ISState states,
char *  names[],
int  n 
)
virtual

◆ ISNewText() [1/2]

virtual bool Connection::Interface::ISNewText ( const char *  dev,
const char *  name,
char *  texts[],
char *  names[],
int  n 
)
virtual

◆ ISNewText() [2/2]

bool Connection::Interface::ISNewText ( const char *  dev,
const char *  name,
char *  texts[],
char *  names[],
int  n 
)
virtual

◆ label() [1/2]

virtual std::string Connection::Interface::label ( )
pure virtual
Returns
Plugin friendly label presented to the client/user.

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ label() [2/2]

virtual std::string Connection::Interface::label ( )
pure virtual
Returns
Plugin friendly label presented to the client/user.

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ name() [1/2]

virtual std::string Connection::Interface::name ( )
pure virtual
Returns
Plugin name

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ name() [2/2]

virtual std::string Connection::Interface::name ( )
pure virtual
Returns
Plugin name

Implemented in Connection::Serial, Connection::Serial, Connection::TCP, and Connection::TCP.

◆ registerHandshake() [1/2]

void Connection::Interface::registerHandshake ( std::function< bool()>  callback)

registerHandshake Register a handshake function to be called once the intial connection to the device is established.

Parameters
callbackHandshake function callback
See also
INDI::Telescope

◆ registerHandshake() [2/2]

void Connection::Interface::registerHandshake ( std::function< bool()>  callback)

registerHandshake Register a handshake function to be called once the intial connection to the device is established.

Parameters
callbackHandshake function callback
See also
INDI::Telescope

◆ saveConfigItems() [1/2]

virtual bool Connection::Interface::saveConfigItems ( FILE *  fp)
virtual

◆ saveConfigItems() [2/2]

bool Connection::Interface::saveConfigItems ( FILE *  fp)
virtual

◆ type() [1/2]

virtual Type Connection::Interface::type ( )
inlinevirtual

type Return connection type

Returns
connection type

◆ type() [2/2]

virtual Type Connection::Interface::type ( )
inlinevirtual

type Return connection type

Returns
connection type

Member Data Documentation

◆ Handshake

std::function< bool()> Connection::Interface::Handshake
protected

◆ m_Device

INDI::DefaultDevice * Connection::Interface::m_Device { nullptr }
protected

◆ m_Type

Type Connection::Interface::m_Type { CONNECTION_NONE }
protected

The documentation for this class was generated from the following files: