#include "232NetworkCommIF.h"
#include "NetworkDevice.h"

C232NetworkCommIF::C232NetworkCommIF()
{

}
C232NetworkCommIF::~C232NetworkCommIF()
{
}

int C232NetworkCommIF::NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data)
{
    //FWD to device...
    //Nothing to do with the data here, up it goes to the device instance!
    if(DeviceID == mDeviceHandle->GetDeviceID())
    {
        if(DeviceAddress == BROADCAST_VALUE ||
           DeviceAddress == mDeviceHandle->GetDeviceAddress())
        {
            mDeviceHandle->NewDeviceFrameReceived(DeviceID,DeviceAddress,MessageID,DataSize,Data);
            return RET_OK;
        }
    }

    return RET_OK;
}

//int C232NetworkCommIF::SendNetworkMessage(unsigned char MessageID, unsigned char Flags, unsigned char *Data, int Size)
//{
//    GetTxPacket(MessageID,Flags,Data,Size,mDeviceHandle->GetDeviceAddress(),mDeviceHandle->GetDeviceID());
//    return 1;
//}

int C232NetworkCommIF::SendNetworkMessage(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray *Data)
{
    Q_UNUSED(DeviceID)
    Q_UNUSED(DeviceAddress)
    Q_UNUSED(MessageID)
    Q_UNUSED(DataSize)
    Q_UNUSED(Data)

    return RET_OK;
}
