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
| Connection messages struct. More...
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 ConnectionMessage * | ConnectionMessage_New (ConnectionStatus connectionStatus, uint32_t errorCode)
| Internal call used to create a new ConnectionMessage. More...
DLLEXTERNAL Connection * | Connection_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.

Copyright
  COPYRIGHT NOTICE: (c) 2017-2022 Neonode Technologies AB. All rights reserved.

## Typedef Documentation

## ◆ Connection

typedef struct Connection Connection

See also
  struct Connection

## ◆ ConnectionMessage

typedef struct ConnectionMessage ConnectionMessage

See also
  struct ConnectionMessage

## ◆ ConnectionStatus

typedef enum ConnectionStatus ConnectionStatus

See also
  enum ConnectionStatus

## Enumeration Type Documentation

## ◆ ConnectionStatus

enum ConnectionStatus

Connection events.

Enumerator
Connected | Status changed to Connected.
Disconnected | Status changed to Disconnected.
ConnectionFault | Connection Fault. Only set internally.

## Function Documentation

## ◆ Connection_New()

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

Create a new Connection.

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.

- EUNKNOWNTRANSPORT - Unknown transport.
- EOUTOFMEMORY - Out of memory.
- EBADNAME - The protocolString does not have a protocol name of the correct format.
- EUNKNOWNPROTOCOL - 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.
  Each Transport and Protocol has its own options.
  Example to connect to a sensor over Hid using Asn1 as protocol.
  HidPipeTransport (hidpipe) has the following options:
- vid - Vendor ID. Current neonode sensors have VID 0x1536.
- pid - Product ID. Current neonode sensors have PID 0x0101.
- index - If the computer has multiple connected Neonode sensors, the first one has index 0, the second has index 1, etc. Note: The order is decided by the Operating System.
  Asn1Protocol (asn1) currently has no options.
  StreamingDataFrame (Streaming) is the DataFrame type used by both HidPipeTransport and Asn1Protocol.
  MyConnection = Connection_New (
  "hidpipe://vid=0x1536,pid=0x0101,index=0",
  "asn1://",
  "Streaming");
  Parameters

    connectionString | A Transport specific connection string.
    protocolString | A Protocol specific prototocol string.
    dataFrameType | Which Data Frame Type the Transport and Protocol uses.

  Returns
    Connection pointer or NULL if failed. See errno.

## ◆ ConnectionMessage_New()

DLLINTERNAL ConnectionMessage* ConnectionMessage_New | ( | ConnectionStatus | connectionStatus,
|  | uint32_t | errorCode
| ) |  |

Internal call used to create a new ConnectionMessage.

Internal call used to create a new ConnectionMessage.
On failure, errno is set.

- EOUTOFMEMORY - Out of memory.

Parameters

  connectionStatus | ConnectionStatus of message.
  errorCode | ErrorCode of message.

Returns
  A pointer to the new ConnectionMessage.