LINXx firmware
Extensions to LINX toolkit
Public Member Functions | Public Attributes | List of all members
LinxListener Class Reference

Base class for LV-board communications. More...

#include <LinxListener.h>

Inheritance diagram for LinxListener:
LinxSerialListener LinxWiFi101Listener

Public Member Functions

virtual int Start ()
 
virtual int Listen ()
 
virtual int Available ()
 
virtual int Accept ()
 
virtual int Connected ()
 
virtual int Close ()
 
virtual int Exit ()
 
void AttachCustomCommand (unsigned short commandNumber, int(*function)(unsigned char, unsigned char *, unsigned char *, unsigned char *))
 
void AttachPeriodicTask (int(*function)(unsigned char *, unsigned char *))
 
virtual int CheckForCommands ()
 Runs listener state machine; to be called in sketch loop() More...
 
int ProcessCommand (unsigned char *recBuffer, unsigned char *sendBuffer)
 Handles command packets. More...
 
void PacketizeAndSend (unsigned char *commandPacketBuffer, unsigned char *responsePacketBuffer, unsigned int dataSize, int status)
 Sends response packet. More...
 
void StatusResponse (unsigned char *commandPacketBuffer, unsigned char *responsePacketBuffer, int status)
 Sends status only as response (no data) More...
 
void DataBufferResponse (unsigned char *commandPacketBuffer, unsigned char *responsePacketBuffer, const unsigned char *dataBuffer, unsigned char dataSize, int status)
 Format byte array and send as LINX packet. Does not include data length byte. More...
 
unsigned char ComputeChecksum (unsigned char *packetBuffer)
 
bool ChecksumPassed (unsigned char *packetBuffer)
 

Public Attributes

LinxDeviceLinxDev
 
LinxListenerState State
 
LinxListenerInterface Interface
 
unsigned char ListenerChan
 
unsigned char * recBuffer
 
unsigned char * sendBuffer
 
unsigned int PrevPacket =0
 
int(* customCommands [16])(unsigned char, unsigned char *, unsigned char *, unsigned char *)
 
int(* periodicTasks [1])(unsigned char *, unsigned char *)
 

Detailed Description

Base class for LV-board communications.

ProcessCommand handles the commands and responses; see here for specifics

Member Function Documentation

◆ Accept()

int LinxListener::Accept ( )
virtual

Reimplemented in LinxWiFi101Listener.

◆ Available()

int LinxListener::Available ( )
virtual

Reimplemented in LinxWiFi101Listener.

◆ CheckForCommands()

int LinxListener::CheckForCommands ( )
virtual

Runs listener state machine; to be called in sketch loop()

Returns
int

Reimplemented in LinxSerialListener, and LinxWiFi101Listener.

◆ Close()

int LinxListener::Close ( )
virtual

Reimplemented in LinxWiFi101Listener.

◆ Connected()

int LinxListener::Connected ( )
virtual

Reimplemented in LinxWiFi101Listener.

◆ DataBufferResponse()

void LinxListener::DataBufferResponse ( unsigned char *  commandPacketBuffer,
unsigned char *  responsePacketBuffer,
const unsigned char *  dataBuffer,
unsigned char  dataSize,
int  status 
)

Format byte array and send as LINX packet. Does not include data length byte.

Parameters
commandPacketBuffer
responsePacketBuffer
dataBuffer
dataSize
status

◆ Exit()

int LinxListener::Exit ( )
virtual

Reimplemented in LinxWiFi101Listener.

◆ Listen()

int LinxListener::Listen ( )
virtual

Reimplemented in LinxWiFi101Listener.

◆ PacketizeAndSend()

void LinxListener::PacketizeAndSend ( unsigned char *  commandPacketBuffer,
unsigned char *  responsePacketBuffer,
unsigned int  dataSize,
int  status 
)

Sends response packet.

Parameters
commandPacketBuffer
responsePacketBuffer
dataSize
status

◆ ProcessCommand()

int LinxListener::ProcessCommand ( unsigned char *  recBuffer,
unsigned char *  sendBuffer 
)

Handles command packets.

Parameters
commandPacketBuffer
responsePacketBuffer
Returns
int status

See here for table of commands

Todo:
Flush Linx Connection Buffer
Todo:
Set pin mode
Todo:
Set AI resolution
Todo:
Set AO ref voltage
Todo:
Set AO resolution
Todo:
PWM Open, Set Mode, Set Freq, Close
Todo:
Buffer functions (CircularBuffer library)
Todo:
Task functions (TaskScheduler library)

◆ StatusResponse()

void LinxListener::StatusResponse ( unsigned char *  commandPacketBuffer,
unsigned char *  responsePacketBuffer,
int  status 
)

Sends status only as response (no data)

Parameters
commandPacketBuffer
responsePacketBuffer
status

The documentation for this class was generated from the following files: