/** * @brief Stops the controller. * @param void * @return S_OK for success, S_FALSE for failure */ HRESULT CDIL_CAN_VSCOM::stopHardware(void) { VALIDATE_VALUE_RETURN_VAL(sg_bCurrState, STATE_CONNECTED, ERR_IMPROPER_STATE); if (sg_hReadThread != NULL) { TerminateThread(sg_hReadThread, 0); sg_hReadThread = NULL; } if (sg_hEventRecv != NULL) { CloseHandle(sg_hEventRecv); sg_hEventRecv = NULL; } if (sg_VSCanCfg.hCan > 0) { VSCAN_Close(sg_VSCanCfg.hCan); sg_VSCanCfg.hCan = 0; } return(S_OK); }
int canClose_driver(CAN_HANDLE fd0) { VSCAN_Close((VSCAN_HANDLE)fd0); return 0; }