I messed up the merge, so pushing it over to another repo so I don't lose it. Will tidy up and remove later

Dependencies:   BufferedSerial FatFileSystemCpp mbed

VIPSSerialProtocol.h

Committer:
AndyA
Date:
19 months ago
Revision:
82:ee6eed2a51bd
Parent:
72:da2f1df6a50d
Child:
84:8094a1e64ecf

File content as of revision 82:ee6eed2a51bd:

#ifndef __VIPSSERIALPROTOCOL_H__
#define __VIPSSERIALPROTOCOL_H__

#include "PosSource.h"
#include "mbed.h"
#include "position.h"
#include "BufferedSerial.h"
#include "LTCApp.h"


extern const char* VIPSStatusMessages[];
struct UserSettings_s;

class VIPSSerial : public PosSource {

public:

    VIPSSerial(const PinName Tx, const PinName Rx);
    void run(void);

    // send all position outputs rather than just when requested.
    void sendAllUpdated(bool enable);


// VIPS specific Rx/Tx
    static void getCRC(void *data, int len, void *checksum);
    void sendQueued(void);
    void sendDirectTX(unsigned char* data, int dataLen);
    int getWaitingBuffer(unsigned char **TXBuffer, int *bytesToSend);
    void sendQuiet(void);

private:
    void onSerialRx(void);
    void processRxMessage();
    bool checkCRC(unsigned char* data);
    void sendResponse(unsigned char function, unsigned char* data, int dataLen);
    void queueResponse(unsigned char function, unsigned char* data, int dataLen);
    void sendAck(unsigned char function);
    void sendNack(unsigned char function);
    void sendVBOXTime();
    void parsePostionInput_legacy();
    void parsePostionInput_mocap();
    void onTxTimeout();
    bool checkNewPacketRC(unsigned char* data);

    int messagePrt;
    int messageLength;
    int statusMessage;
    bool newFormatMsg;

    int queueLen;
    
    //VIPSSerial* self;
};

#endif