Skip to content. | Skip to navigation

Personal tools

remote/mstreds.h

remote/mstreds.h

remote/mstreds.h

/////////////////////////////////////////////////////////////////////////////
// mastereds.h
//
//  Last updated: 1/23/2006
//
//  This file contains code to implement the Engineering Data Stream (EDS)
//  log which captures the responses from downstream and forwards them to
//  upstream when asked to.
/////////////////////////////////////////////////////////////////////////////

#include <stdarg.h>
#include <time.h>

//unsigned long EDSTime; // Time in ms of last periodic EDS Update

/////////////////////////////////////////////////////////////////////////////
// CEDSLog Class Definition
//
//  The CEDSLog class implements a circular log in memory.
//  The class is capable of adding to the log, and reporting log entried
//  to a host computer.
//  Call the Init member function before using any of the other functions.

typedef char edsstr[120]; // All log entries are ~99 character strings

class CEDSLog
{
  public:
  void Init(int logSize);
  // Init initializes the log.  Pass it:
  // logSize: number of lines in the log
  void Add(int messagenum,char* data,...);
  // Add adds a log entry to the log. Pass it the string to add in data
  void AddFromSlave(char *r);
  // Add a response comming from downstream to the edslog
  void SendNextMessage();
  // Sends the oldest message in the queue to the host computer
  void RepeatLastMessage();
  // Re-sends the oldest message in the queue to the host computer

  private:
  int First; 	  // Stores the array index of the oldest log entry
  int Index;      // Stores the array index of the next message to send
  int LastIndex;  // Stores the array index of the last message sent
  int Last;       // Stores the array index of the newest log entry
  int LogSize;    // Stores the maximum number of lines in the log
  edsstr * Data;  // Array of strings for the log
} EDSLog;

/////////////////////////////////////////////////////////////////////////////
// UpdateEDS - Add periodic EDS entries
//void UpdateEDS();

Generated by GNU Enscript 1.6.5.2.
Document Actions