kvDiag.h
Go to the documentation of this file.
1 /*
2  * Copyright 2002-2019 by KVASER AB, SWEDEN
3  *
4  * WWW: http://www.kvaser.com
5  *
6  * This software is furnished under a license and may be used and copied
7  * only in accordance with the terms of such license.
8  *
9  */
10 
22 #ifndef _KVDIAG_H_
23 #define _KVDIAG_H_
24 
25 #include <canlib.h>
26 #include <stdint.h>
27 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
40 #define DIAG_ANALYZER_TYPE_DEFAULT 0
50 #define DIAG_PROGRAM_TYPE_NORMAL 0
51 #define DIAG_PROGRAM_TYPE_AUTOBAUD 1
52 
54 #define DIAG_PROGRAM_TYPE_HALT 2
56 #define DIAG_PROGRAM_TYPE_GENERIC 3
57 
58 #define DIAG_PROGRAM_STATE_UNKNOWN 0
59 #define DIAG_PROGRAM_STATE_RUNNING 1
60 #define DIAG_PROGRAM_STATE_STOPPED 2
61 
63 
67 typedef struct {
68  double bitrate;
69  int quality;
70 } bitrate_t;
71 
72 
76 typedef struct {
79 } bitrates_t;
80 
84 typedef struct {
85  struct {
86  int version;
87  int seqno;
88  int type;
89  } header;
90  struct {
91  int id;
92  int64_t time;
93  char data[64];
94  int flag;
95  int dlc;
96  } msg;
97  struct {
98  int64_t startTime;
99  int sampleFreq;
100  int startValue;
101  int edgeCount;
102  int edgeTimes[8192];
103  } sample;
104 } kvDiagSample;
105 
106 typedef struct {
108  int type;
112 
113 
128 canStatus CANLIBAPI kvDiagGetNumberOfAnalyzers(const canHandle canHnd,
129  int *analyzerCount);
130 
145 canStatus CANLIBAPI kvDiagGetAnalyzerInfo(const canHandle canHnd,
146  kvAnalyzerInfo_t* info);
147 
167 canStatus CANLIBAPI kvDiagAttachAnalyzer(const canHandle canHnd, int type);
168 
185 canStatus CANLIBAPI kvDiagDetachAnalyzer(const canHandle canHnd);
186 
217 canStatus CANLIBAPI kvDiagSetProgram(const canHandle canHnd,
218  int programType,
219  const char *const configBuffer);
220 
234 canStatus CANLIBAPI kvDiagStart(const canHandle canHnd);
235 
251 canStatus CANLIBAPI kvDiagStop(const canHandle canHnd);
252 
274 canStatus CANLIBAPI kvDiagReadSample(const canHandle canHnd,
275  kvDiagSample *sample);
276 
301 canStatus CANLIBAPI kvDiagReadSampleWait(const canHandle canHnd,
302  kvDiagSample *sample,
303  int timeout);
304 
305 
337 canStatus CANLIBAPI kvDiagCalculateBitrate(const canHandle canHnd, bitrates_t *btr);
338 
353 canStatus CANLIBAPI kvDiagResetBitrateCalculation(const canHandle canHnd);
354 
407 canStatus CANLIBAPI kvDiagCalculateClockOffset(const canHandle canHnd,
408  int id,
409  double *fMin,
410  double *fMax,
411  double *fMean,
412  double *fStd,
413  int *n);
414 
430 
431 
432 #ifdef __cplusplus
433 }
434 #endif
435 
436 #endif // _KVDIAG_H_
Definition: kvDiag.h:76
canStatus kvDiagSetProgram(const canHandle canHnd, int programType, const char *const configBuffer)
canStatus kvDiagDetachAnalyzer(const canHandle canHnd)
Definition: kvDiag.h:106
canStatus kvDiagStart(const canHandle canHnd)
int canHandle
Definition: canlib.h:118
canStatus kvDiagAttachAnalyzer(const canHandle canHnd, int type)
canStatus kvDiagCalculateBitrate(const canHandle canHnd, bitrates_t *btr)
canStatus kvDiagGetNumberOfAnalyzers(const canHandle canHnd, int *analyzerCount)
double bitrate
Bitrate in kBit/s.
Definition: kvDiag.h:68
int type
Definition: kvDiag.h:108
Definitions for the CANlib API.
canStatus kvDiagGetAnalyzerInfo(const canHandle canHnd, kvAnalyzerInfo_t *info)
canStatus kvDiagReadSampleWait(const canHandle canHnd, kvDiagSample *sample, int timeout)
canStatus kvDiagStop(const canHandle canHnd)
bitrate_t bitrate
Bitrate, arbitration bitrate if using FD with BRS.
Definition: kvDiag.h:77
canStatus kvDiagResetBitrateCalculation(const canHandle canHnd)
Definition: kvDiag.h:67
canStatus kvDiagResetClockOffsetCalculation(const canHandle canHnd)
canStatus kvDiagReadSample(const canHandle canHnd, kvDiagSample *sample)
int analyzerNo
Definition: kvDiag.h:107
bitrate_t bitrate_brs
Data bitrate if using FD with BRS.
Definition: kvDiag.h:78
int quality
Quality value in % (0..100)
Definition: kvDiag.h:69
canStatus
Definition: canstat.h:34
canStatus kvDiagCalculateClockOffset(const canHandle canHnd, int id, double *fMin, double *fMax, double *fMean, double *fStd, int *n)
int version_minor
Definition: kvDiag.h:110
Definition: kvDiag.h:84
int version_major
Definition: kvDiag.h:109