liblinx

Section: Linux Simple I/O Library (2)
Updated: 21 December 2018
Index Return to Main Contents
 

NAME

liblinx -- Linux Simple I/O Library: LabView LINX Remote I/O Module  

SYNOPSIS

#include <libsimpleio/liblinx.h>

Structures:

typedef struct
{
  uint8_t  SoF;
  uint8_t  PacketSize;
  uint16_t PacketNum;
  uint16_t Command;
  uint8_t  Args[54];
} LINX_command_t;

typedef struct
{
  uint8_t  SoF;
  uint8_t  PacketSize;
  uint16_t PacketNum;
  uint8_t  Status;
  uint8_t  Data[55];
} LINX_response_t;

Server Routines:

void LINX_receive_command(int32_t fd, LINX_command_t *cmd, int32_t *count, int32_t *error);

void LINX_transmit_response(int32_t fd, LINX_response_t *resp, int32_t *error);

Client Routines:

void LINX_transmit_command(int32_t fd, LINX_command_t *cmd, int32_t *error);

void LINX_receive_response(int32_t fd, LINX_response_t *resp, int32_t *count, int32_t *error);

Byte Packing Routines:

uint16_t LINX_makeu16(uint8_t b0, uint8_t b1);

uint32_t LINX_makeu32(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3);

Byte Unpacking Routines:

uint8_t LINX_splitu16(uint16_t u16, int32_t bn);

uint8_t LINX_splitu32(uint32_t u32, int32_t bn);

Link with -lsimpleio.  

DESCRIPTION

These routines perform framing and encoding or decoding of LabView LINX remote I/O commands (from client to server) and responses (from server to client) to and from a bidirectional byte stream, which will typically be either a serial port or a network socket.

The transmit routines encode a frame from a command or response structure and write it to the stream indicated by the stream file descriptor fd. If the frame was written to the stream successfully, *error will be set to zero, otherwise it will be set to an errno value.

The receive routines read exactly one byte from the stream indicated by the stream file descriptor fd. If the byte was read successfully and completes a frame, *error will be set to zero. If a byte was read successfully, but did not complete a frame, *error will be set to EAGAIN. If the read failed, *error will be set to an errno value and the previous data discarded. Successive calls to each receive routine must pass the same command or response structure. The *count parameter preserves a byte counter between successive function calls.

A LINX server running on some hardware device will typically have a message loop that calls LINX_receive_command() to get each command from the LINX client, do some work, and then call LINX_transmit_response() to return results to the client.

A LINX client will typically call LINX_transmit_command() to send each command to the server and immediately thereafter call LINX_receive_response() to receive the results from the server.

The byte packing routines LINX_makeu16() and LINX_makeu32() pack two or four unsigned bytes into a 16-bit or 32-bit unsigned integer. b0 is the most significant byte and b1 or b3 is the least significant byte.

The byte unpacking routines LINX_splitu16() and LINX_splitu32() return a signle unsigned byte of a 16-bit or 32-bit unsigned integer, selected by the bn byte index parameter. A byte index of 0 selects the most significant byte and a byte index of 1 or 3 selects the least significant byte.  

SEE ALSO

libsimpleio(2), libadc(2), libdac(2), libevent(2), libgpio(2),
libhidraw(2), libi2c(2), libipv4(2), liblinux(2), libpwm(2),
libserial(2), libspi(2), libstream(2), libwatchdog(2)

https://www.labviewmakerhub.com/doku.php?id=learn:libraries:linx:spec:start  

AUTHOR

Philip Munts, President, Munts AM Corp dba Munts Technologies


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 09:41:20 GMT, December 21, 2018