Vuo  2.0.0
Classes | Typedefs | Functions | Variables
VuoSerialIO.cc File Reference

Description

VuoSerialIO implementation.

Definition in file VuoSerialIO.cc.

Go to the source code of this file.

Classes

struct  _VuoSerial_internal
 Private data for a VuoSerial instance. More...
 

Typedefs

typedef struct _VuoSerial_internalVuoSerial_internal
 Private data for a VuoSerial instance. More...
 

Functions

static void __attribute__ ((constructor)) VuoSerialIO_init()
 Initializes VuoSerial_pendingDevicesQueue. More...
 
void VuoSerial_processPacket (VuoSerial_internal si)
 Reads and parses a single serial packet from the Dispatch Source's file handle. More...
 
static void VuoSerial_initSource (VuoSerial_internal si)
 Sets up a Dispatch Source for the specified file handle. More...
 
static int VuoSerial_openDevice (const char *devicePath)
 Attempts to open the specified device. More...
 
void VuoSerial_checkPendingDevices (void)
 Attempts to open each device that has been requested but hasn't yet been successfully opened. More...
 
VuoSerial VuoSerial_getShared (const VuoText devicePath)
 Returns the reference-counted object for the specified serial device. More...
 
void VuoSerial_addReceiveTrigger (VuoSerial device, VuoOutputTrigger(receivedData, VuoData))
 Adds a trigger callback, to be invoked whenever the specified serial device receives data. More...
 
void VuoSerial_removeReceiveTrigger (VuoSerial device, VuoOutputTrigger(receivedData, VuoData))
 Removes a trigger callback previously added by VuoSerial_addReceiveTrigger. More...
 
void VuoSerial_sendData (VuoSerial device, const VuoData data)
 Enqueues data for output on device. More...
 
void VuoSerial_configureDevice (VuoSerial device, VuoInteger baudRate, VuoInteger dataBits, VuoParity parity, VuoInteger stopBits)
 Changes system-wide settings for the specified serial device. More...
 
 VUOKEYEDPOOL (std::string, VuoSerial_internal)
 VuoKeyedPool_VuoSerial. More...
 
static void VuoSerial_destroy (VuoSerial_internal si)
 VuoKeyedPool_VuoSerial. More...
 
VuoSerial_internal VuoSerial_make (std::string devicePath)
 VuoKeyedPool_VuoSerial. More...
 
 VUOKEYEDPOOL_DEFINE (std::string, VuoSerial_internal, VuoSerial_make)
 VuoKeyedPool_VuoSerial. More...
 

Variables

static dispatch_queue_t VuoSerial_pendingDevicesQueue
 Serializes access to VuoSerial_pendingDevices. More...
 
static std::set< VuoSerial_internalVuoSerial_pendingDevices
 Devices that have been requested but haven't yet been successfully opened. More...
 

Class Documentation

◆ _VuoSerial_internal

struct _VuoSerial_internal
Class Members
VuoText devicePath The target device this instance represents.
int fileHandle
dispatch_queue_t queue
dispatch_source_t source
VuoTriggerSet< VuoData > triggerSet

Typedef Documentation

◆ VuoSerial_internal

Private data for a VuoSerial instance.

Function Documentation

◆ __attribute__()

static void __attribute__ ( (constructor)  )
static

Initializes VuoSerial_pendingDevicesQueue.

Definition at line 55 of file VuoSerialIO.cc.

◆ VUOKEYEDPOOL()

VUOKEYEDPOOL ( std::string  ,
VuoSerial_internal   
)

VuoKeyedPool_VuoSerial.

◆ VUOKEYEDPOOL_DEFINE()

VUOKEYEDPOOL_DEFINE ( std::string  ,
VuoSerial_internal  ,
VuoSerial_make   
)

VuoKeyedPool_VuoSerial.

◆ VuoSerial_addReceiveTrigger()

void VuoSerial_addReceiveTrigger ( VuoSerial  device,
VuoOutputTrigger(receivedData, VuoData  
)

Adds a trigger callback, to be invoked whenever the specified serial device receives data.

This function may be called from any thread.

Definition at line 250 of file VuoSerialIO.cc.

◆ VuoSerial_checkPendingDevices()

void VuoSerial_checkPendingDevices ( void  )

Attempts to open each device that has been requested but hasn't yet been successfully opened.

This function may be called from any thread.

Definition at line 155 of file VuoSerialIO.cc.

◆ VuoSerial_configureDevice()

void VuoSerial_configureDevice ( VuoSerial  device,
VuoInteger  baudRate,
VuoInteger  dataBits,
VuoParity  parity,
VuoInteger  stopBits 
)

Changes system-wide settings for the specified serial device.

Definition at line 297 of file VuoSerialIO.cc.

◆ VuoSerial_destroy()

static void VuoSerial_destroy ( VuoSerial_internal  si)
static

VuoKeyedPool_VuoSerial.

Definition at line 206 of file VuoSerialIO.cc.

◆ VuoSerial_getShared()

VuoSerial VuoSerial_getShared ( const VuoText  devicePath)

Returns the reference-counted object for the specified serial device.

Definition at line 239 of file VuoSerialIO.cc.

◆ VuoSerial_initSource()

static void VuoSerial_initSource ( VuoSerial_internal  si)
static

Sets up a Dispatch Source for the specified file handle.

Definition at line 125 of file VuoSerialIO.cc.

◆ VuoSerial_make()

VuoSerial_internal VuoSerial_make ( std::string  devicePath)

VuoKeyedPool_VuoSerial.

Definition at line 177 of file VuoSerialIO.cc.

◆ VuoSerial_openDevice()

static int VuoSerial_openDevice ( const char *  devicePath)
static

Attempts to open the specified device.

Definition at line 140 of file VuoSerialIO.cc.

◆ VuoSerial_processPacket()

void VuoSerial_processPacket ( VuoSerial_internal  si)

Reads and parses a single serial packet from the Dispatch Source's file handle.

This function may only be called on dispatch queue VuoSerial_internal::queue.

Definition at line 66 of file VuoSerialIO.cc.

◆ VuoSerial_removeReceiveTrigger()

void VuoSerial_removeReceiveTrigger ( VuoSerial  device,
VuoOutputTrigger(receivedData, VuoData  
)

Removes a trigger callback previously added by VuoSerial_addReceiveTrigger.

This function may be called from any thread.

Definition at line 266 of file VuoSerialIO.cc.

◆ VuoSerial_sendData()

void VuoSerial_sendData ( VuoSerial  device,
const VuoData  data 
)

Enqueues data for output on device.

Definition at line 279 of file VuoSerialIO.cc.

Variable Documentation

◆ VuoSerial_pendingDevices

std::set<VuoSerial_internal> VuoSerial_pendingDevices
static

Devices that have been requested but haven't yet been successfully opened.

Definition at line 49 of file VuoSerialIO.cc.

◆ VuoSerial_pendingDevicesQueue

dispatch_queue_t VuoSerial_pendingDevicesQueue
static

Serializes access to VuoSerial_pendingDevices.

Definition at line 48 of file VuoSerialIO.cc.