void 
singlemotor::Read_Callback_Data(void)
{
   m_DataNum = 0;
   while(!m_DataNum)
   {
       m_DataNum = VCI_GetReceiveNum(VCI_USBCAN2,dev_n, 0);
       if((m_DataNum > 0)&&(pCAN_ReceiveData != NULL))
       {
           m_ReadDataNum = VCI_Receive(VCI_USBCAN2,dev_n, 0, pCAN_ReceiveData, m_DataNum);
/*
           for(int i= 0; i<m_ReadDataNum; i++)
           {
               printf("--CAN_ReceiveData.ID = 0x%X\n",pCAN_ReceiveData->ID);
               printf("--CAN_ReceiveData.Data:");
               for(int j=0;j<pCAN_ReceiveData->DataLen;j++)
               {
                   printf("%02X ",pCAN_ReceiveData->Data[j]);
               }
               printf("\n");
           }
*/
       }
   }
}
Example #2
0
bool USBCAN::receiveData(PVCI_CAN_OBJ pReceive, ULONG len, INT waitTime)
{
    if(this->_isStarted){
        DWORD dwRet;
        dwRet = VCI_Receive(this->_nDevType, this->_nDevIndex, this->_nCANIndex, pReceive, len, waitTime);
        this->_retCode = dwRet;
        if(dwRet == 0xFFFFFFFF){
            return FALSE;
        }
        else{
            this->_receivedFramesNumber = dwRet;
            return TRUE;
        }
    }
    else{
        return FALSE;
    }
}