Neonode zForce(TM) SDK

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

Classes | Macros | Typedefs | Enumerations | Functions
Transport.h File Reference

Transport Base class. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | Transport
| Transport struct. This structure represents the base class of all Transport definitions. More...

## Typedefs
typedef enum ReadWriteThreadStatus | ReadWriteThreadStatus
typedef struct TransportEntry | TransportEntry
typedef struct Transport | Transport

## Enumerations
enum | ReadWriteThreadStatus { ThreadIsNotRunning, ThreadIsInitializing, ThreadIsRunning, ThreadIsTerminating }
| Enum describing the current status of a Read or Write thread. More...

## Functions
DLLEXTERNAL Transport * | Transport_GetInstance (Connection *connection, char *connectionString, char *dataFrameType)
| This is the Transport factory function. More...
DLLEXTERNAL bool | Transport_AddTransport (TransportEntry *transportEntry)
| Add a new Transport to the list of those available. More...
DLLINTERNAL bool | Transport_Initialize (void)
| Initialize the Transport module. More...
DLLINTERNAL void | Transport_Uninitialize (void)
| Uninitialize the Transport module. More...

## Detailed Description

Transport Base class.

This module implements the Transport base class. Here we find all that is essential for a Transport.

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

## Typedef Documentation

typedef enum ReadWriteThreadStatus ReadWriteThreadStatus

See also
  ReadWriteThreadStatus

typedef struct Transport Transport

See also
  struct Transport

typedef struct TransportEntry TransportEntry

See also
  struct TransportEntry

## Enumeration Type Documentation

enum ReadWriteThreadStatus

Enum describing the current status of a Read or Write thread.

Enumerator
ThreadIsNotRunning | Thread is not running.
ThreadIsInitializing | Thread is Initializing.
ThreadIsRunning | Thread is Running.
ThreadIsTerminating | Thread is Terminating.

## Function Documentation

DLLEXTERNAL bool Transport_AddTransport | ( | TransportEntry * | transportEntry | ) |

Add a new Transport to the list of those available.

This is the method used to find inform the zForce SDK of Transports which can be used for communication.
Upon error the errno variable is set as follows:

- EALREADYADDED - A Transport matching the name and data frame type has already been added.
- EOUTOFMEMORY - The memory used to store Transport details has been exhausted.
- 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.
- EPARAMETERSTRINGTOOLONG - The option parameter string is longer than the MaxOptionParameterLength.

Parameters

  transportEntry | The description of the Transport to add.

Returns
  True if the Transport has been added. Otherwise false which indicates failure and the errno variable should be inspected for the reason why.

DLLEXTERNAL Transport* Transport_GetInstance | ( | Connection * | connection,
|  | char * | connectionString,
|  | char * | dataFrameType
| ) |  |

This is the Transport factory function.

This is the Transport class factory function. A new Transport structure is allocated and if this succeeds the fields of the structure are populated using the arguments passed to the constructor.
Should allocation fail, NULL will be returned and errno is set as follows:

- EOUTOFMEMORY - Memory allocation failed.
- EBADNAME - The connectionString does not have a Transport name of the correct format.
- EBADCONNECTION - The connection pointer is not valid.
- 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.
- EUNKNOWNTRANSPORT - Unknown transport.

Parameters

  connection | A pointer to the Connection instance that will be used with this Transport.
  connectionString | A pointer to a NUL terminated char string holding a unique human readable identifer. The contents of the string are copied to the Transport structure. The length of the string as measured by strlen should be at most TRANSPORTPROTOCOL_MaxEntryNameLength chars.
  dataFrameType | An identifying string that determines the type of data frames this Transport should traffic in.

Returns
  Returns a pointer the allocated Transport structure upon success, otherwise a NULL pointer is returned and errno is set accordingly.

DLLINTERNAL bool Transport_Initialize | ( | void |  | ) |

Initialize the Transport module.

Perform the initialization of the Transport module.
Upon error the errno variable is set as follows:

- EALREADYINITIALIZED - A previous initialization is still in effect.
- EALREADYADDED - A Transport matching the name and data frame type has already been added.
- EOUTOFMEMORY - The memory used to store Transport details has been exhausted.
- 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.
- EPARAMETERSTRINGTOOLONG - The option parameter string is longer than the MaxOptionParameterLength.

Returns
  True upon success, false otherwise.

DLLINTERNAL void Transport_Uninitialize | ( | void |  | ) |

Uninitialize the Transport module.

Perform the uninitialization of the Transport module.
Any allocated resources are deallocated.
Upon error the errno variable is set as follows:

- EBADMUTEX - We tried to use a mutex internally but it wasn't a valid mutex. This should not happen.

Returns
  No return value.