forked from GerhardHoffmann/DCLibraries
214 lines
6.1 KiB
C
214 lines
6.1 KiB
C
#ifndef CONTROLBUS_H
|
|
#define CONTROLBUS_H
|
|
|
|
|
|
#include "tslib.h"
|
|
#include <QString>
|
|
#include "interfaces.h"
|
|
//#include "hwapi.h"
|
|
#include <QDebug>
|
|
#include "shared_mem_buffer.h"
|
|
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
// control serial interface gui <--> serial
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
void epi_setSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect);
|
|
// Actions: open serial port with parameters
|
|
|
|
void epi_closeSerial(void);
|
|
// Actions: close serial port
|
|
|
|
// Port -> API
|
|
void gpi_serialChanged(void);
|
|
// serial confirms that port was closed or opened
|
|
|
|
// Actions, API -> serialPort
|
|
uint8_t gpi_getSerialConn(void); // connect if 1, disconnect if 0
|
|
|
|
int gpi_getBaudNr(void);
|
|
|
|
QString gpi_getComPortName(void);
|
|
|
|
//#endif
|
|
|
|
void gpi_serialIsOpen(bool offen);
|
|
|
|
bool epi_isSerialPortOpen();
|
|
// true: port is open false: port is closed
|
|
|
|
|
|
|
|
// Actions, GUI Buttons -> API, start cyclic transmission
|
|
void epi_startEmmision(bool start); // 1: start sending activated
|
|
|
|
// Meldung von TabCom an Datif: starte zyklische Sendung:
|
|
bool gpi_isEmmisionOn(void);
|
|
|
|
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
// Status Display gui <--> serial
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// Statuszeile COM Port (serial Port) (open, closed)
|
|
// Display in tab_com
|
|
QString epi_getTxt4comStateLine(void);
|
|
void epi_clrTxt4comStateLine();
|
|
// GUI: get Text for serial Comport-State Line
|
|
|
|
//---------------------
|
|
// Statuszeile Handshakes (serial Control) flow.cpp
|
|
// geht überhaupt was raus? kommt überhaupt was zurück?
|
|
// I
|
|
QString epi_getTxt4HsStateLine(void);
|
|
void epi_clrTxt4HsStateLine();
|
|
// GUI: get Text
|
|
|
|
// II Master receive state (empfangenes Telgramm OK? crc? length? )
|
|
// Statuszeile Auswertung der SlaveResponse (serial Frame, CRC usw) (prot.cpp)
|
|
QString epi_getTxt4masterStateLine(void);
|
|
void epi_clrTxt4masterStateLine();
|
|
|
|
// III Slave receive (from Master) OK? if then show results, if not then show errors
|
|
// entweder Empfangsfehler anzeigen (crc? length?) oder result OUT-OK, OUT_ERR, IN_OK, IN_ERR
|
|
// Hintergrund: wenn der Slave Fehler im Master-Telegramm gefunden hat, dann kann er es auch
|
|
// nicht verwenden und nichts ausgeben oder einlesen
|
|
QString epi_getTxt4resultStateLine(void);
|
|
void epi_clrTxt4resultStateLine();
|
|
|
|
// IV Statuszeile Sende- und Empfangsdaten (Datif)
|
|
// Display in tab_com
|
|
QString epi_getTxt4dataStateLine(void);
|
|
void epi_clrTxt4dataStateLine();
|
|
// GUI: get Text for serial Comport-State Line
|
|
|
|
// V, unten, Datif
|
|
QString epi_getTxt4datifLine(void);
|
|
void epi_clrTxt4datifLine();
|
|
|
|
//---------------------
|
|
|
|
// sende-empfangs-Rohdaten-Fenster
|
|
// Display in tab_com
|
|
QString epi_getTxt4RsDiagWin(void);
|
|
void epi_clrTxt4RsDiagWin();
|
|
|
|
QString epi_get2ndTxt4RsDiagWin(void);
|
|
void epi_clr2ndTxt4RsDiagWin();
|
|
|
|
|
|
// Statuszeile COM Port (serial Port) (open, closed)
|
|
// Display in tab_com
|
|
void gpi_setTxt4comStateLine(QString txtline);
|
|
// serial: write Text to be displayed in serial Comport-State line (like "connected")
|
|
// used in vcp.cpp, links in tabCom
|
|
|
|
|
|
// Statuszeile Handshakes (serial Control)
|
|
// I obere Zeile
|
|
void gpi_setTxt4HsStateLine(QString txtline);
|
|
// used in flow.cc
|
|
|
|
// II
|
|
void gpi_setTxt4masterStateLine(QString txtline);
|
|
|
|
// III
|
|
void gpi_setTxt4resultStateLine(QString txtline);
|
|
|
|
// IV
|
|
void gpi_setTxt4dataStateLine(QString txtline);
|
|
// serial: write Text to be displayed in serial Comport-State line (like "connected")
|
|
// used in prot.cpp
|
|
|
|
// V unten:
|
|
void gpi_setTxt4datifLine(QString txtline);
|
|
|
|
|
|
// sende-empfangs-Rohdaten-Fenster
|
|
// Display in tab_com
|
|
void gpi_setTxt4RsDiagWin(QString txtline);
|
|
void gpi_set2ndTxt4RsDiagWin(QString txtline);
|
|
|
|
//#endif
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
// Memory for Slave responses, common data
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
bool epi_getResult_serialTestOK();
|
|
// retval: true: test was successful, got right response
|
|
|
|
|
|
// result of serial line test, slave sent fixed string
|
|
void gpi_storeResult_serialTestOK(bool wasOn);
|
|
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
// restore just received data
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
void gpi_startNewRequest();
|
|
// called by Datif
|
|
|
|
void gpi_storeResultOfLastRequest(bool answisok);
|
|
// written by Datif
|
|
|
|
uint8_t epi_getResultOfLastRequest();
|
|
// retval: 0: in progress 1: OK 2: error
|
|
|
|
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t *receivedData);
|
|
// stored by Datif
|
|
|
|
uint16_t epi_getLastPayLoad(uint16_t plBufSiz, uint8_t *payLoad);
|
|
// get data back in *pl, max 64 byte
|
|
// retval = nr of bytes received. If host buffer too small then
|
|
// only plBufSíz bytes are copied to pl
|
|
// plBufSíz=size of host buffer
|
|
|
|
void gpi_storeSlaveSerParams(uint8_t slaveBaudRate, uint8_t NrDataBits,
|
|
uint8_t parity, uint8_t NrStopBits);
|
|
|
|
void epi_getSlaveSerParams(uint8_t *slaveBaudRate, uint8_t *NrDataBits,
|
|
uint8_t *parity, uint8_t *NrStopBits);
|
|
|
|
QString epi_getSlaveParamSTR();
|
|
|
|
|
|
void gpi_storeLastResult(uint8_t letzteAntwort);
|
|
|
|
uint8_t epi_getLastResult(void);
|
|
// return: 0xFF: result unknown 0=OK
|
|
// 1= wrong length 2=wrong start sign 5= wrong crc
|
|
// 6= slave: master cmd was wrong 7: slave: could not write/read data
|
|
// 8=timeout, got no response from slave
|
|
|
|
|
|
void epi_startSupervision();
|
|
bool gpi_wantToResetSupervision();
|
|
|
|
|
|
|
|
void gpi_storeOverallResult(uint8_t letzteAntwort);
|
|
|
|
uint8_t epi_getBatchResult(void );
|
|
// 0xFF: no command sent by now
|
|
// 0: started, in progress
|
|
// 1: done and OK
|
|
// done and error
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|