tCanDeviceT<TCanDescriptor>::~tCanDeviceT() { if (IsInitialized()) { #ifdef _SYSTEM_LXRT_ if (m_can_user >= 0) { DestroyCanFifoUser(m_can_device, m_can_user); return; } #endif CanDeviceClose(m_can_device); } }
/** * \brief Lists the hardware interface available. * \param[out] asSelHwInterface, is INTERFACE_HW_LIST structure * \param[out] nCount , is INT contains the selected channel count. * \return S_OK for success, S_FALSE for failure */ HRESULT CDIL_CAN_MHS::CAN_ListHwInterfaces(INTERFACE_HW_LIST& asSelHwInterface, INT& nCount) { USES_CONVERSION; char str[2]; str[0] = '\0'; if (CanDeviceOpen(0, str) == CAN_STATUS_OK) { (void)CanDeviceClose(0); nCount = 1; //set the current number of channels sg_nNoOfChannels = 1; asSelHwInterface[0].m_dwIdInterface = 0; asSelHwInterface[0].m_acDescription = "0"; sg_bCurrState = STATE_HW_INTERFACE_LISTED; } else { nCount = 0; return (S_FALSE); } return(S_OK); }
/** * \brief Stops the controller. * \param void * \return S_OK for success, S_FALSE for failure */ HRESULT CDIL_CAN_MHS::CAN_StopHardware(void) { VALIDATE_VALUE_RETURN_VAL(sg_bCurrState, STATE_CONNECTED, ERR_IMPROPER_STATE); (void)CanDeviceClose(0); return(S_OK); }