Neonode zForce(TM) SDK
Classes | Typedefs | Enumerations | Functions
Connection.h File Reference

Handles connections. More...

Go to the source code of this file.

Classes

struct  ConnectionMessage
 
struct  Connection
 The main Connection struct. More...
 

Typedefs

typedef enum ConnectionStatus ConnectionStatus
 
typedef struct ConnectionMessage ConnectionMessage
 
typedef struct Connection Connection
 

Enumerations

enum  ConnectionStatus { Connected, Disconnected, ConnectionFault }
 Connection events. More...
 

Functions

DLLINTERNAL ConnectionMessageConnectionMessage_New (ConnectionStatus connectionStatus, uint32_t errorCode)
 
DLLEXTERNAL ConnectionConnection_New (char *connectionString, char *protocolString, char *dataFrameType)
 Create a new Connection. More...
 

Detailed Description

Handles connections.

Handles connections, acts as the glue between devices, protocols and transports. Also handles queues to notify software about incoming messages.

Typedef Documentation

typedef struct Connection Connection
See also
struct Connection
See also
enum ConnectionStatus

Enumeration Type Documentation

Connection events.

Enumerator
Connected 

Status changed to Connected.

Disconnected 

Status changed to Disconnected.

ConnectionFault 

Connection Fault.

Function Documentation

DLLEXTERNAL Connection* Connection_New ( char *  connectionString,
char *  protocolString,
char *  dataFrameType 
)

Create a new Connection.

This call does not actually connect, it just creates the binding between the Protocol and Transport.

On failure, errno is set.

  • EBADCONNECTION - Bad Connection pointer.
  • EOUTOFMEMORY - Out of memory.
  • EBADNAME - The protocolString does not have a protocol name of the correct format.
  • ::ENOSUCHPROTOCOL - There is no defined protocol with a name which matches the name in protocolString.
  • EMUTEXLOCKFAILED - We couldn't lock a mutex we need for an internal critical section. This should not happen.
  • EBADMUTEX - We tried to use a mutex internally but it wasn't a valid mutex. This should not happen.

    Example to connect to a USB CDC device connected on Linux device node /dev/ttyACM0 using ASN.1. Both of these handle Streaming DataFrames:
    Connection * connection = Connection_New("serial://port=/dev/ttyACM0", "asn1://", "Streaming");
Parameters
connectionStringA Transport specific connection string.
protocolStringA Protocol specific prototocol string.
dataFrameTypeWhich Data Frame Type the Transport and Protocol uses.
Returns
Connection pointer or NULL if failed. See errno.