#ifndef DEVICECOM_H
#define DEVICECOM_H

#include <windows.h>
#include <QMutex>
#include <QMutexLocker>
#include "ftd2xx.h"

#define DEVICE_SERIAL   "LABPOW01"

#define	START_FRAME     'a'
#define	END_FRAME		'U'

class DeviceCom
{
public:
    DeviceCom();
    ~DeviceCom();

    bool isConnected();

    int connect();

    int disconnect();

    int write(BYTE *outputBuffer, int size);

    int read(BYTE *inputBuffer);

    int checkDevice();

    int getNewValues(BYTE *newValues);

    int setValue(unsigned char address, BYTE value);

    int clean();

    int setOutput(bool set_output);

protected:
    FT_HANDLE DeviceHandle;
    QMutex mutex;
    bool connected;

};

#endif // DEVICECOM_H
