/// <summary> /// 如果初始化成功,则配置通道 /// </summary> public void ConfiguerTraceFile() { UInt32 iBuffer; TPCANStatus stsResult; //Configure the maximum size of a trace file to 5 megabytes // iBuffer = 5; stsResult = PCANBasic.SetValue(m_PcanHandle, TPCANParameter.PCAN_TRACE_SIZE, ref iBuffer, sizeof(UInt32)); if (stsResult != TPCANStatus.PCAN_ERROR_OK) { // tsslCANStatus.Text = GetFormatedError(stsResult); // Configure the way how trace files are created: // * Standard name is used // * Existing file is ovewritten, // * Only one file is created. // * Recording stopts when the file size reaches 5 megabytes. // iBuffer = PCANBasic.TRACE_FILE_SINGLE | PCANBasic.TRACE_FILE_OVERWRITE; } stsResult = PCANBasic.SetValue(m_PcanHandle, TPCANParameter.PCAN_TRACE_CONFIGURE, ref iBuffer, sizeof(UInt32)); // if (stsResult != TPCANStatus.PCAN_ERROR_OK) // tsslCANStatus.Text = GetFormatedError(stsResult); }
/// <summary> /// 配置日志信息 /// </summary> public void ConfiguerLogFile() { UInt32 iBuffer; iBuffer = PCANBasic.LOG_FUNCTION_ALL; PCANBasic.SetValue(PCANBasic.PCAN_NONEBUS, TPCANParameter.PCAN_LOG_CONFIGURE, ref iBuffer, sizeof(UInt32)); }
/// <summary> /// 设置一个通道的配置 /// </summary> public TPCANStatus setValue() { UInt32 iBuffer; TPCANStatus stsResult; iBuffer = Convert.ToUInt32(m_ReceiveEvent.SafeWaitHandle.DangerousGetHandle().ToInt32()); stsResult = PCANBasic.SetValue(m_PcanHandle, TPCANParameter.PCAN_RECEIVE_EVENT, ref iBuffer, sizeof(UInt32)); if (stsResult != TPCANStatus.PCAN_ERROR_OK) { // MessageBox.Show(GetFormatedError(stsResult), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; } return(stsResult); }